Transcription

1 Module 1 Introduction to Software Engineering

2 Lesson 2 Structured Programming

3 Specific Instructional Objectives At the end of this lesson the student will be able to: Identify the important features of a structured program. Identify the important advantages of structured programming over unstructured ones. Explain how software design techniques have evolved over the last 50 years. Differentiate between exploratory style and modern style of software development. Important features of a structured program. A structured program uses three types of program constructs i.e. selection, sequence and iteration. Structured programs avoid unstructured control flows by restricting the use of GOTO statements. A structured program consists of a well partitioned set of modules. Structured programming uses single entry, single-exit program constructs such as if-then-else, do-while, etc. Thus, the structured programming principle emphasizes designing neat control structures for programs. Important advantages of structured programming. Structured programs are easier to read and understand. Structured programs are easier to maintain. They require less effort and time for development. They are amenable to easier debugging and usually fewer errors are made in the course of writing such programs. Evolution of software design techniques over the last 50 years. During the 1950s, most programs were being written in assembly language. These programs were limited to about a few hundreds of lines of assembly code, i.e. were very small in size. Every programmer developed programs in his own individual style - based on his intuition. This type of programming was called Exploratory Programming. The next significant development which occurred during early 1960s in the area computer programming was the high-level language programming. Use of high-level language programming reduced development efforts and development time significantly. Languages like FORTRAN, ALGOL, and COBOL were introduced at that time.

4 As the size and complexity of programs kept on increasing, the exploratory programming style proved to be insufficient. Programmers found it increasingly difficult not only to write cost-effective and correct programs, but also to understand and maintain programs written by others. To cope with this problem, experienced programmers advised other programmers to pay particular attention to the design of the program s control flow structure (in late 1960s). In the late 1960s, it was found that the "GOTO" statement was the main culprit which makes control structure of a program complicated and messy. At that time most of the programmers used assembly languages extensively. They considered use of "GOTO" statements in high-level languages were very natural because of their familiarity with JUMP statements which are very frequently used in assembly language programming. So they did not really accept that they can write programs without using GOTO statements, and considered the frequent use of GOTO statements inevitable. At this time, Dijkstra [1968] published his (now famous) article GOTO Statements Considered Harmful. Expectedly, many programmers were enraged to read this article. They published several counter articles highlighting the advantages and inevitably of GOTO statements. But, soon it was conclusively proved that only three programming constructs sequence, selection, and iteration were sufficient to express any programming logic. This formed the basis of the structured programming methodology. After structured programming, the next important development was data structure-oriented design. Programmers argued that for writing a good program, it is important to pay more attention to the design of data structure, of the program rather than to the design of its control structure. Data structureoriented design techniques actually help to derive program structure from the data structure of the program. Example of a very popular data structure-oriented design technique is Jackson's Structured Programming (JSP) methodology, developed by Michael Jackson in the1970s. Next significant development in the late 1970s was the development of data flow-oriented design technique. Experienced programmers stated that to have a good program structure, one has to study how the data flows from input to the output of the program. Every program reads data and then processes that data to produce some output. Once the data flow structure is identified, then from there one can derive the program structure. Object-oriented design (1980s) is the latest and very widely used technique. It has an intuitively appealing design approach in which natural objects (such as employees, pay-roll register, etc.) occurring in a problem are first identified. Relationships among objects (such as composition, reference and inheritance) are determined. Each object essentially acts as a data hiding entity.

5 Exploratory style vs. modern style of software development. An important difference is that the exploratory software development style is based on error correction while the software engineering principles are primarily based on error prevention. Inherent in the software engineering principles is the realization that it is much more cost-effective to prevent errors from occurring than to correct them as and when they are detected. Even when errors occur, software engineering principles emphasize detection of errors as close to the point where the errors are committed as possible. In the exploratory style, errors are detected only during the final product testing. In contrast, the modern practice of software development is to develop the software through several well-defined stages such as requirements specification, design, coding, testing, etc., and attempts are made to detect and fix as many errors as possible in the same phase in which they occur. In the exploratory style, coding was considered synonymous with software development. For instance, exploratory programming style believed in developing a working system as quickly as possible and then successively modifying it until it performed satisfactorily. In the modern software development style, coding is regarded as only a small part of the overall software development activities. There are several development activities such as design and testing which typically require much more effort than coding. A lot of attention is being paid to requirements specification. Significant effort is now being devoted to develop a clear specification of the problem before any development activity is started. Now there is a distinct design phase where standard design techniques are employed. Periodic reviews are being carried out during all stages of the development process. The main objective of carrying out reviews is phase containment of errors, i.e. detect and correct errors as soon as possible. Defects are usually not detected as soon as they occur, rather they are noticed much later in the life cycle. Once a defect is detected, we have to go back to the phase where it was introduced and rework those phases - possibly change the design or change the code and so on. Today, software testing has become very systematic and standard testing techniques are available. Testing activity has also become all encompassing in the sense that test cases are being developed right from the requirements specification stage.

6 There is better visibility of design and code. By visibility we mean production of good quality, consistent and standard documents during every phase. In the past, very little attention was paid to producing good quality and consistent documents. In the exploratory style, the design and test activities, even if carried out (in whatever way), were not documented satisfactorily. Today, consciously good quality documents are being developed during product development. This has made fault diagnosis and maintenance smoother. Now, projects are first thoroughly planned. Project planning normally includes preparation of various types of estimates, resource scheduling, and development of project tracking plans. Several techniques and tools for tasks such as configuration management, cost estimation, scheduling, etc. are used for effective software project management. Several metrics are being used to help in software project management and software quality assurance. The following questions have been designed to test the objectives identified for this module: 1. Identify the problem one would face, if he tries to develop a large software product without using software engineering principles. Ans.: - Without using software engineering principles it would be difficult to develop large programs. In industry it is usually needed to develop large programs to accommodate multiple functions at various levels. The problem is that the complexity and the difficulty levels of the programs increase exponentially with their sizes as shown in fig Fig. 1.3: Increase in development time and effort with problem size

7 For example, a program of size 1,000 lines of code has some complexity. But a program with 10,000 LOC is not 10 times more difficult to develop, but may be 100 times more difficult unless software engineering principles are used. Software engineering helps to reduce the programming complexity. 2. Identify the two important techniques that software engineering uses to tackle the problem of exponential growth of problem complexity with its size. Ans.: - Software engineering principles use two important techniques to reduce problem complexity: abstraction and decomposition. 3 rd abstraction 2 nd abstraction 1 st abstraction Full Problem Fig. 1.4: A hierarchy of abstraction The principle of abstraction (in fig.1.4) implies that a problem can be simplified by omitting irrelevant details. Once simpler problem is solved then the omitted details can be taken into consideration to solve the next lower level abstraction. In this technique any random decomposition of a problem into smaller parts will not help. The problem has to be decomposed such that each component of the decomposed problem can be solved in solution and then the solution of the different components can be combined to get the full solution.

8 Fig. 1.5: Decomposition of a large problem into a set of smaller problems. In other words, a good decomposition as shown in fig.1.5 should minimize interactions among various components. 3. State five symptoms of the present software crisis. Ans.: - Software engineering appears to be among the few options available to tackle the present software crisis. To explain the present software crisis in simple words, it is considered the following that are being faced. The expenses that organizations all around the world are incurring on software purchases compared to those on hardware purchases have been showing a worrying trend over the years (as shown in fig.1.6). Fig. 1.6: Change in the relative cost of hardware and software over time

9 Organizations are spending larger and larger portions of their budget on software. Not only are the software products turning out to be more expensive than hardware, but they also present a host of other problems to the customers: software products are difficult to alter, debug, and enhance; use resources non-optimally; often fail to meet the user requirements; are far from being reliable; frequently crash; and are often delivered late. Among these, the trend of increasing software costs is probably the most important symptom of the present software crisis. 4. State four factors that have contributed to the making of the present software crisis. Ans.: - There are many factors that have contributed to the making of the present software crisis. Those factors are larger problem sizes, lack of adequate training in software engineering, increasing skill shortage, and low productivity improvements. 5. Suggest at least two possible solutions to the present software crisis. Ans.: - It is believed that the only satisfactory solution to the present software crisis can possibly come from a spread of software engineering practices among the engineers, coupled with further advancements in the software engineering discipline itself. 6. Identify at least four basic characteristics that differentiate a simple program from a software product. Ans.: - Programs are developed by individuals for their personal use. They are therefore, small in size and have limited functionality but software products are extremely large. In case of a program, the programmer himself is the sole user but on the other hand, in case of a software product, a large number of users who are not involved with the development are attached. In case of a program, a single developer is involved but in case of a software product, a large number of developers are involved. For a program, user interface may not be so important because programmer is the sole user. On the other hand, for a software product, user interface must be very important because developers of that product and users of that product are totally different. In case of a program, very little documentation is expected but a software product must be well documented. A program can be developed according to the programmer s individual style of development but a software product must be developed using software engineering principles. 7. Identify two important features of that a program must satisfy to be called as a structured program.

10 Ans.: - First, a structured program uses three type of program constructs i.e. selection, sequence and iteration. Structured programs avoid unstructured control flows by restricting the use of GOTO statements. Secondly, structured program consists of a well partitioned set of modules. Structured programming uses single entry, single-exit program constructs such as if-then-else, do-while, etc. Thus, the structured programming principle emphasizes designing neat control structures for programs. 8. State three important advantages of structured programming. Ans.: - Structured programs are easier to read and understand. Structured programs are easier to maintain. They require less effort and time for development. They are amenable to easier debugging and usually fewer errors are made in the course of writing such programs. 9. Explain exploratory program development style. Ans.: - The exploratory software development style is based on error correction while the software engineering principles are primarily based on error prevention. Inherent in the software engineering principles is the realization that it is much more cost-effective to prevent errors from occurring than to correct them as and when they are detected. Even when errors occur, software engineering principles emphasize detection of errors as close to the point where the errors are committed as possible. In the exploratory style, errors are detected only during the final product testing. In the exploratory style, coding was considered synonymous with software development. For instance, the naïve way of developing a software product (which is called the exploratory programming style) believed in developing a working system as quickly as possible and then successively modifying it until it performed satisfactorily. 10. Show at least three important drawbacks of the exploratory programming style. Ans.: - As the size and complexity of programs kept on increasing, the exploratory programming style proved to be insufficient. The exploratory programming style proved to be insufficient because -

11 People wanted more sophisticated things to be done by software and as a result the size and complexity of programs increased. Exploratory style proved to be insufficient for developing large and complex programs. Programmers found that it was very difficult to write cost effective and correct programs using the exploratory style. Programmers also found that it was very difficult to understand and maintain the programs which were written by others. 11. Identify at least two advantages of using high-level languages over assembly languages. Ans.: - Assembly language programs are limited to about a few hundreds of lines of assembly code, i.e. are very small in size. Every programmer develops programs in his own individual style - based on intuition. This type of programming is called Exploratory Programming. But use of high-level programming language reduces development efforts and development time significantly. Languages like FORTRAN, ALGOL, and COBOL are the examples of high-level programming languages. 12. State at least two basic differences between control flow-oriented and data flow-oriented design techniques. Ans.: - Control flow-oriented design deals with carefully designing the program s control structure. A program's control structure refers to the sequence, in which the program's instructions are executed, i.e. the control flow of the program. But data flow-oriented design technique identifies: Different processing stations (functions) in a system The data items that flows between processing stations 13. State at least five advantages of object-oriented design techniques. Ans.: - Object-oriented techniques have gained wide acceptance because of it s: Simplicity (due to abstraction) Code and design reuse Improved productivity Better understandability

12 Better problem decomposition Easy maintenance 14. State at least three differences between the exploratory style and modern styles of software development. Ans.: - An important difference is that the exploratory software development style is based on error correction while the software engineering principles are primarily based on error prevention. Inherent in the software engineering principles is the realization that it is much more cost-effective to prevent errors from occurring than to correct them as and when they are detected. Even when errors occur, software engineering principles emphasize detection of errors as close to the point where the errors are committed as possible. In the exploratory style, errors are detected only during the final product testing. In contrast, the modern practice of software development is to develop the software through several well-defined stages such as requirements specification, design, coding, testing, etc., and attempts are made to detect and fix as many errors as possible in the same phase in which they occur. In the exploratory style, coding was considered synonymous with software development. For instance, the naïve way of developing a software product (which is called the exploratory programming style) believed in developing a working system as quickly as possible and then successively modifying it until it performed satisfactorily. In the modern software development style, coding is regarded as only a small part of the overall software development activities. There are several development activities such as design and testing which typically require much more effort than coding. A lot of attention is being paid to requirements specification. Significant effort is devoted to develop a clear specification of the problem before any development activity is started. Now there is a distinct design phase where standard design techniques are employed. Periodic reviews are being carried out during all stages of the development process. The main objective of carrying out reviews is phase containment of errors, i.e. detect and correct errors as soon as possible. Defects are usually not detected immediately after when they occur, rather they are noticed much later in the life cycle. Once a defect is detected we have to go back to the phase where it was introduced and rework those phases - possibly change the design or change the code and so on. Today, software testing has become very systematic and standard testing techniques are available. Testing activity has also become all encompassing in

13 the sense that test cases are being developed right from the requirements specification stage. There is better visibility of design and code. By visibility we mean production of good quality, consistent and standard documents during every phase. In the past, very little attention was paid to producing good quality and consistent documents. In the exploratory style, the design and test activities, even if carried out (in whatever way), were not documented satisfactorily. Today, consciously good quality documents are being developed during product development. This has made fault diagnosis and maintenance far more smoother. Now, projects are first thoroughly planned. Project planning normally includes preparation of various types of estimates, resource scheduling, and development of project tracking plans. Several techniques and tools for tasks such as configuration management, cost estimation, scheduling, etc. are used for effective software project management. Several metrics are used to help in software project management and software quality assurance. Mark the following as either True or False. Justify your answer. 1. All software engineering principles are backed by either scientific basis or theoretical proof. Ans.: - False. Explanation: - Many software engineering principles are just thumb rules and lack any scientific basis or theoretical proof. 2. There are well defined steps through which a problem is solved using an exploratory style. Ans.: - False. Explanation: - The exploratory software development style is based on error correction while the software engineering principles are primarily based on error prevention. Inherent in the software engineering principles is the realization that it is much more cost-effective to prevent errors from occurring than to correct them as and when they are detected. Even when errors occur, software engineering principles emphasize detection of errors as close to the point where the errors are committed as possible. In

14 the exploratory style, errors are detected only during the final product testing. For the following, mark all options which are true. 1. Which of the following problems can be considered to be contributing to the present software crisis? large problem size lack of rapid progress of software engineering lack of intelligent engineers shortage of skilled manpower 2. Which of the following are essential program constructs (i.e. it would not be possible to develop programs for any given problem without using the construct)? sequence selection jump iteration

3 SOFTWARE AND PROGRAMMING LANGUAGES 3.1 INTRODUCTION In the previous lesson we discussed about the different parts and configurations of computer. It has been mentioned that programs or instructions have

Software Processes Objectives To introduce software process models To describe three generic process models and when they may be used To describe outline process models for requirements engineering, software

Module 2 Software Life Cycle Model Lesson 4 Prototyping and Spiral Life Cycle Models Specific Instructional Objectives At the end of this lesson the student will be able to: Explain what a prototype is.

Software Processes Objectives To introduce software process models To describe three generic process models and when they may be used To describe outline process models for requirements engineering, software

Software Engineering So#ware Processes 1 The software process A structured set of activities required to develop a software system. Many different software processes but all involve: Specification defining

PART A Questions 1. Mention any two software process models. 2. Define risk management. 3. What is a module? 4. What do you mean by requirement process? 5. Define integration testing. 6. State the main

Module 10 Coding and Testing Lesson 23 Code Review Specific Instructional Objectives At the end of this lesson the student would be able to: Identify the necessity of coding standards. Differentiate between

Software Engineering Introduction & Background Department of Computer Science Kent State University Complaints Software production is often done by amateurs Software development is done by tinkering or

1.1 McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Objectives: To describe the evolution of programming languages from machine language to high-level languages. To understand how a program in a high-level

Fourth generation techniques (4GT) The term fourth generation techniques (4GT) encompasses a broad array of software tools that have one thing in common. Each enables the software engineer to specify some

CHAPTER 2 PROBLEM SOLVING This chapter will cover the following topics: Problem Solving Concepts for the Computer Pre-Programming Phase Programming Or Implementation Phase What Problem Can Be Solved By

Objectives Differentiate between machine and and assembly languages Describe Describe various various ways ways to to develop develop Web Web pages pages including including HTML, HTML, scripting scripting

Algorithms, Flowcharts & Program Design ComPro Definition Algorithm: o sequence of steps to be performed in order to solve a problem by the computer. Flowchart: o graphical or symbolic representation of

Software Life Cycle Lecture Objectives What happens in the life of software To look at the life cycle of a software To understand the software process and its related elements To relate to the different

What is a system? Software Engineering Software Processes A purposeful collection of inter-related components working together to achieve some common objective. A system may include software, mechanical,

Service Oriented Architecture for Law Firms: SOA is inevitable, are you ready? David Pilling Director of Applications and Development "Things should be made as simple as possible, but no simpler. -- Albert

Increase Software Development Productivity: Equations for Efficiency By Adam Kolawa, Parasoft Co-Founder and CEO Why Productivity Matters In today s economy, software development is a great expense for

1. What is PRINCE2? Projects In a Controlled Environment Structured project management method Generic based on proven principles Isolates the management from the specialist 2 1.1. What is a Project? Change

Module 12 Software Project Monitoring and Control Lesson 30 Organization and Team Structures Specific Instructional Objectives At the end of this lesson the student would be able to: I Explain the necessity

Instructional Design Framework Stage 1 Stage 2 Stage 3 If the desired end result is for learners to then you need evidence of the learners ability to then the learning events need to. Stage 1 Desired Results

Key benefit of object-oriented programming is that the software is more understandable better organized and easier to maintain, modify and debug Significant because perhaps as much as 80 percent of software

THE BCS PROFESSIONAL EXAMINATIONS Diploma April 2006 EXAMINERS REPORT Software Engineering 1 General Comments Most of the scripts produced by candidates this year were well structured and readable, showing

www.capspace.org (01/17/2015) Software Engineering Transfer Degree This program of study is designed for associate-degree students intending to transfer into baccalaureate programs awarding software engineering

Software Engineering Introduction... Columbus set sail for India. He ended up in the Bahamas... The economies of ALL developed nations are dependent on software More and more systems are software controlled

(STP) Template Items that are intended to stay in as part of your document are in bold; explanatory comments are in italic text. Plain text is used where you might insert wording about your project. This

Module 12 Software Project Monitoring and Control Lesson 31 Risk Management and Software Configuration Management Specific Instructional Objectives At the end of this lesson the student would be able to:

Successful Software Projects Software Metrics Metrics are tools that are used to estimate the cost and resource requirements of a project. In order to conduct a successful software project we must understand

D6 INFORMATION SYSTEMS DEVELOPMENT. SOLUTIONS & MARKING SCHEME. June 2013 The purpose of these questions is to establish that the students understand the basic ideas that underpin the course. The answers

Process Models and Metrics PROCESS MODELS AND METRICS These models and metrics capture information about the processes being performed We can model and measure the definition of the process process performers

Foundations for Systems Development ASSIGNMENT 1 Read this assignment introduction. Then, read Chapter 1, The Systems Development Environment, on pages 2 25 in your textbook. What Is Systems Analysis and

1998 Braided Matrix, Inc. All Rights Reserved Accounting Transactions IV: Invoices By, Ph.D. This is the final installment in a four-article series exploring different types of accounting transactions.

A Database Re-engineering Workbench A project proposal by Anmol Sharma Abstract Data is not always available in the best form for processing, it is often provided in poor format or in a poor quality data

Questions What is the life cycle of a software product? Why do we need software process models? What are the goals of a software process and what makes it different from other industrial processes? Software

Project Planning and Project Estimation Techniques Naveen Aggarwal Responsibilities of a software project manager The job responsibility of a project manager ranges from invisible activities like building

The Role of Programming in Informatics Curricula A. J. Cowling Department of Computer Science University of Sheffield Structure of Presentation Introduction The problem, and the key concepts. Dimensions

Chapter 1 1.1Reasons for Studying Concepts of Programming Languages a) Increased ability to express ideas. It is widely believed that the depth at which we think is influenced by the expressive power of

A Methodology for the Development of New Telecommunications Services DIONISIS X. ADAMOPOULOS Centre for Communication Systems Research School of Elec. Eng., IT and Mathematics University of Surrey Guildford

Answer first, then check at the end. Review questions for Chapter 9 True/False 1. A compiler translates a high-level language program into the corresponding program in machine code. 2. An interpreter is

Simulating the Structural Evolution of Software Benjamin Stopford 1, Steve Counsell 2 1 School of Computer Science and Information Systems, Birkbeck, University of London 2 School of Information Systems,

Functional Decomposition Top-Down Development The top-down approach builds a system by stepwise refinement, starting with a definition of its abstract function. You start the process by expressing a topmost

2 2 Programs: Instructions in the Computer Figure 2. illustrates the first few processing steps taken as a simple CPU executes a program. The CPU for this example is assumed to have a program counter (PC),

Back to Basics Backward Chaining: Expert System Fundamentals By Dustin Huntington Introduction Backward chaining is an incredibly powerful yet widely misunderstood concept, yet it is key to building many

Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code