35
CS206 System Analysis & D esign Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall Sixth Edition Part V: Software Engineering and Implementation

CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

Embed Size (px)

Citation preview

Page 1: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

1

Lecture Note 14Object-Oriented System Analysis And

DesignSystems Analysis and Design

Kendall & Kendall

Sixth Edition

Part V: Software Engineering and Implementation

Page 2: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

2

Major Topics

• Introduction of Object-Oriented Design• Concepts of Object-Oriented Design

– Object

– Class

– Inheritance

– Message

– Polymorphism

– Encapsulation

• The Benefits in Using Object-oriented Approach• Introduction to Unified Modeling Language

Page 3: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

3

Introduction

• You will learn how to use Object-Oriented methods to document, analyze and model an information system.

• Although traditional structured analysis is the most popular approach, the use of Object-oriented analysis and design is growing rapidly.

Page 4: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

4

• Object-oriented analysis describes an information system by identifying things called object.

• Each object is a computer representation of some actual thing or event.

• These Objects can be built as individual pieces and put together to form a system.

• The end product of object-oriented analysis is an object model.

• Later, the system developers can translate O-O designs directly into O-O program code modules using language C++ and Java.

Page 5: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

5Traditional approach and Object-oriented approach

Page 6: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

6

The characteristics of the Object-oriented analysis and design:

• Ability to tackle (处理 ) challenging problems.• Improved communication between users, analysts, designer, and programmers.• Increased consistency in analysis and design.• Explicit (清楚 ) representation of commonality (公共 ) among system components.• System robustness (強壯 ) .

• Reusability (再使用 ) of analysis, design, and programming results.

Page 7: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

7

The Concepts of Object-oriented DesignObject

• An object-oriented model is built around Objects , just as the E-R model is built around entities.

• An object represent a real person, place, event, transaction, concept, or anything that we want to capture information from.

• An object is an abstraction of something in a problem domain, reflecting the capabilities (能力 ) of the system to keep information about it and interact with it.

Page 8: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

8

• An object has – Attributes / Properties that describe the

characteristics of an object.– Methods / Behaviours that defines specific tasks that

an object can perform.– State of an object is defined by the value of its

properties and its relationships with other objects at a particular point in time.

– Instances : a single occurrence of an object.• Objects do not include primary key or foreign keys,

instead each instance is assigned a unique identifier (UID) when it is created.

• UID is hidden from the user and is used behind the scenes by the system only to differentiate one object instance from another, even if they were to have the same values and methods.

Page 9: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

9

• Example1 : An appointment system for a doctor’s office.

– Objects might include doctor, patient, and appointment.

– Attributes: a patient’s name, birth date, address, and phone number.

– Method: an appointment object can schedule a new appointment, delete an appointment, Insert an appointment and locate the next available appointment.

– State of a patient might be new, current, former.– Instances of the patient object: the specific patients

Theresa Marks, Jim Maloney, Mary Wilson, are considered.

Page 10: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

10

Example1:

Page 11: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

11

Example2:

Consider how the describes the family with parents, three children and three dogs.

Page 12: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

12

Class• An object class (Class) is a set of people, place,

events, things, or transactions that share common attributes and perform common functions.

• Class is a description of a set of objects with similar attributes, operations, methods, relationships and semantics (語意 ).

• Each object belongs to a group category called a class.• All objects within a class share common attributes and

methods.• An Example: All the objects that capture information about

patients could fall into a class called patient because there are properties and methods that all patients share.

Page 13: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

13

Page 14: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

14

Inheritance

• Classes are arranged in a hierarchy. • The superclasses (general classes) are at the top, the subclasses (specific classes) are at the bottom.• Abstract Class: A class that has no direct instances, but whose descendants (後代 ) may have direct instances.• Concrete Class: A class that can have direct instances.• An Example1: A person may be a doctor, a patient. ---- Superclass

A doctor may be general practitioner, specialist. ---- Subclass

Page 15: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

15

Superclass

Subclass

Class Hierarchy

Example1:

parent

child

Page 16: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

16

Example2:

The vehicle class includes common attributes and methods. Car, truck, minivan, and school bus are subclass of the Vehicle.

Subclass

Superclass

Page 17: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

17

• Inheritance means that classes can reuse attributes and methods that have been defined in other classes.

• This figure shows that both doctor and patient are subclasses of the person and therefore they will inherit the attributes and methods of the person class.

Page 18: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

18

Page 19: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

19

Page 20: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

20

Message• A message is a

command that tells an object to perform a certain methods.

• Example1: The message ADD STUDENT signals the STUDENT class to perform the ADD STUDENT method. The message DELETE STUDENT signals the STUDENT class to perform.

Page 21: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

21

Example2: If a patient is new to the doctor’s office, the system will send an insert message to the application. The patient object will receive the instruction (message) and do what it needs to do to go about inserting the new patient into the system (method).

Page 22: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

22

Polymorphism• The same message to two different objects can

produce different results. • The concept that a message gives different

meanings to different objects is called polymorphism.

Example1:

Page 23: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

23

Example2: Inserting a instance means something different than inserting an appointment (i.e. different pieces of information need to be collected and stored).

Page 24: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

24

Encapsulation• It is the idea of concealing (隱藏 ) the internal data and

processes of an object from the outside.• You can view an object as a black box, because a

message to the object triggers (引起 ) changes within the object without specifying how the changes must be carried out.

• A black box concept is an example of encapsulation, which means that all data and methods are self-contained. A black box does not want or need outside interference (干擾 ).

• Encapsulation allows objects to be used as modular components anywhere in the system, because objects send and receive messages but do not alter the internal methods of other object.

Page 25: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

25

Example1: When a message (insert new patient) is sent to an object, the internal algorithms needed to respond to the message are hidden from other parts of the system.

Page 26: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

26

Example 2: An IMSTRUCTOR object sends an ENTER GRADE message to an instance of the STUDENT RECORD class. Notice that the IMSTRUCTOR object and STUDENT RECORD class could be reused, with minor modification, in other school information systems where many of the attributes and methods would be similar.

INSTRUCTOR STUDENT RECORD

Message:

ENTER GRADE

Page 27: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

27

The Benefits in Using Object-oriented Approach• The concepts of polymorphism, classes, and inheritance,

taken together, allow system analysts to– break a complex system into smaller, more

manageable components, – work on the components individually, and – easily piece the components back together to form a

system.• This modularity makes system development

– easier to grasp (抓住 ), – easier to share among members of a project team, and – easier to communicate to users who are needed to

provide requirements and confirm how well the system meets the requirements throughout the SDLC.

Page 28: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

28

• The project team is actually creating reusable pieces that can be plugged into other systems’ efforts or can be used as starting for other projects.

• Time is saved because new projects don’t have to start completely from very beginning.

• “Object-think” is a much more realistic way to think about the real world.

• Communicating in terms of objects improves the interaction between user and SAs or developer.

Page 29: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

SummaryConcept What Concept Supports What Concept Leads To

An object A more realistic way for people think about their businessHighly cohesive units that contain both data and processes

Better communication between user and developerReusable objectsBenefits from having a highly cohesive program design

A class A natural way of thinking about objects most things naturally fall into groups and hierarchies

Better communication between user and SA or developer

Inheritance Allows use of classes as standard templates from which other classes can be built

Less redundancyFaster creation of new classesStandards and consistency within and across development effortsEase in supporting exceptions

Polymorphism Minimal messaging that is interpreted by objects themselves

Simpler programming of eventsEase in replacing or changing objects in a systemFewer ripple effects from changes within an object or in the system itself

Encapsulation Loosely coupled units Reusable objectsFewer ripple effects from changes within an object or in the system itselfBenefits from having a loosely coupled program design

Page 30: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

Introduction to UML• Just as structured analysis uses DFDs to model data and

processes, systems analysts use the unified Modeling Language (UML) to describe object-oriented systems.

• In 1990, object concepts were implemented in different ways by several developers. Their have their own methodology and notation. It is difficult for analysts in different organizations to use a common language in developing o-o tools and concepts for companies and universities.

• In 1995, Rational Software brought three industry leaders (Grady Booch, Ivar Jacobson, James Rumbaugh) together to create an approach for o-o development, UML.

• The objective of UML is to provide a common vocabulary (詞匯 ) of object-based terms and diagramming techniques that is rich enough to model any systems development project from analysis through implementation.

• In November 1997, the Object Management Group (OMG) accepted UML as the standard diagramming notation for all Object-oriented development.

Page 31: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

31

• Diagramming Techniques:

UML defines a set of nine object diagramming techniques used to model a system.

Page 32: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

32

Unified Modeling Language Diagrams

Page 33: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

33

• All nine diagramming techniques use the same syntax and notation, making easier for analysis and developers to learn the language.

• The same diagramming techniques are used throughout all phases of the SDLC.

• The diagrams are changed over time to move from the logical design to the physical design and include implementation details of the system.

• UML requires analysts and developers to break the system into use cases, the smaller pieces of the system, and deal with each separately. Therefore, the analysts and designers can focus on small views of the system rather than the entire system.

Page 34: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

34

• The core of UML is formed by four techniques --Use case Diagrams, Sequence Diagrams, Class Diagrams, and Statechart Diagrams.

• Use case diagram summarizes the set of use cases for a logical part of the system.

• Sequence diagrams, class diagrams, and statechart diagrams are used to further define the use cases from various perspectives.

• The order of creating diagrams:1. Use Case Diagram2. Sequence Diagram Class Diagram3. Statechart Diagram

Key Aspects

Page 35: CS206 System Analysis & Design Note 14 By ChangYu 1 Lecture Note 14 Object-Oriented System Analysis And Design Systems Analysis and Design Kendall & Kendall

CS206 System Analysis & Design Note 14 By ChangYu

35

The integration of four UML Diagrams