Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
software engineering Module 4

software engineering Module 4

Ratings: (0)|Views: 20 |Likes:
Published by amant

More info:

Published by: amant on Oct 09, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

12/21/2012

pdf

text

original

 
Module 4Coding
The goal of the coding or programming phase is to translate the design of the system produced duringthe design phase into code in a given programming language, which can be executed by a computer and that performs the computation specified by the design. For a given design, the aim is to implement the design inthe best possible manner. The coding phase affects testing and maintenance. During implementation, it should be kept in mind that the programs should not be constructed so that they are easy to write, but so that they areeast to read and understand.” Quick Fixes” to modify a given code easily, result in a code that is more difficultto understand. Ease of understanding and modification should be the basic goals of the programmingactivity .Simplicity and clarity is desirable.
 Programming Practice:
The primary goal of the coding phase is to translate the given design into source code, so that the codeis simple, easy to test and easy to understand and modify.Good programming is a skill that can only be acquired by practice. Much can be learned from theexperience of others, and some general rules and guidelines can be laid for the programmer. Good programming is a practice independent of the target programming language. Some concepts related to codingis discussed.1. )
Top Down and Bottom Up
Given the hierarchy of modules produced by design, in what order should the modules be built staringfrom top level or starting from bottom level.In top down implementation, the implementation starts from top of the hierarchy and proceeds to the lower levels. First the main module is implemented, then its subordinates are implemented, and their subordinatesand so on.In a bottom-up implementation, the process is the reverse. The development starts with implementing themodules at the bottom of the hierarchy and proceeds through the higher levels until it reaches the top. Top-down and bottom-up shouldn’t be confused with top-down design. Here the design is being implemented, andif the design is fairly detailed and complete, its implementation can proceed in either top-down manner. Whichof the two is used mostly affects testing.The main reason is that we want to incrementally build the system that is, we want to build the systemin parts, even though the design of the entire system has been done all large systems must be built and testedseparately, the issue of top-down versus bottom-up arises. The real issue in which order modules are coded1
 
comes in testing. If all the modules are to be developed and then put together to form system for testing purposes, it is immaterial which modules is coded first. When modules have to be tested separately, top-downand bottom-up lead to top-down and bottom-up approaches to testing. These two approaches have differentconsequences .When we proceed top-down testing a set of modules, at the top of the hierarchy, stubs will haveto be written for the lower level modules that the set of modules under testing invoke. In Bottom-up, allmodules in the lower hierarchy have been developed and driver modules are needed to invoke these modulesunder testing.When the design is not detailed enough, some of the design decisions have to be made duringdevelopment. For example, building prototype is a top-down development.In layered architecture, layer provides some service to layers above, which use these services toimplement the services it provides. It is generally best for the implementation to proceed in a bottom-upmanner.In practice, in large systems, a combination of the two approaches is used during coding. The opmodules of the system generally contain the overall view of the system and may even contain the user interfaces .On the other hand , the bottom up level modules are working correctly before they are used byother modules.2.)
Structured Programming 
The basic objective of the coding activity is to produce programs that are easy to understand .it has been argued that structured programming helps develop programs that are easier to understand. Structured programming is often considered as gotoless programming.A program has a static structure as well as a dynamic structure. The static structure refers to thestructure of the text of the program, which is usually just a linear organization of statements of the program.The dynamic structure is the sequence of statements executed during the execution of the program.The correctness of the program means that, when the program executes, it produces desired behavior .Much of the activity of the program understanding is to understand the dynamic behavior of the program from text of the program. It will clearly be easier to understand dynamic behavior if structure indynamic behavior resembles the static structure .The closer the correspondence between the execution and textstructure, the easier the program is to understand.The goal of Structured programming is to ensure that the static structures and the dynamic structuresare the same. Develop programs whose control flows during the execution is linearized and follows the linear organization of the program text.2
 
 No meaningful program can be written as a sequence of simple statements without any branching or repetition .So how is linearizing achieved?-By using structured constructs-We use structured statements in Structured Programming.“A structured statement has a single entry and single exit i.e. the execution starts from one defined point andends at on defined point.Thus a program has a sequence of structured statements. Thus sequence of execution of these statements will be same as sequence in program text.Most commonly used statements:
Selection:
if B then S1 else S2If B then S1
 Iteration:
while B do SRepeat S until B
Sequencing:
S1; S2; S3;Structured Programming helps write programs clearly. It helps in the formal verification of the programs.In a linearized control flow, if we understand the behavior of each of the basic constructs properly , the behavior of the program can be considered as a completion of the behavior of different statements.Although efforts should be made to avoid such statements that violate single entry and single exit , if the use of such statements is simplest , then the point of readability such constructs are used.3. )
 Information Hiding 
A software solution to problem always contains data structures that are meant to represent informationto problem domain. With the problem information represented internally as data structures, the requiredfunctionality of the problem domain, which in terms of information in domain, can be implemented assoftware operations on data structure.Any information in the problem domain typically has a small number of defined operations performedon it.When the information is represented internally as data structures, the same principle should beapplied, and only some defined operations should be performed on data structure. This is the principle of information hiding. The information captured in the data structures should be hidden from the rest of thesystem, and only access functions on the data structures that represent the operations performed on theinformation should be visible. For each operation on the information an access function should be provided.The rest of the modules should only use these access functions to access and manipulate the data structures.3

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->