Unit - Iii: Software Construction
Unit - Iii: Software Construction
Software Construction
Topics
• Software Construction
• Coding Standards
• Coding Framework
• Reviews
– Desk Checks (Peer Reviews)
– Walkthroughs
– Code Reviews, Inspections
• Coding Methods
– Structured Programming
– Object-Oriented Programming
– Automatic Code Generation
– Software Code Reuse
– Pair Programming
– Test-Driven Development
• Configuration Management
• Software Construction Artifacts
2
Software Construction
Introduction
• A layman believes that software construction is the entire software
development process.
• But, in fact, it is just one of the crucial tasks in software development; software
requirement management, software design, software testing and software
deployment are all equally crucial tasks.
• Furthermore, the process of software construction itself consists of many tasks;
it not only includes software coding but also unit testing, integration testing,
reviews and analysis.
• Construction is one of the most labor intensive phases in the software
development life cycle.
• It comprises 30% or more of the total effort in software development.
• What a user sees as the product at the end of the software development life
cycle is merely the result of the software code that was written during software
construction.
• Due to the labor intensive nature of the software construction phase, the work
is divided not only among developers, but also small teams are formed to work
on parts of the software build.
Software Construction
Introduction
• In fact, to shrink the construction time, many distributed teams,
either internal or through contractors are deployed.
• The advantage to this is that these project teams do the software
coding and other construction work in parallel with each other.
• This parallel development is known as concurrent engineering.
• Constructing an industry strength software product of a large size
requires stringent coding standards.
• The whole process of construction should follow a proven process
so that the produced code is maintainable, testable and reliable.
• The process itself should be efficient so that resource utilization
can be optimized and thus cost of construction can be kept at a
minimum.
Software Construction
Coding Standards
• Developers are given software design specifications in the form of use cases,
flow diagrams, UI mock ups, etc., and they are supposed to write a code so that
the built software matches these specifications.
• Converting the specifications into software code is totally dependent on the
construction team.
• How well they do it depends on their experience, skills and the process they
follow to do their job.
• Apart from these facilities, they also need some standards in their coding so that
the work is fast as well as has other benefits like maintainability, readability and
reusability (Figure-Source Code Production (Conversion) from Software Design).
Software Construction
Coding Standards
• At any time, a code written by a developer will always be different from that
written by any other developer.
• This poses a challenge in terms of comprehending the code while reusing the
code, maintaining it, or simply reviewing it.
• A uniform coding standard across all construction teams working on the same
project will make sure that these issues can be minimized if not eliminated
(Figure below - Software Construction Characteristics).
• Some of the coding standards include standards for code modularity, clarity,
simplicity, reliability, safety and maintainability.
Software Construction
Coding Standards – Modularity
• The produced software code should be modular in nature.
• Each major function should be contained inside a software code module.
• The module should contain not only structure, but it should also process data.
• Each time a particular functionality is needed in the software construction, it can
be implemented using that particular module of software code.
• This increases software code reuse and thus enhances productivity of
developers and code readability.
Reviews – Inspections
• Code inspections are final reviews of software code in which it is decided
whether to pass a piece of code for inclusion into the main software build.
Coding Methods
Software Construction
• Converting design into optimal software construction is a very serious topic
that has generated tremendous interest over the years.
• Many programming and coding methods were devised and evolved as a
result.
• As it is well known in the industry, the early software products were of small
size due to limited hardware capacity.
• With increasing hardware capacity, the size of software products has been
increasing.
• Software product size affects the methods that can be used to construct
specific sized software products.
• Advancement in the field of computer science also allows discovery of
better construction methods.
• To address needs of different sized software products in tandem with
advancement in computer science, different programming techniques
evolved.
• These include structured programming, object-oriented programming,
automatic code generation, test-driven development, pair programming,
etc.
Software Construction
Coding Methods – Structured Programming
• Structured programming evolved after mainframe computers
became popular.
• Mainframe computers offered vast availability of computing power
compared to primitive computers that existed before.
• Using structured programming, large programs could be
constructed that could be used for making large commercial and
business applications.
• Structured programming enabled programmers to store large
pieces of code inside procedures and functions.
• These pieces of code could be called by any other procedures or
functions.
• This enabled programmers to structure their code in an efficient
way.
• Code stored inside procedures could be reused anywhere in the
application by calling it.
• Why we use Structured Programming?
– We use structured programming because it allows the
programmer to understand the program easily.
– If a program consists of thousands of instructions and
an error occurs then it is complicated to find that error
in the whole program, but in structured programming,
we can easily detect the error and then go to that
location and correct it. This saves a lot of time.
Software Construction
Coding Methods – Object-Oriented Programming
• In structured programming, data and structured code are separate and
accordingly they are modeled separately.
• This is an unnatural way of converting real life objects into software code
because objects contain both data and structure.
• Widely used as an example in object-oriented programming books, a car
consists of a door, an engine, four wheels, body, and transmission.
• Each of these objects has some specific properties and specific functions.
• When a software system is modeled to represent real-world objects,
both data and structure are taken care of in object-oriented
programming.
• From outside of a class that is made to represent an object, only the
behavior of the object is visible or perceived.
• Unnecessary details about the object are hidden and in fact are not
available from outside.
• This kind of representation of objects makes them robust and a system
built on using them has relatively few problems.
Software Construction
Coding Methods – Automatic Code Generation
• Constructing and generating software code is very labor intensive work. So
there has always been fascination about automatic generation of software code.
• Unfortunately, this is still a dream. Some CASE and modeling tools are available
that generate software code. But they are not sophisticated. They are also not
complete.
• Then there are business analyst platforms developed by many ERP software
vendors that generate code automatically when analysts configure the product.
• These analyst platforms are first built using any of the software product
development methodologies.
• The generated code is specific to the platform and runs on the device (hardware
and software environment) for which the code is generated.
• Generally, any code consists of many construction unit types.
• Some of these code types include control statements such as loop statements, if
statements, etc., and database access, etc.
• Generating all of the software code required to build a software application is
still difficult.
• But some companies like Sun Microsystems are working to develop such a
system.
Software Construction
Coding Methods – Software Code Reuse
• Many techniques have evolved to reduce the labor intensive nature of writing
source code.
• Software code reuse is one such technique.
• Making a block of source code to create a functionality or general utility library
and using it at all places in the source code wherever this kind of functionality or
utility is required is an example of code reuse.
• Code reuse in procedural programming techniques is achieved by creating
special functions and utility libraries then using them in the source code.
• In object-oriented programming, code reuse is done at a more advanced level.
Software Construction
Coding Methods – Software Code Reuse
• The classes containing functions and data themselves can
not only be reused in the same way as functions and
libraries but the classes can also be modified by way of
creating child classes and using them in the source code
(Figure above – Code reuse methods).
• Apart from creating and using libraries and general
purpose classes for code reuse, a more potent code
reuse source has evolved recently.
• It is known as “service oriented architecture” (SOA).
Service Oriented Architecture
(SOA)
• Service-Oriented Architecture or SOA is a design pattern which is
designed to build distributed systems that deliver services to other
applications through the protocol. It is only a concept and not
limited to any programming language or platform.
• What is Service?
• A service is a well-defined, self-contained function that
represents a unit of functionality. A service can exchange
information from another service. It is not dependent on the
state of another service.
Service Oriented Architecture
(SOA)
• Service Connections
• The figure given below illustrates the service-oriented
architecture. Service consumer sends a service request to the
service provider, and the service provider sends the service
response to the service consumer. The service connection is
understandable to both the service consumer and service
provider.
Software Construction
Coding Methods – Pair Programming
• Pair programming is a quality driven development technique
employed in the eXtreme Programming development model.
• Here, each development task is assigned to two developers.
• While one developer writes the code, the other developer sits
behind him and guides him through the requirements (functional,
nonfunctional).
• When it is the turn of the other developer to write the code, the
first developer sits behind him and guides him on the
requirements.
• So developers take turns for the coding and coaching work.
• This makes sure that each developer understands the big picture
and helps them to write better code with lesser defects.
Software Construction
Coding Methods – Pair Programming
• Pair programming is a development technique in which two
programmers work together at single workstation. Person who
writes code is called a driver and a person who observes and
navigates each line of the code is called navigator. They may
switch their role frequently. Sometimes pair programming is also
know as pairing.
Software Construction
Coding Methods – Test-Driven Development
• This concept is used with iteration-based projects especially with
eXtreme Programming technique.
• Before developers start writing source code, they create test cases
and run the tests to see if they run properly and their logic is
working.
• Once it is proved that their logic is perfect, only then they write the
source code.
• So here, tests drive software development, and hence it is
appropriately named test-driven development.
• The following sequence of steps is generally followed:
– Add a test – Write a test case that describe the function
completely. In order to make the test cases the developer must
understand the features and requirements using user stories
and use cases.
– Run all the test cases and make sure that the new test case
fails.
– Write the code that passes the test case
– Run the test cases
– Refactor code – This is done to remove duplication of code.
– Repeat the above mentioned steps again and again
• Red – Create a test case and make it fail
• Green – Make the test case pass by any means.
• Refactor – Change the code to remove duplicate/redundancy.
Software Construction
Configuration Management
• Configuration management plays an important role in the construction phase.
• Due to changes in requirements and design, an already developed source code
needs to be changed.
• So it happens that the development team ends up with many versions of a
source code during the project.
• If the version control management is not handled properly, then many
developers may start working on a wrong version of source code, and thus a lot
of rework may be needed in the end.
• There is one more dimension to configuration management for the construction
phase.
• During construction, many software builds are maintained for different versions
of the product being developed.
• These builds can break if a bad piece of code is checked into the build by any
developer.
• When the build is broken, then no other developer can check in his code.
• Thus, development is halted until the build is rebuilt with the correct code.
Software Construction
Configuration Management
• Imagine what may happen in the case of distributed teams located at
far-flung locations with different time zones and a central build is being
maintained.
• It will be difficult to communicate and manage the build process in such
a scenario.
• In such scenarios, smoke test application can be deployed, which can run
whenever a new code is checked-in in the build.
• If the smoke test fails, that means the build has failed and thus the
automated system can e-mail the build information to concerned
people.
• If the build fails, then the developer who had checked-in in the code gets
the message and immediately tries to fix the build.
• Once the build is fixed, then other developers can check-in their code.
• Thus, configuration management plays an important role in construction
phase.
Software Construction
Software Construction Artifacts
• The software construction phase is one of the most labor
intensive phases in software development cycle.
• This phase generates the complete source code of the
application.
• Apart from source code, documentation is also made so
that when any maintenance is required on the built
application, the source code could be well understood,
and changing any source code will be easy.
• Review reports are also generated after reviews are
conducted.
Artifacts Definition
• An artifacts represents cohesive
information that typically developed &
reviewed as a single entity.
• To make the development of a complete
software system manageable, distinct
collection of information are organized
into artifacts sets
22 32
Management & Engineering set
• The Management artifacts (Management set)
capture the information necessary to synchronize
stakeholder expectations ( English text ) (it has
Planning Artifacts and Operational Artifacts)
• The Engineering artifacts (requirements, design,
implementation & deployment) are captured in
rigorous notations that support automated
analysis & browsing ( C++, Visual Basic, java,
standard document template, a standard
spreadsheet template, or a UML )
22 33
Requirements Design Set Implementation Deployment
Set Set Set
1.Vision document
2.Requirements 1.Design 1.Source code 1.Integrated
model(s) model(s) baselines product
2.Test model 2.Associated executable
3.Software compile-time files baselines
architecture 3.Component 2.Associated
description executable run-time files
3.User manual
Management Set
Planning Artifacts Operational Artifacts
1.Work breakdown structure 5.Release descriptions
2.Bussines case 6.Status assessments
3.Release specifications 7.Software change order database
4.Software development plan 8.Deployment documents
9.Enviorement
REFERENCES
• Ashfaque Ahmed, Software Project Management: A Process-driven approach,
Boca Raton, Fla: CRC Press, 2012.
THANK YOU