Professional Documents
Culture Documents
– Software design
– Software testing
Process of Construction
Design
Construction
Testing
5
Importance of Software Construction
7
Software Construction Tasks
• Verifying that the groundwork has been laid so that
construction can proceed successfully
• Determining how your code will be tested
• Designing and writing classes and routines
• Creating and naming variables and named constants
• Selecting control structures and organizing blocks of
statements
• Unit testing, integration testing, and debugging your own
code
Software Construction Tasks
• Reviewing – Design and Code
• Polishing code by carefully formatting and commenting
it
• Integrating software components that were created
separately
• Tuning code to make it faster and use fewer resources
Relevance of Software Construction
• Significant detailed design occurs during construction. Although some
detailed design may be performed prior to construction, much design
work is performed within the construction activity itself. Thus the
software construction activity is closely linked to the software design
activity.
• Low-level (e.g. unit and module integration) testing occurs during
construction
• Construction produces high volume of configuration items
– Thus construction linked to configuration management
• Construction is tool intensive
• Quality (or lack thereof) is very evident in the construction products
• Construction highly related to Computer Science due to
– Use of algorithms
– Detailed coding practices
10
Breakdown of topics for SW Construction
11
Breakdown topics for Software Construction Contd.
12
Software Construction Fundamentals
13
Minimizing Complexity
• Limited ability of people to hold complex structures and information in their
working memories.
• Minimizing complexity : Strongest drivers in Software construction
• Achieved by creating code that is simpler and readable.
• Avoid redundancy, ambiguity, lines of code (LOC)
• To make complex structure to simpler
• Implement modularity, GUI using templates
• Need to reduce complexity throughout the lifecycle
• Examples:
– J2EE for complex, distributed Java applications
– UML for modeling all aspects of complex systems
– High-order programming languages such as C++ and Java
– As functionality increases, so does complexity accomplished through use of
standards.
14
Minimizing Complexity
• Accomplished by :
1. Standards in Construction
2. Modular design
3. Coding Specific techniques
4. Construction Quality - Construction focused quality
techniques
15
Coding
• Use of classes, enumerated types, variables, named constants, and other similar
entities
18
Practice of Programming
There is more to writing a program than getting the syntax right, fixing the bugs,
and making it run fast enough.
1. Style:
1.1 Name: A name should be informative, concise, memorable, and pronounceable if possible
Use descriptive names for global, short names for locals.
Global --> int npending = 0; // current length of input queue
Ex:
X for (theElementIndex = 0; theElementIndex < number0fElements;
theElementIndex++)
elementArray[theElementIndex] = theElementIndex;
Naming conventions make it easier to understand your own code. as well as code written
by others.
20
Style - Name
Be Consistent
Related things related names that show the relationship and highlight the differences
Ex:
X class UserQueue {
int noOfItemsInQ, frontOfTheQueue, queuecapacity;
public int noOfUsersInQueue() {…}
3
• The word "queue" appears as Q. Queue and queue. But since queues can only be accessed from a variable of
type UserQueue, member names do not need to mention "queue" at all; context suffices, so
Queue.queueCapacity - Redundant
class UserQueue
{
int nitems, front,capacity;
public int nusers() {...}
3
queue.capacity++;
n=queue.nusers();
21
Style - Name
Use active names for functions.
Function names should be based on active verbs, perhaps followed by nouns:
now = date .getTime() ;
putchar('\nl) ;
Functions that return a boolean (true or false) value should be named so that the
return value is unambiguous. Thus
X if(checkoctal(c))
does not indicate which value is true and which is false, while
if (isoctal (c)) . . .
makes it clear that the function returns true if the argument is octal and false if not.
22
Style - Name
Be Accurate
23
Style – Expression & Statement
1.2 Expressions & Statements:
Indent to show structures
24
Style – Expression & Statement
25
Style – Expression & Statement
26
Style – Expression & Statement
*x+=(*xp=(2*k<(n-m)?c[k+1]:d[k--]));
27
Style – Expression &Statement
• Multiple Assignments
x str[i++]= str[i++]=‘ ‘;
str[i++]= ‘ ‘;
Str[i++]=‘ ‘;
28
Consistency & Idioms
if (month==FEB) {
X i f (month==FEB) {
if (year%4 == 0){
if (day > 29)
i f (year%4 == 0)
legal = FALSE;
if (day > 29)
}else{
legal = FALSE;
if (day > 28)
else
legal = FALSE;
if (day > 28)
}
legal = FALSE;
}
29
Consistency & Idioms
30
Consistency & Idioms
switch (c) {
case '-':
sign = -1;
/* fall through */
• switch (c) {
case '+' :
case '-': sign = -1;
c = getchar();
case '+': c = getchar();
break;
case '.': break;
case ' . ' :
default: if (!isdigit(c))
break;
return 0;
default :
}
if (!isdigit(c))
return 0;
break;
}
31
Style - Comments
/*
n default
*/
default:
break;
/*n return SUCCESS */
return SUCCESS;
zerocount++; /n Increment zero entry
counter */
/* Initialize "total" to "number-
received" */
node->total = node->number-recei ved ;
32
Style - Comments
33
Style - Comments
#ifdef DEBUG
Printf(“*** isword returns !result=%d\n”, ! Result);
Fflush (stdout);
#endif
Return (!result)
34
Style - Comments
35
Style - Comments
Improved Code
• time(&now);
strcpy(date,ctime(&now));
/*ctime() puts newline at end of string; delete it*/
date[strlen (date)-1]=‘\0’;
36
Style - Comments
Clarify don’t confuse
Int strcmp(char *s1, char *s2)
/* string comparison routine returns -1 if S1 is above S2 in an
ascending order list, 0 if equal 1 if S1 below S2*/
{
While (*S1==S2)
{
If(*S1==‘\0’) retrun (0);
S1++;
S2++;
}
If(*S1>*S2) return (1);
Return (-1);
} 37
Function Macros
• c=s+s/5;
• #define sr(s) s+s
main()
{
....
...
int c;
c=sr(10)/5;
}
38
Function Macros
39
Anticipating Change
• Most software will change over time, and the
anticipation of change drives many aspects of software
construction
• Changes in the environments in which software
operates also affect software in diverse ways.
• Anticipating change helps software engineers build
extensible software, which means they can enhance a
software product without disrupting the underlying
structure
Anticipating Change
Anticipation of change affect how software is constructed
This can effect:
Use of control structures
Handling of errors
Source code organization
Code documentation
Coding standards
Supported by
Coding -Specific techniques
41
Constructing for Verification
• Building a software in such a way that faults can figured
out readily by the programmers during independent
testing and operational testing
• Specific Techniques that support constructing for
verification include following
– coding standards to support code reviews and unit testing,
organizing code to support automated testing, and restricting
the use of complex or hard-to-understand language
structures
Reuse
• Reuse refers to using existing assets in solving different
problems.
• In software construction, typical assets that are reused
include libraries, modules, components, source code, and
commercial off-the-shelf (COTS) assets
• Reuse is best practiced systematically, according to a well-
defined, repeatable process.
• Systematic reuse can enable significant software
productivity, quality, and cost improvements.
Reuse
Reuse has two closely related facets
• Construction for reuse: Create reusable software
resource
45
Standards which directly affect construction issues include:
• Programming languages
– E.g. standards for languages like Java and C++
• Communication methods
– E.g. standards for document formats and contents
• Platforms
– E.g. programmer interface standards for operating system calls, J2EE
• Tools
– E.g. diagrammatic standards for notations like the Unified Modeling
Language
46
Managing Construction
47
Managing Construction
1. Construction Models
2. Construction Planning
3. Construction Measurement
48
1.Construction Models
Construction Models:
– Numerous Models:
– Emphasizes more on Construction than any other
– Linear / Waterfall and Staged delivery Models
» These models treat construction as an activity that occurs only after
significant prerequisite work has been completed
» Construction as a distinct activity
» Coding
– Iterative
» Evolutionary Prototyping Models and agile development
» Combination of activities
• Consequently, what is considered to be “construction” depends to some degree on the life
cycle model used.
• Software construction is mostly coding and debugging, but it also involves construction
planning, detailed design, unit testing, integration testing, and other activities.
49
Determine the kind of Software You are working on !!
• By research,
– Gathering requirements - 40 different methods
– Testing – 30 kinds
50
Development Styles
51
Development Styles
52
53
Development Styles
54
How Iterative differs form sequential
55
Solution
• One realistic approach is to plan to specify about 80 percent of the
requirements up front, allocate time for additional requirements to be
specified later, and then practice systematic change control to accept only
the most valuable new requirements as the project progresses.
56
Sequential Vs Iterative
Sequential Iterative
The requirements are fairly stable The requirements are not well
understood or you expect them to be
The design is straightforward and fairly unstable for other reasons
well understood The design is complex, challenging, or
The development team is familiar with both
the applications area The development team is unfamiliar
with the applications area
The project contains little risk The project contains a lot of risk
Long-term predictability is important Long-term predictability is not
The cost of changing requirements, important
design, and code downstream is likely to The cost of changing requirements,
be high design, and code downstream is likely
to be low
57
Other ways..,
Encouraging Good Coding
Software projects operate as much on an “expertise hierarchy” as on
an “authority hierarchy.”
Considerations in Setting Standards
Reduce arbitrary variance in the project.
Few alternatives: flexible guidelines, a collection of suggestions rather than
guidelines, or a set of examples.
Several techniques for achieving good coding practices
Assign two people to every part of the project-at least two people think
it works and is readable
Review every line of code
Require code sign-offs
Route good code examples for review
Emphasize that code listings are public assets
Reward good code
One easy Standard 58
2. Construction Planning
• Choice of construction method – Key aspect
• Construction method affects
– the extent to which construction prerequisites are
performed.
– the order in which they are performed.
– the degree to which they are expected to be completed
before construction work begins
2. Construction Planning
Construction planning also defines :
• the order in which components are created and
integrated, the integration strategy (phased or
incremental integration)
• the software quality management processes.
• the allocation of task assignments to specific software
engineers
• the other tasks according to the chosen method
2. Construction Planning
• What is Construction Planning?
Laying out the work plan (i.e. schedule) to design, implement,
debug, and unit test the software
• Construction planning major concerns:
– Coders are typically not planners
– Schedules will be difficult to maintain unless a good
architecture design is in place
– Many organizations to not collect project data on which to
plan future projects
Many managers consider planning to be a waste of time and therefore don’t
encourage it
62
Improving Software Economics
• Improvements in the area of software development have been difficult to
achieve and also difficult to measure and substantiate.
• Five basic areas on which to focus are listed here, in order of priority:
(Consider reducing development costs by planning to:)
– Reduce the size and/or complexity
– Improve the development process
– Use more highly skilled people and build better teams
– Use better tools
– Reduce quality thresholds
63
Some actions include
Size/complexity Tools
• Use an object oriented approach • Use integrated tools
• Focus on reuse • Use open (as opposed to propriety) systems
• Look for opportunities to use commercial off- • Use appropriately sized hardware
the-shelf (COTS) components • Automate tedious tasks such as
coding (where possible)
Process
documentation
• Use an iterative approach testing
• Improve the process maturity metrics collection & analysis
• Focus on architecture early in the life cycle Quality
People/teams • Ensure appropriate hardware platform
performance
• Provide appropriate training
• Use a demonstration-based assessment
• Encourage teamwork approach
• Create a win-win culture • Use statistical quality control
64
Construction Prerequisites
• As with building construction, much of the success or failure of
the project already determined before construction begins
• Upstream activities such as project planning, requirements,
architecture, and design are crucial to success
• Typical high-risk areas
– Project planning
– Requirements
– Architecture
• Preparation is a way to reduce these risks
65
Construction Prerequisites cntd….
• Best practice for building high-quality software emphasizes quality throughout the software
development lifecycle. Since construction is in the middle of a software project, by the time
you get to construction, the earlier parts of the project have already laid some of the
groundwork for success or failure. During construction, however, you should at least be able
to determine how good your situation is and to back up if you see problems.
• The overall goal of preparation is risk reduction – a good project planner identifies and
resolves major risks as early as possible so that the bulk of the project can proceed as
smoothly as possible.
• Be far, the most common project risks in software development are poor requirements, poor
architecture, and poor project planning. As such, it is crucial that construction preparation
include an assessment of these areas.
66
Problem Definition Prerequisite
• The problem being solved via the application must be well defined
– Product Vision
– Vision Statement
– Product Definition
67
• The first prerequisite before beginning construction is a
clear statement of the problem that the system is supposed
to solve. This is sometimes called “product vision,” “vision
statement,” or, as used here, “product definition.”
• A problem definition defines what the problem is without
any reference to possible solutions.
• The problem definition should be in user language, and the
problem should be described from a user's point of view. It
usually should not be stated in technical computer terms.
• Without a good problem definition, you might put effort
into solving the wrong problem.
68
• The Rational Unified Process names the product definition the “Vision” and provides
• The Vision defines the stakeholders view of the product to be developed, specified in
terms of the stakeholders key needs and features. Containing an outline of the
envisioned core requirements, it provides the contractual basis for the more detailed
technical requirements.
• The Vision captures the "essence" of the envisaged solution in the form of high-
level requirements and design constraints that give the reader an overview of the
communicates the fundamental "why and what" for the project and is a gauge
• Explicit requirements:
70
• Requirements describe in detail what a software system is supposed to do, and they
are the fist step toward a solution.
• The requirements activity is also known as “requirements development,”
“requirements analysis,” “analysis,” “requirements definition,” “software
requirements specification,” and “functional specification”
• Explicit requirements help ensure that the user, rather than the programmer, drives
the system’s functionality.
• Explicit requirements help to avoid arguments
• Attention to requirements helps minimize changes to a system after development
begins.
• Specifying requirements adequately is a key to project success
71
Architecture Prerequisite
• Quality of the architecture determines the conceptual integrity of the system
• A proper architecture:
– Partitions work
• Architecture-level problems are much more costly to fix than are coding errors
• Software architecture is the high-level part of software design, the frame that
holds the more detailed parts of the design
72
• Architecture is also known as “system architecture,” and “top-level
design.”
75
• If requirements are unstable and you're working on a large, formal project,
you'll probably have to work with a requirements analyst to resolve
requirements problems that are identified early in construction. Allow time to
consult with the requirements analyst and for the requirements analyst to
revise the requirements before you'll have a workable version of the
requirements.
76
Choose an Approach
• Many software development approaches have been tried over the years
• Some examples (not mutually exclusive):
– Functional
– Object-Oriented
– Iterative
– Waterfall
– Agile
– Data-centric
• The construction team must follow some approach
• Chosen approach must be appropriate for the task at hand
78
Choose a Programming Language
• Programming language choices affect
– Productivity
– Code quality
• Programmers more productive using a familiar language
• High-level languages provided higher quality and better productivity
• Some languages better at expressing programming concepts than
others
• The ways in which a programmers express themselves are affected by
the chosen language
79
Choose Construction Practices
• Questions to answer regarding practices:
– How detailed will the design be?
– What are the coding conventions for names, comments, layout,
etc.?
– How will the architecture be enforced?
– Is the project’s use of technology ahead of or behind the power
curve, and is this appropriate given the circumstances?
– What is the integration procedure, how often is it done, and who
participates?
– Will developers program individually, in pairs, or some
combination of this?
– Where and when will builds occur?
80
Choose Tools
Modern programming tools
– Are essential to maintain programmer productivity
– Reduce tedious and redundant tasks
– Must be appropriate for the task at hand
Tools preparation checklist:
• Are all product licenses current?
• Are all products at current, supported revision level?
• Have all programmers received proper training on the
tools?
• Does the project have a configuration management tool?
• Does the project have a tool to track change requests?
• Do project team members have sufficient workstations?
• Does the project have sufficient test environments?
• Does the project have sufficient build environments?
81
Construct the Team
• For small development efforts
Medium sized projects
– Self managed
– Everyone is a peer Role # / Team*
Lead 1
• For mid-size development efforts Detailed designer 1 to 4
– Multiple teams
System tester 1
“Buildmeister” 1
Configuration manager 1
* Individuals will play multiple roles
82
3.Construction Measurement
• Purpose of Measurement:
• Managing Construction
83
Construction Measurement
84
Uses of Measurement
85
Measures, Metrics and Indicators
• Measure – An appraisal or ascertainment by comparing to a standard. E.g.
Joe’s body temperature is 99° fahrenheit
• Metric – A quantitative measure of the degree to which an element (e.g.
software system) given attribute.
– E.g. 2 errors were discovered by customers in 18 months (more
meaningful than saying that 2 errors were found)
• Indicator – A device, variable or metric can indicate whether a particular
state or goal has been achieved. Usually used to draw someone’s attention
to something.
– E.g. A half-mast flag indicates that someone has died
86
Reliability and Validity of Measurements
• Reliability – Refers to the consistency of a number of measurements taken
using the same measurement method
• Validity – Refers to whether the measurement or metric really measures
what we intend it to measure.
87
Measuring Software
88
What makes quality software?
• Cheap?
• Reliable?
• Testable?
• Secure?
• Maintainable?
89
What makes quality software?
90
Different Quality Scenarios
91
The 3 Ps of Software Measurement
92
Measuring the Product
93
Measuring the Process
94
Measuring the People
95
The Measuring Process
Measurement
Programme
Non-intrusive
Modifications
Data Collection
Products
Results, Trends,
Reports, etc
Processes
People 96
Collecting Software Engineering Data
• Challenge: Make sure that collected data can provide useful information
for project, process and quality management without being a burden on
the development team.
• Try to be as unintrusive as possible
• Try to make data collection automatic
• Can expensive
– Sometimes difficult to convince management
97
Collecting Software Engineering Data
A possible collection methodology:
1. Establish the goal of data collection
2. Develop a list of questions of interest
3. Establish data categories
4. Design and test data collection forms/programs
5. Collect and validate data
6. Analyse data
98
Examples of Metrics Programmes
Motorola
• 7 Goals
– Improve Project Planning
– Increase defect containment
– Increase software reliability
– Decrease defect density
– Improve customer service
– Reduce the cost of non-conformance
– Increase software productivity
• Various Measurement Areas
– Delivered defects, process effectiveness, software reliability, adherence to
schedule, time that problems remain open, and more…
99
Useful Measurements
100
Contd..,
Productivity Maintainability
• Work-hours spent on the project • Number of public routines on each class
• Work-hours spent on each class or routine • Number of parameters passed to each routine
• Number of times each class or routine changed • Number of private routines and/or variables on each
class
• Dollars spent on project
• Number of local variables used by each routine
• Dollars spent per line of code
• Number of routines called by each class or routine
• Dollars spent per defect
• Number of decision points in each routine
• Overall Quality
• Control-flow complexity in each routine
• Total number of defects
• Lines of code in each class or routine
• Number of defects in each class or routine
• Lines of comments in each class or routine
• Average defects per thousand lines of code
• Number of data declarations in each class or routine
• Mean time between failures Compiler-detected errors
• Number of blank lines in each class or routine
• Number of gotos in each class or routine
• Number of input or output statements in each class or
routine
101