Object-Oriented Analysis and Design: Introduction to Object Orientation, Lecture notes of Computers and Information technologies

Book Object Oriented Analysis and Design

Typology: Lecture notes

2017/2018

Uploaded on 04/14/2018

rabin-regmi
rabin-regmi 🇳🇵

1 document

1 / 188

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
www.lpude.in
DIRECTORATE OF DISTANCE EDUCATION
OBJECT ORIENTED ANALYSIS
AND DESIGN
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Object-Oriented Analysis and Design: Introduction to Object Orientation and more Lecture notes Computers and Information technologies in PDF only on Docsity!

www.lpude.in

DIRECTORATE OF DISTANCE EDUCATION

OBJECT ORIENTED ANALYSIS

AND DESIGN

Copyright © 2013 Anindita Hazra All rights reserved

Produced & Printed by EXCEL BOOKS PRIVATE LIMITED A-45, Naraina, Phase-I, New Delhi- for Directorate of Distance Education Lovely Professional University Phagwara

SYLLABUS

Object Oriented Analysis and Design

Objectives:

 To enable the student to understand the concept of Object Oriented Analysis and Design.

 To impart the skills required for modelling.

 To enable the student to implement generalization and inheritance class modeling.

 To enable the student to implement association and aggregation using modeling.

 To enable the student to implement state modeling

 To enable the student to implement interactive modeling.

 To enable the student to implement procedural and activity models.

 To impart the skills needed to perform system analysis and design.

 To enable the student to implement domain analysis.

 To enable the student to understand the technicalities of system design concepts.

 To enable the student to design class diagrams.

Sr. No. Description

  1. Introduction : object orientation, OO development, OO themes, Evidence for usefulness of OO development
  2. Modelling concepts : Definition, Abstraction, Three models. Class Modelling : Object and class concepts, Link and association concepts, Generalization and inheritance, sample class model, Navigation of class models
  3. Advance Class modelling: Advance object and class concepts, Association Ends, N-ary associations, aggregation, Abstract classes, Constraints, Derived data, packages.
  4. State Modelling: Events, States, Transition and conditions, state diagrams, state diagram behaviour.
  5. Interaction Modelling : Use case models, Sequence models, Activity models.
  6. Advance Interaction Modelling: Use case Relationships, Procedural Sequence models, Special constructs for activity models
  7. Analysis and design : process overview, development life cycle System conception : devising, Elaboration, Preparing a problem statement
  8. Doman Analysis: Domain class model, Domain state model, domain interaction model.
  9. System design : overview, reuse plan, concurrency, allocation, software control strategy, boundary conditions
  10. Class design : Designing algorithms, Refactoring, design optimization, adjustment of inheritance, organizing class design.

CONTENTS

  • Unit 1: Introduction to Object Orientation
  • Unit 2: Modelling Concepts
  • Unit 3: Class Modelling
  • Unit 4: Advanced Class Modelling – I
  • Unit 5: Advanced Class Modelling – II
  • Unit 6: State Modelling
  • Unit 7: Interaction Modelling
  • Unit 8: Advanced Interaction Modelling
  • Unit 9: Analysis and Design
  • Unit 10: System Conception
  • Unit 11: Domain Analysis
  • Unit 12: System Design
  • Unit 13: Class Design
  • Unit 14: Steps for Class Design

Unit 1: Introduction to Object Orientation

Unit 1: Introduction to Object Orientation^ Notes

CONTENTS

Objectives Introduction

1.1 Object Orientation (OO) 1.1.1 Uses of Object Orientation

1.1.2 Why Object Orientation? 1.2 Object-oriented Development

1.3 Object-oriented Themes 1.3.1 Abstraction

1.3.2 Encapsulation 1.3.3 Combining Data and Behaviour

1.3.4 Sharing 1.3.5 Emphasis on Object Structure, not on Operation Implementation

1.4 Evidence for Usefulness of Object-oriented Development 1.5 Summary

1.6 Keywords 1.7 Review Questions

1.8 Further Readings

Objectives

After studying this unit, you will be able to:

 Describe the concept of object orientation

 Discuss the uses and need of object orientation

 Explain the concept of object-oriented development

 Identify object-oriented themes

 Discuss the evidence for usefulness of object-oriented development

Introduction

Object-oriented Analysis and Design (OOAD) is a software engineering model which makes use of objects, classes, state, methods and behavior concepts to analyze and demonstrate system structure, functional needs and behavior. While object-oriented analysis emphasizes the things that a system actually does, the object oriented design is concerned with the manner in which the system does it. One thing that you must keep in mind is that the object oriented system will always be comprised of objects. The behavior for the system is a result for the connection that is made with the objects. Connections between objects will require them to send out messages to

Unit 9: Analysis and Design

Notes (^) one another. The object-oriented paradigm is currently the most popular way of analysing, designing, and developing application systems, especially large ones. Labelling something as ‘object-oriented’ implies that objects play a central role, and we elaborate this further as a perspective that views the elements of a given situation by decomposing them into objects and object relationships. In this unit, we will discuss the concept of object orientation and discuss object oriented development and object oriented themes.

1.1 Object Orientation (OO)

In the past, information systems used to be defined primarily by their functionality: data and functions were kept separate and linked together by means of input and output relations. Object-oriented Approach means organizing software as a collection of discrete objects that incorporate both data structure and behavior. The object-oriented approach, however, focuses on objects that represent abstract or concrete things of the real world. These objects are first defined by their character and their properties which are represented by their internal structure and their attributes (data). The behaviour of these objects is described by methods (functionality). Object orientation (OO), or to be more precise, object-oriented programming, is a problem-solving method in which the software solution reflects objects in the real world. The term object-oriented (OO) signifies that we organize software as a collection of discrete objects that incorporate both data structure and behavior. This contrasts with previous programming approaches in which data structure and behavior are only loosely connected. There is some dispute regarding exactly what characteristics are needed by an object oriented approach, however they generally include aspects such as identity, classification, inheritance, polymorphism, etc. Terms that are used universally in object orientation are:  Objects: An object is a section of source code that contains data and provides services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object. Objects are a concept, abstraction, or item with clear boundaries and meaning for the problem domain. Objects have:  Unique identity  State  Behavior Objects can be concrete or conceptual, conceptual objects are pure abstractions that serve some specific purpose for a system. Objects are instances of classes. The set of activities that the object performs defines the object’s behavior.

Example: A “StudentStatus” object can tell you its grade point average, year in school, or can add a list of courses taken. A “Student” object can tell you its name or its address.  Classes: Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class.

Object Oriented Analysis and Design

Notes (^) Each object “knows how to perform its operation.” This burden is on the class and not the caller of the operation. OOP selects the method to implement an operation based on the name and class of the operation. The user of an operation need not be aware of implementation details.  Inheritance: Inheritance is a mechanism for sharing similarities among classes while preserving their differences. Classes are typically defined broadly (higher level of abstraction) and then refined into subclasses (lower level of abstraction). Each subclass “inherits” all of the properties of the superclass and adds its own unique properties. You can use an existing class to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones. Properties (both data and behavior) of the superclass need not be repeated in the subclass. The ability to abstract common properties of several classes into one common superclass and inherit the properties from the superclass can greatly reduce repetition within designs and programs (at the cost of coupling).

Example: Class ‘employee’ and class ‘customer’ are derived from the class ‘person’ New classes can be added without changing code given that methods are provided for each applicable operation on the new class. Inheritance is used to model an “is a” relationship. A subclass is always an instance of the superclass.

! Caution (^) Be careful, the reverse is not true.

Task (^) Explain the concept of “Identity” with example.

1.1.1 Uses of Object Orientation

Below are some of the advantages of object-oriented programming:  Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques.  In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required.  Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components.  In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase. Achieving these goals requires:  Object-oriented programming languages: Object-oriented programming techniques do not necessarily depend on object-oriented programming languages. However, the efficiency

Unit 1: Introduction to Object Orientation

of object-oriented programming depends directly on how object-oriented language^ Notes techniques are implemented in the system kernel.

 Object-oriented tools: Object-oriented tools allow you to create object-oriented programs in object-oriented languages. They allow you to model and store development objects and the relationships between them.

 Object-oriented modelling: The object-orientation modeling of a software system is the most important, most time-consuming, and most difficult requirement for attaining the above goals. Object-oriented design involves more than just object-oriented programming, and provides logical advantages that are independent of the actual implementation.

1.1.2 Why Object Orientation?

To create sets of objects that work together concurrently to produce s/w that better, model their problem domain that similarly system produced by traditional techniques.

It adapts to:

  1. Changing requirements
  2. Easier to maintain
  3. More robust
  4. Promote greater design
  5. Code reuse

(a) Higher level of abstraction (b) Seamless transition among different phases of software development (c) Encouragement of good programming techniques (d) Promotion of reusability

Self Assessment

Fill in the blanks:

  1. ........................ is a problem-solving method in which the software solution reflects objects in the real world.
  2. An ........................ is a section of source code that contains data and provides services. The data forms the attributes of the object.
  3. Objects are runtime instances of a .........................
  4. ................... means that data is quantized into discrete, distinguishable entities called objects.
  5. ........................ means that objects with the same data structure (attributes) and behavior (operations) are grouped into a class.
  6. The process in which same operation may apply to many different classes, with some classes having distinct behavior is known as ........................
  7. ........................ is a mechanism for sharing similarities among classes while preserving their differences.
  8. Object-oriented ........................ allow you to create object-oriented programs in object- oriented languages.

Unit 1: Introduction to Object Orientation

Some of the pioneers in the field of software design began to ask whether they could not also^ Notes design software using such ‘off-the-shelf’ components. The object-oriented paradigm one could argue has really evolved in response to this outlook. There are, of course, several differences with the hardware design process (inevitable, because the nature of software is fundamentally different from hardware), but parallels can be drawn between many of the defining characteristics of hardware design and what today’s advocates of good software design recommend. This methodology provides us with a step-by-step process for software design, a language to specify the output from each step of the process so that we can transition smoothly from one stage to the next, the ability to reuse earlier designs, standard solutions that adhere to well-reasoned design principles and, even the ability to incrementally fix a poor design without breaking the system.

The overall philosophy here is to define a software system as a collection of objects of various types that interact with each other through well-defined interfaces. Unlike a hardware component, a software object can be designed to handle multiple functions and can therefore participate in several processes.

Notes (^) A software component is also capable of storing data, which adds another dimension of complexity to the process.

The manner in which all of this has departed from the traditional process-oriented view is that instead of implementing an entire process end-to-end and defining the needed data structures along the way, we first analyse the entire set of processes and from this identify the necessary software components. Each component represents a data abstraction and is designed to store information along with procedures to manipulate the same. The execution of the original processes is then broken down into several steps, each of which can be logically assigned to one of the software components.

Did u know? (^) The components can also communicate with each other as needed to complete the process.

Self Assessment

Fill in the blanks:

  1. ........................ is a new way of thinking about software based on abstractions that exist in the real world as well as in the program.
  2. ........................ system is defined as a collection of objects of various types that interact with each other through well-defined interfaces.

1.3 Object-oriented Themes

There are several themes in an object oriented technology. These themes are not unique to object oriented systems. We can see some important themes:

1.3.1 Abstraction

Abstraction consists of focusing on the essential, inherent aspects of an entity and ignoring its accidental aspects. Use of abstraction preserves the freedom to make decisions as long as possible by avoiding premature commitments to details. Most modern languages provide data abstraction,

Object Oriented Analysis and Design

Notes (^) but inherit-mice and polymorphism add power. The ability to abstract is probably the most important skill required for object oriented development.

1.3.2 Encapsulation

Encapsulation is the process of encapsulating the elements of an abstraction that constitutes its structure and behavior; encapsulation serves to separate the contractual interface of an abstraction and its implementation. It can also be called as information hiding. It consists of separating the external aspects of an object, which are accessible to other objects, from the internal implementation details of the object, which are hidden from other objects. It is not unique to object oriented languages. Encapsulation (also information hiding) consists of separating the external aspects of an object, which are accessible to other objects, from the internal details of the object, which are hidden from other objects. Objects have an outside (how they are seen or interact) and an inside (what they are.) Encapsulation means that every object is self-contained. Encapsulation is not a unique concept to OO languages, but the ability to combine data and behavior in an object provides cleaner encapsulations than with conventional languages. Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself. Separate the external aspects of an object (its interface) from the internal implementation details (implementation). Proper encapsulation keeps objects from becoming interdependent (or coupled) - internal details can change with no affect on the user. Encapsulation places a premium on interfaces.

! Caution (^) Encapsulated details can change with no impact to a client, while an interface change directly affects a client.

1.3.3 Combining Data and Behaviour

The caller of an operation need not consider how many implementations of a given operation exist. Operator polymorphism shifts the burden of deciding what implementation to use from the calling code to the class hierarchy. As an example, let us talk about an object oriented program calling a draw procedure for drawing different figures say a polygon, circle, or text. The decision of which procedure to use is made by each object, based on its class.

1.3.4 Sharing

Inheritance of both data structure and behavior allows common structure to be shared among several similar subclasses without redundancy. The sharing of code using inheritance is one of the main advantages of object oriented languages. One of the reasons for the popularity of object-oriented techniques is that they encourage sharing at different levels. Inheritance of both data structure and behavior allows common structure (base class) to be used in designing many subclasses based on basic characteristics of base class,

Object Oriented Analysis and Design

Notes (^) Since the mid 1990s, we have expanded our practice of object oriented technology beyond General Electric to companies throughout the world. Earlier object orientation and object oriented modeling were relatively new approaches without much large-scale experience.

Notes (^) Object oriented technology can no longer be considered a fad or a speculative approach. It is now part of the computer science and software engineering mainstream.

The annual OOPSLA (Object-oriented Programming Systems, Languages, and Applications), ECOOP (European Conference on Object-oriented Programming), and TOOLS (Technology of Object-oriented Languages and Systems) conferences are important forums for disseminating new object oriented ideas and application results. The conference proceedings describe many applications that have benefited from an object oriented approach. Advantages of OO Development are:  Reusability  Effective maintenance Disadvantage of OO Development:  Not applicable in performance critical rather than data.

Self Assessment

State whether the following statements are true or false:

  1. Object oriented development began at the General Electric Research and Development Center.
  2. Object oriented models were used to document programs that are well-structured and easy to understand.

1.5 Summary

 Object-oriented analysis and design is a software engineering model which makes use of objects, classes, state, methods and behavior concepts to analyze and demonstrate system structure, functional needs and behavior.  Object Oriented Approach means organizing software as a collection of discrete objects that incorporate both data structure and behavior.  Object orientation (OO), or to be more precise, object-oriented programming, is a problem- solving method in which the software solution reflects objects in the real world.  An object is a section of source code that contains data and provides services.  A class is a definitive description of a group of objects with similar properties and behaviors.  Object Oriented Development is a new way of thinking about software based on abstractions that exist in the real world as well as in the program.  Abstraction consists of focusing on the essential, inherent aspects of an entity and ignoring its accidental aspects.  Encapsulation is the process of encapsulating the elements of an abstraction that constitutes its structure and behavior.

Unit 1: Introduction to Object Orientation

 Inheritance of both data structure and behavior allows a common structure and behavior^ Notes allows common structure to be shared among several similar subclasses without redundancy.  In object orientation the major emphasis is on specifying the characteristics of the objects in a system, rather than implementing these characteristics.

1.6 Keywords

Abstraction: Abstraction consists of focusing on the essential, inherent aspects of an entity and ignoring its accidental aspects. Class: A class or object class is a group of objects with similar properties (attributes), common behavior (operations), common relationships to other objects, and common semantics. Classification: Classification means that objects with the same data structure (attributes) and behavior (operations) are grouped into a class. Encapsulation: Encapsulation is the process of encapsulating the elements of an abstraction that constitutes its structure and behavior.

Identity: Identity means that data is quantized into discrete, distinguishable entities called objects.

Inheritance: Inheritance is a mechanism for sharing similarities among classes while preserving their differences.

Object: An object is a section of source code that contains data and provides services.

OO Development: Object-oriented Development is a new way of thinking about software based on abstractions that exist in the real world as well as in the program.

1.7 Review Questions

  1. What is object orientation? Explain with example.
  2. Describe the terms related to object orientation. Give example of each.
  3. Make distinction between polymorphism and inheritance.
  4. What are the advantages of object orientation? Discuss.
  5. Discuss the importance of object orientation.
  6. Elucidate the concept of object-oriented development.
  7. What are the different themes in an object-oriented technology? Discuss.
  8. “In object orientation the major emphasis is on specifying the characteristics of the objects in a system, rather than implementing these characteristics.” Comment.
  9. Write short note on the evidence for usefulness of OO Development.
  10. Explain the concept of encapsulation with example.

Answers: Self Assessment

  1. Object orientation (OO) 2. Object
  2. class 4. Identity
  3. Classification 6. polymorphism.

Unit 2: Modelling Concepts

Unit 2: Modelling Concepts^ Notes

CONTENTS

Objectives Introduction

2.1 Basics of Object-oriented Analysis and Design (OOAD) 2.1.1 Object-oriented Analysis (OOA)

2.1.2 Object-oriented Design (OOD) 2.2 Modelling

2.2.1 Definition of Modelling 2.2.2 Why do we Model?

2.2.3 Object-oriented Modelling (OOM) 2.2.4 Benefits of Object-oriented Modelling

2.3 Abstraction 2.4 Three Models

2.5 Summary 2.6 Keywords

2.7 Review Questions 2.8 Further Readings

Objectives

After studying this unit, you will be able to:

 Describe the basics of Object-oriented Analysis and Design

 Discuss the concept of modelling

 Explain abstraction

 Discuss three models used in object-oriented modelling

Introduction

Object oriented design methods emerged in the 1980s, and object oriented analysis methods emerged during the 1990s. In the early stage, object orientation was largely associated with the development of Graphical User Interfaces (GUIs), and a few other applications became widely known. In the 1980s, Grady Booch published a paper on how to design for Ada and gave it the title, Object Oriented Design. In 1991, Booch was able to extend his ideas to a genuinely object oriented design method with the same title, revised in 1993. The Object Modelling Technique (OMT) covers aspects of object oriented analysis and design. OOT provides a very productive and practical way of software development. As Object-oriented Technology (OOT) is not language dependent, there is no need for considering a final implementation language, during Object-oriented Modelling (OOM). OOT combines structural, control and functional aspects of the system.

Object Oriented Analysis and Design

Notes 2.1 Basics of Object-oriented Analysis and Design (OOAD)

Object-oriented Analysis and Design is a software engineering approach that models a system as a group of interacting objects. Each object represents some entity of interest in the system being modeled, and is characterized by its class, its state (data elements), and its behavior. Various models can be created to show the static structure, dynamic behavior, and run-time deployment of these collaborating objects. There are a number of different notations for representing these models, such as the Unified Modeling Language (UML). Object-oriented Analysis (OOA) applies object-modeling techniques to analyze the functional requirements for a system. Object-oriented Design (OOD) elaborates the analysis models to produce implementation specifications. OOA focuses on what the System Does, OOD on How the System Does it. An object-oriented system is composed of objects. The behavior of the system results from the collaboration of those objects. Collaboration between objects involves them sending messages to each other. Sending a message differs from calling a function in that when a target object receives a message, it itself decides what function to carry out to service that message. The same message may be implemented by many different functions, the one selected depending on the state of the target object. The implementation of “message sending” varies depending on the architecture of the system being modeled, and the location of the objects being communicated with.

2.1.1 Object-oriented Analysis (OOA)

Object-oriented Analysis looks at the problem domain, with the aim of producing a conceptual model of the information that exists in the area being analyzed. Analysis models do not consider any implementation constraints that might exist, such as concurrency, distribution, persistence, or how the system is to be built. Implementation constraints are dealt with during Object- oriented Design. Analysis is done before the Design. The sources for the analysis can be a written requirements statement, a formal vision document, and interviews with stakeholders or other interested parties.

Did u know? (^) A system may be divided into multiple domains, representing different business, technological, or other areas of interest, each of which are analyzed separately. The result of object-oriented analysis is a description of what the system is functionally required to do, in the form of a conceptual model. That will typically be presented as a set of use cases, one or more UML class diagrams, and a number of interaction diagrams. It may also include some kind of user interface mock-up.

2.1.2 Object-oriented Design (OOD)

Object-oriented Design transforms the conceptual model produced in object-oriented analysis to take account of the constraints imposed by the chosen architecture and any non-functional – technological or environmental – constraints. Examples of non-functional constraints include transaction throughput, response time, run-time platform, development environment, or programming language. The concepts in the analysis model are mapped onto implementation classes and interfaces. The result is a model of the solution domain, a detailed description of how the system is to be built.