Introduction to Software Engineering

1 Introduction to Software Engineering MMAAJJOORR T O P IICCSS Objectives ........................................................................ 8 ...
1 downloads 3 Views 111KB Size
1

Introduction to Software Engineering MMAAJJOORR T O P IICCSS Objectives ........................................................................ 8 Pre-Test Questions........................................................... 8 Introduction .................................................................... 9 Evolution of Software Engineering................................... 9 Programmer vs. Engineer............................................... 11 Object Technology......................................................... 11 Object Oriented vs. Functional Programming ............... 13 Advantages of an Object-Oriented Approach ................. 13 Disadvantages of an Object-Oriented Approach ............ 14 Analysis and Design....................................................... 15 Summary ....................................................................... 16 Post-Test Questions ....................................................... 16

8

Chapter 1—Introduction to Software Engineering

OBJECTIVES At the completion of this chapter, you will be able to: ●







Define object technology and identify its place in the evolution of software engineering. Describe the differences between a structured approach and an object-oriented approach to software development. Identify the advantages and disadvantages of an object-oriented approach to software development. Discuss the need for analysis and design.

P R E - TE S T Q U E S T I O N S The answers to these questions are in Appendix A at the end of this manual. 1. What are advantages to an object-oriented approach to programming? ..................................................................................................................................... .....................................................................................................................................

Introduction

INTRODUCTION The classical definition of software engineering given by F.L Bauer at a 1968 NATO conference defines the practice as: “The establishment and use of sound engineering principles in order to obtain economical software that is reliable and works efficiently on real machines.” Today, software engineering tends to encourage the use of structured development methods that promote ease in maintenence and provide viable programming solutions. In the process of software development, the relationships between the theoretical and functional stages require a variety of tools with which the software engineer must be familiar. In application, each engineer may solve the same problem with differerent tools; yet, common methodologies in which problems are solved should be recognized. This chapter will discuss the initial steps taken by the software engineer when approaching a problem and will also introduce the significance of the analysis and design phase in object oriented programming.

EVOLUTION OF SOFTWARE ENGINEERING Software engineering is a relatively young discipline. In the 1950s and 1960s, software development seemed to be a more improvised process. Data was fed through a program, and the results could be easily identified as either correct or incorrect. Information capacities were growing, but processing was relatively simple and centralized. As computers became more powerful, the demand for more complicated software systems increased. Thus, software engineers looked for better ways to manage the design and development of information systems. At the same time, structured and functional programming languages were becoming available. By the early 1970s, analysis and design methodologies became more formalized. Analysis and design methodologies provide standardized methods for depicting an information system before development begins. These early methods focused on the flow of information into and out of functional subsystems. Figure 1-1 represents a simple information system as depicted by early structured analysis and design methodologies.

9

10

Chapter 1—Introduction to Software Engineering

Shipment

Ship Order

Customer

Order

Inventory Database

Inventory

Order Inventory

Purchase Order Supplier

Order

Take Order

Order

Order Database Orders

Generate Report

Report Management

Order

Figure 1-1: Data flow diagram example

The flow of data is represented by arrows starting from a source, such as a customer, or through processes, such as taking an order or generating a report, to information consumers, such as management. By decomposing the system in this way, functional subsystems can be developed individually. Many of the principles developed in these early analysis and design models have been carried over into modern object-oriented analysis and design methodologies.

Programmer vs. Engineer 11

PROGRAMMER VS. ENGINEER In any computer science environment where directed teams work together to accomplish goals in the development of computer based applications, a distinction can be made between an engineer and a programmer. The classifications of a programmer, or one who repairs things or follows plans constructed by an engineer within the formal aspects of coding, fail to address some distinctive duties of a programmer. A software engineer solves problems by manipulating code and takes part in providing management techniques and extensive knowledge of design methodologies. A programmer is also concerned with structural methodologies; the design or organization of tools for solving problems with coded applications is incomplete without an interaction between the processes of analysis, design, and implementation. Programmers and software engineers vitally interact with one another. For an individual to call himself a programmer and not an engineer is a misunderstanding between the tasks of each. The concepts are inclusive, and the solutions may be obtained only when one not only acknowledges the purpose and tasks of the other but also incorperates them towards the accomplishment of the common goal or solution.

O B J E C T TE C H N O L O G Y Structured programming models focus their attention on the flow of information through data-handling functions. Analysis and design allowed system designers and developers to view software as a set of atomic functions that each performed a specific task. This view allowed for more rapid development, fewer errors in code, and reduced project risk. However, as computers became faster, smaller and cheaper, demand developed for more complicated and less centralized information systems deployed over multiple computer systems, operating environments, and locations. Object-oriented methods attempt to address these issues. The fundamental component of the structured model is its function. Data is generated outside the system and flows through a set of functions before being stored or processed. In an object-oriented model, data becomes the fundamental component in the form of objects.

12

Chapter 1—Introduction to Software Engineering

Examine the data flow in Figure 1-1. As a customer places an order, the order information passes through a "Take Order" function and a "Ship Order" function. In an object-oriented model, the order information would be identified as an object, which maintains properties about its state. For example, an order object might maintain a list of items included in the order, a shipping address, and a billing method. There are several differences between an object and the data in a structured program. In a structured program, data is passed through functions that operate on it. In an objectoriented program, messages are sent to objects that instruct the objects how to operate on themselves. Figure 1-2 illustrates an order object with the properties that define it. Instead of passing the order object through a function, however, it is sent a "Ship Order" message, and the order ships itself.

Ship Order

Order Items Shipping Address Billing Method

Figure 1-2: Order object

Object Oriented vs. Functional Programming 13

OBJECT ORIENTED VS. FUNCTIONAL PROGRAMMING As the complexity of software increases, understanding its structure becomes a requirement. Although well-structured software may be efficiently developed using a variety of methods, this section considers the difference between programming using a functional programming language and using an object oriented language. Functional programming is a language in which the evaluation of expressions assigns values to statements. These statements can be manipulated as variables, unlike the methodical commands given in an object-oriented environment. Functional programming is also useful in sorting and processing lists and in providing the ability to define complex mathematical functions. Functional languages, such as Standard ML, Miranda, or Haskell, allow function definitions resulting from matched patterns within the program as well as higher-order function definitions. Functional languages are also widely used for defining program-specific algebraic types. The analysis and design of a functional program is in many ways structurally similar to a program constructed in an object-oriented framework. The organization of program behavior is similar since the levels of data abstraction in both languages may accomplish a similar task. However, the steps to reach the goal in a functional program may require added complexity, which may be simplified in the use of an object-oriented language. The next section gives a structured overview of these benefits.

ADVANTAGES OF AN OBJECT-ORIENTED APPROACH Like structured programming, object-oriented programming is used to manage the complexity of large software systems. However, object technology provides several other advantages such as: easier maintainance, more reusable components, and greater scalable ability.

Maintainable Object-oriented programming methods make code more maintainable. Identifying the source of errors is easier because objects are self-contained. Later in this course, certain principles of proper object-oriented design that contribute to a program's maintainability will be introduced.

14

Chapter 1—Introduction to Software Engineering

Reusable Because objects contain both data and methods that act on data, objects can be thought of as self-contained black boxes. This feature makes it easy to reuse code in new systems. Messages provide a predefined interface to an object's data and functionality. With this interface, an object can be used in any context. Later in this course, you will learn how to expand on the functionality of objects, even if you know very little about their implementation.

Scalable Object-oriented programs are also scalable. As an object's interface provides a road map for reusing the object in new software, and provides all the information needed to replace the object without affecting other code. This way aging code can be replaced with faster algorithms and newer technology.

DISADVANTAGES OF AN OBJECT-ORIENTED APPROACH A few challenges present themselves in transitioning to an object-oriented approach for software engineering. Many legacy systems are built with a structural framework. Interfacing with these systems does not provide a technical challenge as much as a design challenge. The goal is to minimize the effects of structural systems on the object-oriented nature of the new designs. Retraining can also be an issue. Object-oriented programming has existed since the early 1980s. However, object-oriented principles did not appear in educational curriculum until about 1995.

Analysis and Design 15

ANALYSIS AND DESIGN Analysis and design are the first steps in the development of a software system. Analysis is the process of gathering software requirements and recording them in a standardized format that can be translated into design. Customers, managers, and end-users speak a different language than software engineers. Analysis bridges the gap between those who will use a software system and those who will design and code a software system. Design is the process of translating the output of analysis into a blueprint for the actual coding of a software system. Like a blueprint for a building, the design will show enough detail to allow a diverse group of managers and programmers to develop the system concurrently. The focus of this course is on analysis and design. However, analysis and design do not exist in a vacuum; they are part of a larger process of developing object-oriented software. A development methodology details the entire process of software development, from gathering requirements to design, coding, and deployment. To fully understand the roles of analysis and design in the software development process, they will be taught in the context of the Unified Software Development Process, or Unified Process.

Software crisis Analysis and design serve several purposes. They allow developers to foresee technical difficulties. They help ensure that the product will match users' needs and expectations. Most importantly, they help managers to minimize risk. Developing software is a timeconsuming and expensive process. Because software is intangible, it can be difficult to assess development progress. When product deployment is delayed as a result of problems in software development, a software crisis is said to exist. Analysis and design procedures and development methodologies help to prevent the software crisis by providing managers with a framework to measure a development organization's performance and potential for success.

16

Chapter 1—Introduction to Software Engineering

Exercise 1-1: Using an object-oriented approach If you have prior experience with a structural programming language, the transition to an object-oriented paradigm can be difficult. In this exercise, you will begin training yourself to think from an object-oriented perspective. 1. Examine Figure 1-1. Identify possible objects that could form an object-oriented system to perform the same task. 2. Identify the properties that define the objects found in Step 1 of this exercise. 3. Identify the messages that define the interface to objects found in Step 1.

SUMMARY Software engineering is a relatively young discipline. Early analysis and design methodologies focused on tracing the path of data through functional components. Object-oriented analysis and design identifies objects, determines properties that define objects, and determines messages to which objects should respond. Object-oriented techniques make code more maintainable, reusable, and scalable. Analysis and design help managers to minimize risk.

P O S T - TE S T Q U E S T I O N S The answers to these questions are in Appendix A at the end of this manual. 1. Why are objects often easy to reuse? ..................................................................................................................................... .....................................................................................................................................

2. How do analysis and design help prevent a software crisis? ..................................................................................................................................... .....................................................................................................................................