Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS585 1/ Principals of Object Orientation OO Analysis Modeling with UML –UML Views User model view Structural view Behavioral view Implementation view.

Similar presentations


Presentation on theme: "CS585 1/ Principals of Object Orientation OO Analysis Modeling with UML –UML Views User model view Structural view Behavioral view Implementation view."— Presentation transcript:

1 CS585 1/ Principals of Object Orientation OO Analysis Modeling with UML –UML Views User model view Structural view Behavioral view Implementation view Environment view Functional View Static View Dynamic View

2 CS585 2/ Principals of Object Orientation

3 CS585 3/ What is an Object? A thing A Visible Thing It has: –Identity –Behavior What the object do and what can be done to it –State – this includes static properties and dynamic values of these properties Structure and behavior of similar objects are defined in a common CLASS.

4 CS585 4/ What is an Object Behavior of objects is achieved via its –Operations and –Methods. The state of an object is realized thought the contents of its data. Objects can communicate via messaging protocols

5 CS585 5/ Object Behavior - Object Life Cycle Handle Request Initialize Object Terminate Object

6 CS585 6/ Principals of OO - Abstraction Abstraction –Denotes the essential characteristics of an object that distinguishes it from all kinds of objects. What does the object do without any implication on how does it do it –A software object is an abstraction A representation of something in the real word like a student, a book, …

7 CS585 7/ Principals of OO - Encapsulation Encapsulation –The process of Compartmentalizing the elements of an object that constitute its structure and behavior Data hiding Localize design decisions –What are the encapsulated elements? Information that describes the object (the things an object know about itself) – No of pages, cover type, ISBN, and other Book information – State, the objects current condition (or state) Behavior – What the object can do (register, drop etc.) – What can be done to it (a pencil object can Write!!) Encapsulation

8 CS585 8/ Principals of OO - Encapsulation Encapsulation –What you need to know to use the object The interface –What you need to know in order to make the object work properly Mechanism to respond to the interface, THE IMPLEMENATION FOR EACH INTERFACE Example –Driving a car! You need to know the ignition, steering, brake, and gas pedal No need to know about the mechanics of the engine, spark plugs, etc.

9 CS585 9/ Principals of OO Modularity –OO is different from Structured Paradigm –In Structured Paradigm module and function are the same –In OO Paradigm Classes and objects are the lowest form of Modularity. A module could have multiple classes

10 CS585 10/ Principals of OO Hierarchy –Ranking of ordering of abstraction Inheritance (is a) –The relationship between classes One class share the structure and behavior of one or more classes Generalization and Specialization

11 CS585 11/ Inheritance Class: Furniture Cost Dimensions Weight Color Object: Chair Chair inherits all attributes and operations of class Furniture Cost Dimensions Weight Color Buy Sell Buy Sell

12 CS585 12/ Principals of OO Polymorphism –The same operation may behave differently on different classes. Example + sign –When an object is substituted with one of its children at run time (The is-a relationship) –Overloading of operations Same operation with different signatures

13 CS585 13/ Principals of OO Identifying Classes –External Entities (devices, people) –Things (reports, forms, Features, Estimates) –Occurrences or Events (Moving) –Roles (Mangers, Engineers, Group, Team) –Places (Loading dock, Shipping Floor) –Structures(Computers)

14 CS585 14/ OO Analysis

15 CS585 15/ OO Modeling OO has its own Modeling Techniques UML – Unified Modeling Language –Grady Booch Method –James Rumbaugh Method –Ivar Jacobson Method

16 CS585 16/ OO Modeling Grady Booch Method –Micro Development Process Defines a set of analysis tasks that are re-applied in the Macro process Identifies classes, objects, and relationships –Macro development Process Refine

17 CS585 17/ OO Modeling James Rumbaugh Method –Object Modeling Technique (OMT) for Analysis, creates: – The object model – objects, classes, and relationships – The dynamic model – objects and system behavior – The Functional Model – DFD like System level design Object level design

18 CS585 18/ OO Modeling Ivar Jacobson Method –Object Oriented Software Engineering –Use Cases Oriented method

19 CS585 19/ The Unified Modeling Language

20 CS585 20/ Provide structure for problem solving Experiment to explore multiple solutions Furnish abstractions to manage complexity Reduce time-to-market for business problem solutions Decrease development costs Manage the risk of mistakes Why do we model?

21 CS585 21/ Tijuana shantytown: http://www.macalester.edu/~jschatz/residential.html The Challenge

22 CS585 22/ Fallingwater: http://www.adelaide.net.au/~jpolias/FLW/Images/FallingWater.jpeg The Vision

23 CS585 23/ Why do we model graphically? Graphics reveal data. 1 bitmap = 1 megaword. –Anonymous visual modeler

24 CS585 24/ The UML is a graphical language for –Specifying, can be used to communicate "what" is required of a system, and "how" a system may be realized. –Visualizing, it can be used to visually depict a system before it is realized –Constructing, can be used to guide the realization of a system similar to a "blueprint". –Documenting, can be used for capturing knowledge about a system throughout its life-cycle the artifacts of software systems What is UML

25 CS585 25/ Added to the list of OMG adopted technologies in November 1997 as UML 1.1 Most recent minor revision is UML 2.0, MDA What is UML

26 CS585 26/ OMG UML Evolution

27 CS585 27/ OMG UML Contributors Aonix Colorado State University Computer Associates Concept Five Data Access EDS Enea Data Hewlett-Packard IBM I-Logix InLine Software Intellicorp Kabira Technologies Klasse Objecten Lockheed Martin Microsoft ObjecTime Oracle Ptech OAO Technology Solutions Rational Software Reich SAP Softeam Sterling Software Sun Taskon Telelogic Unisys …

28 CS585 28/ OMG UML Specification UML Summary UML Semantics UML Notation Guide UML Standard Profiles – Software Development Processes – Business Modeling UML CORBAfacility Interface Definition UML XML Metadata Interchange DTD Object Constraint Language

29 CS585 29/ the Language language = syntax + semantics –syntax = how the symbols should look and how are they combined (i.e words in natural language) –semantics = rules that tells us the meanings of each symbol. UML Notation Guide – defines UMLs graphic syntax UML Semantics – defines UMLs semantics

30 CS585 30/ UML Views User model view –The system from the users perspective. Use-cases Structural model view –Static structure Classes, objects, and relationships Behavioral model view –Dynamic aspect of the system including collaborations between elements identified in the user-model and the structural model views. Implementation model view –Describes the structural and behavioral aspects of the implementation. Environment model view –Shows the actual hardware that is required to implement the solution. UML Analysis Modeling UML Design Modeling

31 CS585 31/ Inter object behavior DiagramUML decomposition dimension Use case diagramFunctional Class diagramStatic Collaboration diagramDynamic Sequence diagramDynamic Intra object behavior StatechartsDynamic UML Diagrams

32 CS585 32/ UML Views Static View Class Diagram Object Diagram Functional View Use Case Diagram Activity Diagram Dynamic View Sequence Diagram Collaboration Diagram State Chart Diagram

33 CS585 33/ UML Views Structural model view –Class Diagram User model view Behavioral model view Implementation model view Environment model view Structural model view or Static View

34 CS585 34/ What is structural modeling? Structural model: a view of a system that emphasizes the structure of the objects, including their classes, relationships, attributes and operations. Used to model the static structure and relationships among the classes of an OO software system A class diagram is made of: –Nodes (Classes and Interfaces) –Links (Relationships) Structural model view or Static View

35 CS585 35/ UML Class Diagram Source for code generation It represents classes, their members, and relationships. It includes: –Attributes –Operations –Stereotypes –Associations –Inheritance –Properties It shows static view Blueprint for building Does not show behavior

36 CS585 36/ UML Class Diagram - Modeling Attributes An Attribute describes a piece of information –Show type of attribute Primitive (Language supplied data type, int, boolean) User defined class (String) –Show visibility - private + public # protected ~ package –Show default value –Show Constraints – Integrity rules –Show static values by underlining the attribute –Example Visibility / attribute Name: Data Type = default value {constraint}

37 CS585 37/ UML Class Diagram - Modeling Operations An operation denotes behavior –Things an object can do and –Things can be done to an object –Show Name –Show arguments – use attribute notation –Show return type – use attribute notation –Visibility ( -,+,#,~ ) –Example + totalOrderAmount (order: Order): Dollar {total >0}

38 CS585 38/ Class Representation in UML class Point { int x,y; public void move (int dx, int dy) { x += dx; y += dy; } Structural model view or Static View Point ~x:int ~y:int +move(dx:int, dy:int)

39 CS585 39/ Object Representation in UML Point p1 = new Point (); p1.x = 0; p2.y=0; p1.move (20,15); P1:Point x =0 y=0 P1:Point x =20 y=15 After sending the move message to p1 object Structural model view or Static View

40 CS585 40 Modeling Relationships With UML Association

41 CS585 41/ Relationships in UML Association –To permit the exchange of messages Associations are the mean for objects to communicate –Default is bi-directional (support messages in either way) –When an object uses the services of another object but does not own it. –Client server Structural model view or Static View

42 CS585 42/ Class Diagram: Association General Binary Relationship Student Course enroll * Faculty Advisee Adviser * 1 teach 1 * Structural model view or Static View

43 CS585 43/ Association Elements - Association Name Association Name –Expresses the purpose of the association (verb) that describes how objects of one type (class) relate to objects of another type (class) A Person owns a Car A Person drives a Car A Person rents a Car –You can show the direction to read the association name Person Car owns Person Car rents Person Car drives

44 CS585 44/ Association Elements - Multiplicity Association Multiplicity –Defines rules on how objects in each class are related –A value can be assigned to each participant in the association –Min..Max –* denotes zero or more –1..* no upper limit Person Car drives 1..1 0..*

45 CS585 45/ Association Elements - Roles Association Roles –Generates code Employee Project participate programmer manager UI Designer

46 CS585 46/ Association Elements - Constraints Association Constraints Person Car drives Must have valid driver license

47 CS585 47/ Association Elements - Class Association Class –Encapsulate the association in a class to include information about the association Customer Product order Order -orderQuantity: int = 0 -orderDate: Date = today -orderTerms: Terms=NULL 0..*

48 CS585 48/ Association Elements - Reflexive Reflexive Association –Objects in the same class can be associated and related to one another –Common for modeling Hierarchies Employee 0..* supervisor subordinates

49 CS585 49/ Association Elements - Qualified Qualified Association –Indexes –The customer uses the order number to lookup the order –Used to reduce multiplicity just like indexes are used to reduce time to search a table Customer places Order -orderQuantity: int = 0 -orderDate: Date = today -orderTerms: Terms=NULL 1..1 orderNo: int

50 CS585 50/ Associations Job Person Manages Company boss worker employee employer 0..1 Job salary

51 CS585 51 Modeling Relationships With UML Inheritance – Specialization and Generalization

52 CS585 52/ Modeling Relationships With UML - Inheritance Inheritance –Not a form of Association (no multiplicity) –Extension Relationship (specialization and generalization) –Extension between two interfaces –Implementation (when a class implements an interface) –UML uses hollow triangle (pointing toward the super class Inheritance –specialization and Generalization –is-a –One class is a specialization of another –The child has all the characteristics of a parent and it might specialize them –Example: A mammal is-a-kind-of Animal A cat is-a-kind-of Animal Structural model view or Static View

53 CS585 53/ Class Diagram: Inheritance Student UndergradGraduate PhDMaster Extension Relationship Interface Implementation Implementation of an Interface is-a Relationship Structural model view or Static View

54 Generalization is-a or type-of Vehicle –Car –Motorcycle –Truck VehicleMotorcycleCarTruck Representation of inheritance A car is-a Vehicle a Truck is-a Vehicle Specialization occurs when sub-classes add additional functionality or override existing ones Structural model view or Static View

55 Generalization - Inheritance Credit Card Class is a subclass of the Bank Card Class Credit Card Class is a specialization of the Bank Card Class Credit Card Class is a Bank Card Class Credit Card Class inherits from the Bank Card Class Credit Card Class is derived from the Bank Card Class Bank Card Debit Card Credit Card Loan Card Credit card is a special kind of card Specialization occurs when sub-classes add additional functionality or override existing ones Inheritance is an implementation of the generalization relationship Bank Card Class is a supper class of the Credit Card Class Bank Card Class is a Generalization of the Credit Card Class Bank Card Class is base/ parent class of the Credit Card Class Structural model view or Static View

56 CS585 56 Modeling Relationships With UML Aggregation and Composition

57 CS585 57/ Relationships in UML- Aggregation & Composition Aggregation (diamond at the owner) –Is a type of Association used to indicate that objects are not independent, rather they (the parts) are assembled or configured together to create another object (the whole) A number of different parts are assembled to create a Car object –One object contains another. –The aggregation class is referred to as the owner, or whole. The aggregated class is the owned, or part. –Example: a window has a drawing area, the drawing area can't stand on its own. Structural model view or Static View

58 CS585 58/ Relationships in UML- Aggregation & Composition Composition (filled in diamond at the owner) –Strong aggregation –the owner is responsible for creating and destroying of the part object. –Composite object that creates its components –Example: an active object with multiple threads of control. –Is used for aggregation where the life span of the part is dependent on the whole. The aggregate has control over the creation and destruction of the parts Aggregation & Composition Modeling –Small diamond at the end of association denotes Aggregation –If diamond is filled its a Composition (Consist of) Structural model view or Static View

59 CS585 59/ Aggregation & Composition Examples Structural model view or Static View Team Player 0..1 9..9 Chess Board Square 1 64 Book Chapter 1 1..*

60 CS585 60/ Composition Structural model view or Static View

61 CS585 61 Modeling Relationships With UML Dependency

62 CS585 62/ Class Diagram: Dependency One operation of a class1 depends on another operation of class2 –Use relationship –Class C1 depends on class C2 if C1 uses C2. In many instances, a client-server relationship exists between two classes. –In such cases, a client-class depends on the server-class in some way and a dependency relationship is established Structural model view or Static View

63 CS585 63/ Relationships in UML Dependency – > Structural model view or Static View

64 CS585 64/ Structural Modeling: Core Relationships Structural model view or Static View

65 CS585 65/ Structural Modeling: Core Relationships (contd) Structural model view or Static View

66 CS585 66/ UML Views User model view Use-cases Structural model view Behavioral model view Implementation model view Environment model view

67 CS585 67 Modeling Requirements with UML Use-Case Diagram User Model view or Functional View

68 CS585 68/ Modeling Requirements With USE-CASES Used to model Requirements Describes the behavior of the system as seen by external entities called actors Each actor represent a role played by a set of external entities that interact with the system Describes what Each use case represent a scenario User Model view or Functional View


Download ppt "CS585 1/ Principals of Object Orientation OO Analysis Modeling with UML –UML Views User model view Structural view Behavioral view Implementation view."

Similar presentations


Ads by Google