Software Quality – Lecture # 1
COMP 10066
Week 7 Lecture
Copyright By PowCoder代写 加微信 powcoder
Software Quality from the Programmer’s Perspective
Lecture Overview
Introduce Source Control
Look at GIT
Look at Software Quality Standards
Readable Code
Commenting
Reference Material for Lecture
Java Style Programming Guidelines
http://geosoft.no/development/javastyle.html
C#.Net Programming Guidelines
https://www.dofactory.com/reference/csharp-coding-standards
What is Source Code Control?
Sometimes called version control or source code control – is the management of changes to documents, computer programs, large web sites, and other collections of information.
Changes are usually identified by a number or letter code, termed the “revision number,” “revision level,” or simply “revision.”
What is the purpose of using a Version Control System
Version control systems (VCS) most commonly run as stand-alone applications, but revision control is also embedded in various types of software such as word processors and spreadsheets.
Revision control allows for the ability to revert a document to a previous revision, which is critical for allowing editors to track each other’s edits, correct mistakes, and defend against vandalism.
Reference: https://en.wikipedia.org/wiki/Version_control
History of Source Code Control Systems for Software
Generation Networking Operations Concurrency Examples
First None One file at a time Locks SCCS – 1972
RCS – 1980
Second Centralized
(Requires connection) Multi-file Merge
commit CVS – 1986, SourceSafe – 1994 ,
SVN – 2000 ,
Team Foundation Server – 2005
Third Distributed
(Local and remote repository support) Changesets Commit
merge Bazaar – 2005 ,
Git – 2005,
Mercurial – 2005
Source : http://ericsink.com/vcbe/html/history_of_version_control.html
Starting point in the System
Green marks the main line of development or Trunk
Branches are used to provide safe modification areas
Some branches may be unsuccessful
Original : https://en.wikipedia.org/wiki/Version_control#/media/File:Revision_controlled_project_visualization-2010-24-02.svg
A Merge occurs when a branch is put back into the Trunk
Git – Key Terminology
Git – is command line client software that supports access to both local and remote repositories.
GitHub – is a Web-based Git repository hosting service.
Repo – Acronym for a repository – A set of files that are grouped together as a project.
Git – Key Commands
Init – Creates a Git repo.
Add – adds in files
Commit – The act of adding source code changes to the repo.
Clone – clones a repo in a new directory – useful for starting a new branch from a remote repo.
Checkout – switches branches
Merge – merges changes back to the head
Programming Guideline
A document that describes best practices for a particular programming language or technology
Guides a programmer to produce a program that can easily be understood by others using the same language or technology
Many companies have internal programming guideline documents for their programmers
Some guidelines are standard to a language
Think of your Documentation Standards document from COMP 10062 – Programming in Java
Why is a Programming Guideline useful?
General Readability
Statement Order
example : location of declaration of variables
at top of a block, or when they are needed.
General programming rules
Positive vs. Negative logic, which looping construct is best suited to a particular task.
In-line, To support automated documentation
Minimized duplication
Code is refactored into Classes/Functions to maximize re-use!
Code Review
Peer Review
General informal review process, where the code is viewed by another programmer
Usually a more senior programmer will do this review.
Walkthrough
More systematic / detailed review of work
Typically done by a group
Will code meet required specification.
Did some aspect of the specification get missed or misunderstood?
Inspections
Fairly formal – review of application of standard / specific guidelines
Typically done on systems that impact human safety
Nuclear reactor, space shuttle
Code Review – What you are looking for?
Data Reference Errors
Is the correct variable being used?
Data Declaration Errors
Is the correct type being used?
In many cases the compiler (strongly typed) will assist in detecting problems with data type
This can be an issue in loose type programming languages (e.g. PHP / Javascript)
Code Review – What you are looking for?
Computation Errors – Is the calculation correct
Need to verify with another method
Hand, Calculator, A separate application.
Comparison
Are all conditions correct
Need to be careful when creating multiple condition expression and when using negative logic.
Control of Flow
Loop entry and exit
Are entry and exit conditions for flow control set correctly
Code Review – What you are looking for?
Parameter Errors
Are the parameters used within a function call correctly specified
Is there a verification of the values – range checking
Input / Output
Are the data input / outputs matched to the appropriate variables.
Code Reviews are useful for many reasons, but are not a replacement for Formalized Testing
Commenting
Types of Comments:
Overall Descriptive
Code Explanation
Documentation
Overall Comments
Description of what the module / component accomplishes or does from a high level
Typically at the top of a module
For example, in Java or C#, this would the class level comment
Code Explanation Comments
Details on “non-trivial” code that may be unclear to a junior level programmer within that environment.
Not intended to comment every line of code
Well-written code should be somewhat self-explanatory.
Sometimes it is important to document work-arounds, bug-fixes
Examples of Coding Standards
https://www.dofactory.com/csharp-coding-standards
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags
These two links above will be used for Assignment 3
https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
https://google.github.io/styleguide/javaguide.html
/docProps/thumbnail.jpeg
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com