Software systems for enterprises need to be designed after an in-depth analysis As software systems become more and more complex, it becomes increasingly difficult to correctly analyze the requirements and convert them into an appropriate design Therefore, tools are required to deal with this complexity Object-Oriented Analysis and Design (OOAD) provide you the necessary tools to analyze and design complex software systems This chapter introduces the various phases of the software development life cycle (SDLC) and discusses the various software development approaches Then, it discusses the object-oriented concepts and explains the role of OOAD in software development Objectives In this chapter, you will learn to: Identify the various software development approaches Identify the role of OOAD in SDLC Chapter Introducing Object-Oriented Analysis and Design Understanding Software Development Life Cycle (SDLC) Before the acceptance of software development as an engineering stream, the process of developing software was an ad hoc activity with no formal rules or standards As a result, software projects faced serious problems in terms of schedule slippage, cost overrun, and inferior quality of software SDLC was introduced to address the problems faced during the software development process SDLC is a disciplined and systematic approach that divides the software development process into various phases, such as requirement analysis, design, and coding The phase-wise development process helps you track schedule, cost, and quality of the software projects Overview of SDLC Phases There are six phases in SDLC: Feasibility analysis: Includes analysis of project requirements in terms of input data and desired output, processing required to transform input into output, cost-benefit analysis, and schedule of the project The feasibility analysis also includes the technical feasibility of a project in terms of available software tools, hardware, and skilled software professionals At the end of this phase, a feasibility report for the entire project is created Requirement analysis and specification: Includes gathering, analyzing, validating, and specifying requirements At the end of this phase, the Software Requirement Specification (SRS) document is prepared SRS is a formal document that acts as a written agreement between the development team and the customer SRS acts as input to the design phase and includes functional, performance, software, hardware, and network requirements of the project Design: Includes translation of the requirements specified in the SRS into a logical structure that can be implemented in a programming language The output of the design phase is a design document that acts as an input for all the subsequent SDLC phases Coding: Includes implementation of the design specified in the design document into executable programming language code The output of the coding phase is the source code for the software that acts as input to the testing and maintenance phase Testing: Includes detection of errors in the software The testing process starts with a test plan that recognizes test-related activities, such as test case generation, testing criteria, and resource allocation for testing The code is tested and mapped against the design document created in the design phase The output of the testing phase is a test report containing errors that occurred while testing the application ©NIIT Introducing Object-Oriented Analysis and Design 1.3 Maintenance: Includes implementation of changes that the software might undergo over a period of time, or implementation of new requirements after the software is deployed at the customer location The maintenance phase also includes handling the residual errors that may exist in the software even after the testing phase Software Development Approaches Different types of projects have different requirements Therefore, it may be required to tailor the SDLC phases according to the specific needs of the project This gives rise to various software development approaches Some of these approaches are: Waterfall approach Prototyping approach Spiral approach Win-win spiral approach Incremental approach Waterfall Approach The waterfall approach describes the software development process in a linear sequential flow This means that any phase in the development process begins only if the previous phase is complete The waterfall approach does not define the process to go back to the previous phase to handle changes in requirement Therefore, different projects may follow different approaches to handle such situations The waterfall approach is the earliest approach that was used for software development Initially, most projects followed the waterfall approach because they did not focus on changing requirements The waterfall approach defines the software development process in seven phases: Conception: Triggers when a problem is perceived This phase involves identifying goals to be achieved after the problem is solved, estimating benefits in the new system over the current system, and identifying other areas that are affected by the solution This phase also involves developing the business case for the project A business case provides the information that a manager needs to decide whether to support a proposed project, before resources are committed to its development Initiation: Involves a macro level study of the customer requirements This phase also involves defining alternative solutions to the customer requirements and cost-benefit justification of these alternatives Analysis: Involves carrying out a detailed study of the customer requirements and arriving at the exact requirements of the proposed system The phase involves freezing the requirements before the design phase begins 1.4 Introducing Object-Oriented Analysis and Design ©NIIT Design: Involves translating the identified requirements into a logical structure, called design that can be implemented in a programming language Construction: Involves converting the design into a machine-readable form Integration and testing: Involves integrating and testing all the modules developed in the previous phase as a complete system Implementation and maintenance: Involves converting the new system design into operation This may involve implementing the software system and training the operating staff before the software system is functional The following figure shows the various phases in the waterfall approach Conception Initiation Analysis Design Construction Integration and Testing Implementation and Maintenance Waterfall Approach The waterfall approach assumes that requirements are stable and frozen across the project plan However, this is usually not true in case of large projects where requirements may evolve across the development process ©NIIT Introducing Object-Oriented Analysis and Design 1.5 Prototyping Approach The prototyping approach, also known as evolutionary approach, came into picture because of failures that occurred in the final version of the software application developed using waterfall approach The failures generally occurred because of the change in requirements of the proposed system or because of the gap in understanding the customer requirements by the development team A gap in the first version of a developed application, inevitably leads to the need for redoing the application To overcome these limitations, the concept of prototyping was introduced A prototype is a sample implementation of the system that shows limited and main functional capabilities of the proposed system After a prototype is built, it is delivered to the customer for evaluation The prototype helps the customer determine how the features will function in the final software The customer provides suggestions and improvements on the prototype The development team implements the suggestions in the new prototype, which is again evaluated by the customer The process continues until the customer and the development team understands the exact requirements of the proposed system When the final prototype is developed, the requirements are considered to be frozen The prototyping approach is used in the requirements gathering and analysis phase to capture the exact requirements of the proposed system After the requirements are frozen, the remaining phases of the development process need to be executed to complete the development of the software system An e-commerce Web site, such as a shopping site, is an example where you can implement the prototyping approach You can develop a prototype of the various Web pages of the shopping site, such as catalogue page, product order page, and credit card authentication page, and present it to the customer for approval If the customer approves the prototype of the site, requirements are stated again and the design of the Web site is initiated If the customer does not approve the Web site, the development team revisits the prototype and resubmits it to the customer for approval This process continues until the prototype is approved Prototypes are of two types: Throwaway prototypes: Prototypes that are eventually discarded rather than becoming a part of the finally delivered software Examples of throwaway prototypes include screen mock-ups and storyboards Evolutionary prototypes: Prototypes that evolve into the final system through iterative incorporation of user feedback 1.6 Introducing Object-Oriented Analysis and Design ©NIIT Although prototyping is a very useful technique to obtain accurate requirements of the system and to speed up the development process, it has some disadvantages associated with it Some disadvantages of prototyping are: It gives clients the false impression that a few minor changes to the prototype will give them the required system It may compromise on the overall quality of the software in the rush to develop the prototype For example, the developer may use inefficient algorithms or inappropriate programming languages for developing the prototype quickly and the same may find place in the final application thus leading to inefficient code running in the final application Spiral Approach The spiral approach includes the iterative nature of the prototyping approach and the linear nature of the waterfall approach This approach is ideal for developing software that are released in various versions In each iteration of the spiral approach, software development process follows the phase-wise linear approach At the end of first iteration, the customer evaluates the software and provides the feedback Based on the feedback, software development process enters into the next iteration and subsequently follows the linear approach to implement the feedback suggested by the customer The process of iteration continues throughout the life of the software An example of a spiral approach is the evolution of Windows operating system from Window 3.1 to Windows 2003.You may refer to Windows 3.1 operating system as the first iteration in the spiral approach The product was released and evaluated by the customers, which include the market at large After getting the feedback from customers about Windows 3.1, Microsoft planned to develop a new version of Windows operating system Windows 95 was released with enhancements and graphical flexibility Similarly, other versions of Windows operating system were released The spiral approach includes six phases: Customer communication: Includes understanding the system requirements by continuous communication between the customer and the system analyst Planning: Includes estimating schedule, cost, and resource for the iteration Risk analysis: Includes identifying, estimating, and monitoring technical and management risks, such as schedule slippage and cost overrun Engineering: Includes requirement gathering and design of the software system Construction and release: Includes coding, testing, and deploying software at the customer site and providing user-support documents Customer evaluation: Includes evaluation of software by the customer and implementing feedback in the next iteration of the software development ©NIIT Introducing Object-Oriented Analysis and Design 1.7 The following figure shows the various phases in the spiral approach Spiral Approach Win-Win Spiral Approach The win-win spiral approach is an extension of the spiral approach The phases in this approach are same as the phases in the spiral approach The only difference is that at the time of identifying the requirements, the development team and the customer hold discussions and negotiate on the requirements that need to be included in the current iteration of the software The approach is called win-win because it is a winning situation for the development team and also for the customer The customer wins by getting the product that fulfills most of the requirements while the development team wins by delivering software which is developed with all the requirements established after negotiations with the customer The win-win spiral approach is generally used when you have time-bound releases 1.8 Introducing Object-Oriented Analysis and Design ©NIIT Incremental Approach In an incremental approach, software requirements are broken down into various functional units These functional units contain a group of similar tasks A project activity list is created to prioritize the functional units with various activities to be performed in each functional unit Each functional unit is implemented in an increment and the final product is achieved after all the functional units are implemented in the development process Each increment includes three phases: design, implementation, and analysis During the design phase of the first increment, the functionality with topmost priority from the project activity list is selected and the design is prepared In the implementation phase, the design is implemented and tested In the analysis phase, the functional capability of the partially developed product is analyzed The development process is repeated until all the functions of the project are implemented The following figure shows the incremental approach with various phases Design Design Design Implementation Implementation Implementation Analysis Analysis Analysis Increment Increment Increment n Incremental Approach Consider an example where a bank wants to develop software to automate the banking process for insurance services, personal banking, and home and automobile loans The bank wants the automation of personal banking system immediately because it will enhance the customer services You can implement the incremental approach to develop the banking software In the first increment, you can implement the personal banking feature and deliver it to the customer In the later increments, you can implement the insurance services, home loans, and automobile loans features of the bank The limitation of the incremental approach is that it is applicable only to large applications This is because it is difficult to break small projects into smaller functional increments ©NIIT Introducing Object-Oriented Analysis and Design 1.9 Just a minute: Which of the following approaches includes the iterative nature of the prototyping approach and the linear nature of the waterfall approach? Incremental approach Spiral approach Evolutionary approach Answer: Spiral approach 1.10 Introducing Object-Oriented Analysis and Design ©NIIT Understanding Object-Oriented Concepts In the design phase of any software development approach, you can follow two approaches to software development These are the function-oriented and object-oriented development approaches The function-oriented approach is the erstwhile approach that evolved before the object-oriented approach The function-oriented approach is module-centric and concentrates on functions of the software This approach does not restrict the creation of modules that are tightly coupled and expose data to other parts of the program Therefore, software constructed using the function-oriented approach may be so tightly coupled and interdependent that it may be difficult to separate the construction of one module from another In addition, data may be visible and accessible throughout the program Reusability of the software in this case becomes difficult The limitations of the function-oriented approach gave way to the evolution of the object-oriented approach The fundamental idea behind object orientation is to portray things as they exist in the real world This helps to reduce the complexity of software systems OO approach introduces the concept of inheritance which allows reuse of existing code components In addition, OO approach supports encapsulation of data, abstraction, and polymorphism The OO approach guides you to think in terms of reusability and therefore, helps in creating a better design Overview of OO Concepts The various OO concepts are: Classes and objects: A class is an abstract data type that contains a set of attributes and functions An object is an instance of a class All the objects share the same copy of the member functions, but maintain a separate copy of the member data To understand classes and objects, consider the analogy of a car Cars such as BMW, Ferrari, and Chevrolet share certain similar features and, therefore, can be grouped to form the objects of the class, Cars ©NIIT Introducing Object-Oriented Analysis and Design 1.11 The following figure depicts a class and its objects Class member data1 member data2 member function1 member function2 Object Object member data1 member data2 member data1 member data2 A Class and its Objects Inheritance: Inheritance refers to sharing of attributes and behaviors among classes based upon hierarchical relationship The inheritance feature allows you to define a new class by extending an existing class The original class is called a base class or super class and the new class obtained through inheritance is called a derived class or a sub class A base class is a generalization of the derived class, which means that the base class contains only those properties that are common to all the derived classes Consider an example Motorcycles, cars, and trucks have certain common properties – all have wheels, engines, and horns Therefore, they can be grouped under a class called automobiles Apart from sharing these common features, each subclass has its own particular characteristics, such as trucks run on diesel while cars may run on diesel or petrol 1.12 Introducing Object-Oriented Analysis and Design ©NIIT The following figure depicts inheritance of a derived class from the base class Automobile Class Wheels Engines Horn Car Class Model Wheels Engines Defined in derived class Accessible by derived class Horn Inheritance of a Derived Class from a Base Class Note Inheritance of classes allows you to reuse code If certain data or methods are similar in a set of classes, then instead of defining those methods and data in each class separately, you can define the common methods and data in the base class The derived class can then simply inherit the common methods and attributes from the base class ©NIIT Abstraction: Abstraction focuses on essential, inherent aspects of an entity ignoring its implementation details An abstract class specifies the abstract operation but does not include its implementation The implementation is provided in the derived classes of the abstract class Consider an example of the Polygon class that specifies an abstract operation, ComputeArea() The Polygon class does not provide the implementation of the operation, ComputeArea() The derived classes of the Polygon class, Rectangle and Square, implement the ComputeArea() operation to compute the area of a rectangle and square Introducing Object-Oriented Analysis and Design 1.13 The following figure shows the Polygon class with its derived classes Polygon compute_area(); //declaration Rectangle compute_area(); //implementation Circle compute_area(); //implementation Abstraction among Classes Encapsulation: Encapsulation means preventing access to non-essential details For example, when you plug in the cord of the vacuum cleaner and switch it on, the vacuum cleaner starts smoothly You cannot see the complex processes needed to actually convert electricity into suction power In other words, the exact working of the vacuum cleaner has been encapsulated Encapsulation is also called information hiding because it involves hiding attributes and operations of a class from other classes Polymorphism: The concept of using operators or functions in different ways depending on what they are operating on is called polymorphism Polymorphism in the context of operators refers to the difference in the functionality of an operator depending upon the type of the operands When polymorphism is used in the context of functions performing different tasks, it is referred to as function overloading An example of function overloading is an add() function, which can take different signatures at run time For instance, the function can be overloaded as add(int a, int b) or add(float a, float b) depending upon the type of parameters passed at run time Consider the example of Countryside Markets Inc., which has no formal system to store its employee’s information The organization now wants to store detailed information about its employees, such as name, age, date of birth, e-mail id, department, employee code, salary drawn, and date of joining 1.14 Introducing Object-Oriented Analysis and Design ©NIIT The following figure shows six classes for the Countryside Markets employee information system Employee empID empName empAddress empDateOfBirth empContactNos mgrID empDesignation empJoinDate Attributes with Protected Access display(int) addEmployee() removeEmployee() Part Time Full Time BasicSalary OtherPerks display(int) addEmployee() removeEmployee() modifySalary() Attributes with Private Access Inheritance Manager Abstract Functions Fee timeWorked display(int) addEmployee() removeEmployee() modifyFee() Attributes with Private Access Multiple Inheritance Engineer Developer teamList projectList computerList timeWorked SkillArea projectID display(int) addTeamMember() removeTeamMember() addProject() removeProject() display(int) addComputer() removeComputer() installSoftware() replaceHardware() display(int) Inheritance among Classes The preceding figure shows that classes are designed at three levels The class at each subsequent level is derived from one or more classes of the previous level For example, the Employee class is the parent class of the Full Time and Part Time classes, which inherit the properties of the Employee class This is called single inheritance In addition, the Developer class inherits the properties of both the Full Time and Part Time classes This is called multiple inheritance ©NIIT Introducing Object-Oriented Analysis and Design 1.15 The Employee class is an abstract class as it includes abstract functions, such as display(int), addEmployee() and removeEmployee(), which are implemented by the derived classes, Full Time and Part Time The attributes of the Employee class are declared with protected access This means that the attributes of this class are accessible to the Full Time and Part Time classes Therefore, Full Time and Part Time classes can modify the attributes of the Employee class The attributes BasicSalary and OtherPerks of the Full Time class have private access Therefore, the derived classes, Manager, Engineer, and Developer cannot access these attributes directly The attributes of the Part Time class, fee and timeWorked, also cannot be accessed by the Engineer or Manager class The display(int) function is provided in all classes The display(int) function specified in the Employee class is an abstract operation The implementation of the display(int) function is provided in the Full Time and Part Time classes The derived classes, Manager and Engineer, override the display(int) function of the Full Time class to display information for the Manager and Engineer classes This represents the polymorphism concept of object-oriented design Just a minute: Which phase of SDLC includes translation of the requirements specified in the SRS into a logical structure that can be implemented in a programming language? Feasibility analysis Design Coding Maintenance Answer: Design 1.16 Introducing Object-Oriented Analysis and Design ©NIIT Role of Object-Oriented Analysis and Design (OOAD) in SDLC To understand OOAD, you need to understand where OO approach fits into software development life cycle OO approach does not replace the standard approaches, such as Data Flow Diagrams (DFD) or Entity Relationship (ER) diagrams OO approach is only an addition to the existing toolkit OOAD uses the OO approach to solve the real world problems It uses OO approach to analyze the system requirements and break a large and complex system into smaller and simpler components OOAD is analysis of requirements and design of software system in terms of the objects, classes, encapsulation, inheritance, polymorphism, abstraction, and dynamic binding In addition, OOAD is a methodology that can be applied to any software development approach If you compare the definition of analysis involved in any of the software development approaches with the definition of OOAD, the only aspect that is new is analyzing the requirements in terms of objects and object classes Note An ER diagram is a modeling technique used to create a graphical representation of the entities and their relationship A DFD is a graphical technique used to depict data flow throughout the system ©NIIT Introducing Object-Oriented Analysis and Design 1.17 Practice Questions Match the models and diagrams with the modeling techniques a Prototyping approach i Protecting access to non-essential details b Inheritance ii Iterative nature c Encapsulation iii Evolutionary approach d Spiral approach iv Sharing of attributes and behaviors among classes based upon hierarchical relationship Which of the following phases of Waterfall approach involves a macro level study of the customer requirements? a Conception b Initiation c Analysis d Construction Which of the following approaches describes the software development process in a linear sequential flow? a Waterfall approach b Prototyping approach c Spiral approach d Incremental approach Which document is produced at the end of the requirement analysis phase of SDLC? a Software Requisition Statement b Software Requirement Specification c Software Requirement Statistics d System Requirement Statistics 1.18 Introducing Object-Oriented Analysis and Design ©NIIT ©NIIT Which of the following options focus on essential inherit aspects of an entity ignoring its implementation details? a Inheritance b Abstraction c Encapsulation d Polymorphism Introducing Object-Oriented Analysis and Design 1.19 Summary In this chapter, you learned that: SDLC is a disciplined and systematic approach towards software development SDLC divides the software development process into six phases: z Feasibility analysis z Requirement analysis and specification z Design z Coding z Testing Maintenance Different types of projects have different requirements Therefore, it may be required to tailor the SDLC phases according to the specific needs of the project This gives rise to various software development approaches Some of these approaches are: z z Waterfall approach z Prototyping approach z Spiral approach z Win-win spiral approach Incremental approach The function-oriented approach is module-centric and concentrates on the functions of the software The object-oriented (OO) approach supports reusability and encapsulation of data and concepts such as inheritance, abstraction, and polymorphism OOAD is analysis of requirements and design of software system in terms of objects, classes, encapsulation, inheritance, polymorphism, abstraction, and dynamic binding z 1.20 Introducing Object-Oriented Analysis and Design ©NIIT Exercises Exercise Technology Systems Inc needs to develop software for a bank that will offer new service to its customers The service enables the customers of the bank to pay telephone bills through the Internet The bank is offering this service as an experiment, and as a result, the requirements of the software are not consistent Being an experimental project, the requirements of the software could also evolve during the software-development process The new requirements of the software include sophisticated user interaction and easy-to-use interface Another important requirement for the software is maintaining security and privacy of customer information because the software will involve authorizing and authenticating credit-card information provided by the customer The bank is also planning to provide the same service on mobile phones Other competitors of the bank are also planning to offer the same service and, therefore, the bank requires a working system for this software as soon as possible Only a few top-level managers of the bank, who have identified this new service, can provide the full requirements on this software However, these employees are not frequently available due to their workload and prior appointments Identify the approach to be used for developing the software for the bank and justify your choice of approach ©NIIT Introducing Object-Oriented Analysis and Design 1.21 1.22 Introducing Object-Oriented Analysis and Design ©NIIT