OOAD:class1st

Views:
 
     
 

Presentation Description

No description available.

Comments

By: anithadmello7 (16 month(s) ago)

excellent

Presentation Transcript

Object Oriented Systems Analysis and Design : 

Object Oriented Systems Analysis and Design Babu Ram Dawadi

Books : 

Books Object Oriented Systems Analysis and Design using UML Simon Bennett, Steve McRobb, Ray Farmer Object Oriented Systems Analysis and Design JOEY F. George, Dinesh Batra, JEFFREY A. HOFFER http://web.fsktm.um.edu.my/~saipeck/ http://web.cecs.pdx.edu/~xie/cs300-w10/lecture-notes/ 2 Object Oriented Design Principle

Objectives : 

Objectives A good basic understanding of the concepts of object oriented systems. A method for construction of analyses and designs. Some discussion of the implementation of design. 3 Object Oriented Design Principle

Object-oriented development : 

Object-oriented development Object-oriented analysis, design and programming are related but distinct. OOA is concerned with developing an object model of the application domain. OOD is concerned with developing an object-oriented system model to implement requirements. OOP is concerned with realising an OOD using an OO programming language such as Java or C++. 4 Object Oriented Design Principle

Why Design? : 

Why Design? Design is a process which involves Communication Creativity Negotiation Agreement It is a human process, to produce products for human consumption Object modeling provides a notation which is clear, consistent, and which can be used to communicate within a software development team 5 Object Oriented Design Principle

Objects : 

Objects We begin at the beginning. The world is made of objects. Bank customers, students, cats, elephants, cars, atoms, molecules, tubs of ice cream, stars ….. The world is built of objects. Objects are built of smaller objects. Objects combine to make bigger objects. We already live in an object-oriented world. 6 Object Oriented Design Principle

Object Concept : 

Object Concept Objects can be described by their attributes and operations. Attributes are the changeable characteristics of an object. Operations are the things an object does or can have done to it: Cats can catch mice, eat, miaow, worm up to owners, and be stroked. 7 Object Oriented Design Principle

Object Contd.. : 

Object Contd.. In an object model, all data is stored as attributes of some object. The attributes of an object are manipulated by the operations. In an object model, all functionality is defined by operations Objects may use each other’s operations, but the only legal way one object can manipulate another object is through an operation 8 Object Oriented Design Principle

Object Contd.. : 

Object Contd.. Object modeling is about finding objects, their attributes and their operations, and tying them together in an object model. 9 Object Oriented Design Principle

Class? : 

Class? A class is the structure of an object, meaning the definition of all items that an object is made up of. In reality, an object is an instance of a class A class is made up of two parts: Attributes (often called member data): this is the data that refers to the object's state Methods (often referred to as member functions): these are functions that can be applied to objects 10 Object Oriented Design Principle

What is a Class? : 

What is a Class? A class is a description of a group of objects with common properties (attributes), behavior (operations), relationships, and semantics A class is an abstraction in that it: Emphasizes relevant characteristics 11 Object Oriented Design Principle

Sample class example in JAVA : 

Sample class example in JAVA import java.lang.*; class ClassDemo { public static void main(String args[]) { System.out.println("Hellow World"); }} compile: javac ClassDemo.java java ClassDemo 12 Object Oriented Design Principle

Sample Class : 

a + b = 10 Class Course Properties Name Location Days offered Credit hours Start time End time Behavior Add a student Delete a student Get course roster Determine if it is full Sample Class 13 Object Oriented Design Principle

Representing Classes : 

Professor Professor Clark a + b = 10 Representing Classes A class is represented using a compartmented rectangle 14 Object Oriented Design Principle

Class Compartments : 

Class Compartments A class is comprised of three sections The first section contains the class name The second section shows the structure (attributes) The third section shows the behavior (operations) 15 Object Oriented Design Principle

Classes of Objects : 

Classes of Objects How many classes do you see? 16 Object Oriented Design Principle

Simple Java Program : 

Simple Java Program Import java.lang.*; public class Employee {     private string name;     private int eage; public int getAge()     { return age; } public void setAge(int age)     {          if(age > 60)         {    System.out.println(“age above 60”);         }         else         {             eage = age;         } } public string getName()     { return name; } public void setName(string ename)     {      name = ename;        } } 17 Object Oriented Design Principle

Simple Java Program : 

Simple Java Program Public class SimpleClass { Public static void main(String args[]) { Employee firstEmp = new Employee(); firstEmp.setName("Amr"); firstEmp.setAge("23"); string nme= firstEmp.getName(); int eage= first Emp.getAge(); System.out.println(“the name is: “ + nme); System.out.println(“age is: “ + eage); } } 18 Object Oriented Design Principle

Basic Principles of Object Orientation : 

Basic Principles of Object Orientation 19 Object Oriented Design Principle

What is Abstraction? : 

Manages Complexity What is Abstraction? 20 Object Oriented Design Principle

What is Encapsulation? : 

What is Encapsulation? Hide implementation from clients Clients depend on interface How does an object encapsulate? What does it encapsulate? 21 Object Oriented Design Principle

Encapsulation… : 

Encapsulation… Encapsulation is a way of organizing data and methods into a structure by concealing the way the object is implemented. i.e. preventing access to data by any means other than those specified. Encapsulation therefore guarantees the integrity of the data contained in the object. 22 Object Oriented Design Principle

Encapsulation : 

Encapsulation Object Oriented Design Principle 23 A technique in which data are packaged together with their corresponding procedures. One cake please! Ingredients Directions 2 eggs 4 cups flour 1 cup milk 1 cup sugar etc....... Pre-heat oven to 350; Put milk, eggs, and sugar in 2 quart mixing bowl...

Encapsulation.. : 

Encapsulation.. Encapsulation defines the access levels for elements of that class. These access levels define the access rights to the data, allowing us to access the data by a method of that particular class itself Keyword: Public: functions of all classes may access the data or methods of a class. protected: data access is restricted to functions of inheritance classes. private: data access is restricted to methods of that particular class only 24 Object Oriented Design Principle

What is Modularity? : 

Order Processing System Billing Order Entry Order Fulfillment Manages Complexity What is Modularity? The breaking up of something complex into manageable pieces 25 Object Oriented Design Principle

Slide 26: 

26 Inheritance A mechanism for expressing similarity between things thus simplifying their definition. looks behavior attitudes etc... Person Student Faculty Staff Inheritance

What is Enheritance? : 

What is Enheritance? Often we will find that there are objects which have something in common. It is then useful to create an abstract object which groups together the common features, and to use inheritance to define the original objects. Now we can see from the following that they both have the same operations "arrive" and "meet". 27 Object Oriented Design Principle

Inheritance.. : 

Inheritance.. We can therefore create an abstract creature: which has the common operations. Inheritance means that all the attributes and operations of an abstract object are available in the specialized object below 28 Object Oriented Design Principle

Inheritance : 

Inheritance Now we can enter a debate about whether nose, teeth and appetite are characteristics of all creatures or not. If they are, we can revise the diagram as: 29 Object Oriented Design Principle

Inheritance: Deal : 

Inheritance: Deal Inheritance is considered good for the software re-use and for clarity of description. Let us suppose we now introduce Grandma into our fairy story hierarchy Here we get a Grandma who already had an appetite, nose and teeth and who can arrive and meet. 30 Object Oriented Design Principle

Inheritance : 

Inheritance Now to add circles we simply put in another object under 2D shape. So the circle object need not define the area and position attributes or the get area operation. 31 Object Oriented Design Principle

Example: Single Inheritance : 

Superclass (parent) Subclasses Generalization Relationship Ancestor Descendents Example: Single Inheritance One class inherits from another 32 Object Oriented Design Principle

Example: Multiple Inheritance : 

Airplane Helicopter Wolf Horse FlyingThing Animal Bird multiple inheritance Use multiple inheritance only when needed, and always with caution ! Example: Multiple Inheritance A class can inherit from several other classes 33 Object Oriented Design Principle

What Gets Inherited? : 

What Gets Inherited? A subclass inherits its parent’s attributes, operations, and relationships A subclass may: Add additional attributes, operations, relationships Redefine inherited operations Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy 34 Object Oriented Design Principle

Example: What Gets Inherited : 

Truck tonnage GroundVehicle weight licenseNumber Car owner register( ) getTax( ) 0..* 1 Superclass (parent) Subclass generalization size Example: What Gets Inherited 35 Object Oriented Design Principle

Inheritance Example in Java : 

Inheritance Example in Java 36 class A { String name; int age; public void setName(String nme) {name=nme;} public void setAge(int ag) {age=ag;} } class B extends A { int childno; String spouseName; public void setChildNo(int chno) {childno=chno;} public void setSpouseName(String spName) {spouseName=spName;} public void displayInfo() { System.out.println("Name:"+name); System.out.println("Age:"+age); System.out.println("childNo:"+childno); System.out.println("SpouseName:"+spouseName); } } Object Oriented Design Principle

Inheritance .. : 

Inheritance .. 37 How to Test? Object Oriented Design Principle

A More Formal Definition : 

A More Formal Definition An object is a concept, abstraction, or thing with sharp boundaries and meaning for an application An object is something that has: State Behavior Identity 38 Object Oriented Design Principle

Representing Objects : 

: Professor a + b = 10 ProfessorClark : Professor ProfessorClark Class Name Only Object Name Only Class and Object Name Representing Objects An object is represented as rectangles with underlined names 39 Object Oriented Design Principle

The Relationship Between Classes and Objects : 

Objects Class Professor The Relationship Between Classes and Objects A class is an abstract definition of an object It defines the structure and behavior of each object in the class It serves as a template for creating objects Objects are grouped into classes 40 Object Oriented Design Principle

Hence.. : 

Hence.. Objects are a natural way of representing things. Objects are described by their attributes and their operations. Objects can be organized in inheritance hierarchies. 41 Object Oriented Design Principle

Characteristics of OOD : 

Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves. Objects are independent and encapsulate state and representation information. System functionality is expressed in terms of object services. Objects communicate by message passing. Objects may be distributed and may execute sequentially or in parallel. 42 Object Oriented Design Principle

What is an Attribute? : 

Class Attribute Object Attribute Value What is an Attribute? 43 Object Oriented Design Principle

What is an Operation? : 

Class Operation What is an Operation? 44 Object Oriented Design Principle

What is Polymorphism? : 

What is Polymorphism? The word polymorphism comes from Greek and means having several different forms. Where inheritance is related to classes and (their hierarchy), polymorphism is related to object methods. Overloading polymorphism is where functions of the same name exist, with similar functionality, in classes which are completely independent of each other 45 Object Oriented Design Principle H2O = water, ice, steam (liquid, solid, vapor)

Polymorphism : 

Polymorphism Parametric polymorphism is the ability to define several functions using the same name, but using different parameters Like: The int addition(int,int) method would return the sum of two integers. The float addition(float, float) would return the sum of two floats. The char addition(char, char) would result as the sum of two characters as defined by the author 46 Object Oriented Design Principle

What is Polymorphism? : 

What is Polymorphism? The ability to hide many different implementations behind a single interface One Interface Multiple Forms 47 Object Oriented Design Principle

Polymorphism : 

Polymorphism Object Oriented Design Principle 48 PRINT PRINT PRINT TEXT object GRAPH object IMAGE object

What is an Interface? : 

Realization relationship (stay tuned for realization relationships) What is an Interface? Interfaces formalize polymorphism Interfaces support “plug-and-play” architectures 49 Object Oriented Design Principle

Interface Representations : 

Shape Elided/Iconic Representation(“lollipop”) Canonical (Class/Stereotype) Representation (stay tuned for realization relationships) Interface Representations 50 Object Oriented Design Principle

What is a Package? : 

Package Name What is a Package? A package is a general purpose mechanism for organizing elements into groups A model element which can contain other model elements Uses Organize the model under development A unit of configuration management 51 Object Oriented Design Principle

Relationships: Association : 

Employer Employee Role Names Relationships: Association Models a semantic connection among classes 52 Object Oriented Design Principle

Relationships: Aggregation : 

Whole Aggregation Part Relationships: Aggregation A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts 53 Object Oriented Design Principle

Relationships: Composition : 

Whole Aggregation Part Relationships: Composition A form of aggregation with strong ownership and coincident lifetimes The parts cannot survive the whole/aggregate 54 Object Oriented Design Principle

Association: Multiplicity and Navigation : 

Association: Multiplicity and Navigation Multiplicity defines how many objects participate in a relationships The number of instances of one class related to ONE instance of the other class Specified for each end of the association Associations and aggregations are bi-directional by default, but it is often desirable to restrict navigation to one direction If navigation is restricted, an arrowhead is added to indicate the direction of the navigation 55 Object Oriented Design Principle

Example: Multiplicity and Navigation : 

1 0..* Multiplicity Navigation Example: Multiplicity and Navigation 56 Object Oriented Design Principle Multiplicity specifies how many instances of one class may relate to a single instance of an associated class.

Association: Multiplicity : 

57 Association: Multiplicity Unspecified Exactly one Zero or more (many, unlimited) One or more Zero or one Specified range Multiple, disjoint ranges 1 0..* * 1..* 0..1 2..4 2,4..6

Relationships: Generalization : 

Relationships: Generalization A relationship among classes where one class shares the structure and/or behavior of one or more classes Defines a hierarchy of abstractions in which a subclass inherits from one or more super classes Single inheritance Multiple inheritance Generalization is an “is-a-kind of” relationship 58 Object Oriented Design Principle

Relationships : 

Relationships Objects can be related in other ways than by inheritance and aggregation Any relationship between real world objects can be modeled: cats eat canaries, dogs bite postmen, the woodcutter murders the wolf, cars run over little old ladies, employees work for organizations, patients visit hospitals… 59 Object Oriented Design Principle

One-to-One Relationship : 

One-to-One Relationship one object is associated with exactly one of its related objects. a man marries one woman (at a time) and a woman marries one man (at a time) A cat eats one canary Canaries do not (in general) eat cats, so the eats relationship is one way. 60 Object Oriented Design Principle

One-to-Many Relationship : 

One-to-Many Relationship Sometimes one object can be related to many object. Zero or more suitors court the Princes. 61 Object Oriented Design Principle

Many-to-Many Relationships : 

Many-to-Many Relationships Sometimes objects at either end of a relationship may be related to many objects at the other end. A lubricant is recommended for at least one engine. An engine has at least one lubricant recommended for it. 62 Object Oriented Design Principle

Relationship: Dependency : 

63 Relationship: Dependency A relationship between two model elements where a change in one may cause a change in the other Client Supplier ClientPackage SupplierPackage Client Supplier Class Package Dependency relationship Component Dependency relationship

Strengths of Object Orientation : 

Strengths of Object Orientation A single paradigm Facilitates architectural and code reuse Models more closely reflect the real world More accurately describe corporate data and processes Decomposed based on natural partitioning Easier to understand and maintain Stability A small change in requirements does not mean massive changes in the system under development 64 Object Oriented Design Principle

A simple Sales Order Example : 

65 A simple Sales Order Example Order Product Ship via

Class Diagram for the Sales Example : 

Class Diagram for the Sales Example seller buyer item sold shipping mechanism 66 Object Oriented Design Principle

Effect of Requirements Change : 

Effect of Requirements Change Suppose you need a new type of shipping vehicle ... Salesperson Product Sale Corporate Customer Individual Vehicle seller buyer item sold shipping mechanism 67 Object Oriented Design Principle

Object Models : 

Object Models The process of object-oriented analysis and design is one of elaborating an object model. increasing its detail and scope until enough is known to construct a computer system. 68 Object Oriented Design Principle

Object Model : 

Object Model example is one to describe patient referrals by GP's to specialists. 69 Object Oriented Design Principle

lift system : 

lift system 70 Object Oriented Design Principle

Object Model : 

Object Model The object model is the principal output of an analysis and design process. The object model is the central pillar of an analysis or design. 71 Object Oriented Design Principle

Advantages of OOD : 

Advantages of OOD Easier maintenance. Objects may be understood as stand-alone entities. Objects are potentially reusable components. For some systems, there may be an obvious mapping from real world entities to system objects. 72 Object Oriented Design Principle

Your works: 1st Assignment : 

Your works: 1st Assignment Exercises :Construct an object model for the football league --1 a personnel communication system --2 an automatic washing machine--3 a kitchen --4 A coke factory –5 Teaching of Software class --6 Student examination –7 Bike servicing--8 Noodles factory--9 Medical shop --10 Object Oriented Design Principle 73 Spaghetti preparation –11 Film theater -- 12 An Automatic refrigerator –13 An automatic door lock --14 Finger based attendance --15 Irish based attendance –16 Central Library –17 TV news room—18 College Reception --19 Hotel Reservation --20 Bus ticket reservation --21 Next Monday: Individual 5 Minutes Presentation