Object-Oriented Analysis and Design

Size: px
Start display at page:

Download "Object-Oriented Analysis and Design"

Transcription

1 Object-Oriented Analysis and Design Session 2a: Structure Modeling Object-Oriented Analysis and Design 1

2 Outline 1. Objects and Classes 4 2. Basic Association Concepts Class Diagrams and Object (instance) Diagrams Multiplicity constraints on associations Associations as objects Class hierarchies Constraints on associations Aggregations Relationship overview Attribute characterization Object-Oriented Analysis and Design 2

3 Object-oriented Programming Working in an object-oriented language is neither a necessary nor sufficient condition for doing objectoriented programming The most important aspect of OOP is the creation of a universe of largely autonomous interacting agents. But how does one come up with such a system? 3

4 Why Start with Design? Object-oriented thinking begins with object-oriented analysis and design It is the easiest way to see the problems of realistic modern software development Without understanding programming in the large, one cannot appreciate the importance of OOP 4

5 Programming in the Small and Programming in the Large Programming in the small One programmer understands everything from top to bottom. Main problem is the development of algorithms Programming in the large System is developed by a large teams of programmers Main problems are management of details and communication between software subsystems Defines software system in terms of components and interactions among those components 5

6 Importance of Modeling Industry Motivation Software development is complex Academia and industry realize the need for abstraction Specification at various levels of abstraction Specification according to different viewpoints Partial specification 6

7 Software Models What is a software model? A model describes viewpoints of reality It describes complex reality at multiple levels of abstraction Models are NOT documentation 7

8 The Model Driven Development Approach (MDE) Puts models in the center of software development The vision: automatic software development by model transformation 8

9 The Unified Modeling Language (UML) The OMG standard for software specification and design Widely accepted as the standard modeling language 9

10 The UML Visual Languages Use Case Diagrams Use Case Diagrams Activity Diagrams Use Case Diagrams Use Use Case Structure Diagramsand diagrams State Diagrams State Diagrams Class Diagrams State Diagrams State Diagrams Object Diagrams Scenario Diagrams Scenario Diagrams Sequence Diagrams Model State Diagrams State Diagrams State Diagrams Scenario Diagrams Scenario Collaboration Diagrams Diagrams Deployment Diagrams Component Diagrams Component Diagrams Component Diagrams + Object Constraint Language (OCL) 10

11 Class Diagram (Syntax) Association Class 11

12 Class Diagram (Syntax) association end (property) association 12

13 Class Diagram (Syntax) generalization set constraint class hierarchy 13

14 Class Diagram (Syntax) subsetting constraint composition constraint association class 14

15 What is structural modeling? A structural model is a momentary snapshot (view) of a system showing the structure of the objects, their classifiers, relationships, attributes and operation signatures. It shows: The identified abstract entities: Classes, interfaces. The abstract entities internal structure: Attributes. Relationships between the abstract entities: Associations, dependencies, inheritance. It does not show: temporal information Method definitions, processes, threads. Object-Oriented Analysis and Design 15

16 1. Objects and Classes Object-Oriented Analysis and Design 16

17 Object - 1 Object A thing that is meaningful for an application: Proper nouns: Ben-Gurion-University, Moshe. Physical objects: A table, a contract. Abstract objects: An agreement, a sale, an algorithm, a formula, an access permission. A composite object: A list, a table. An object has an identity that distinguishes it from all other objects. An object belongs to a Class, based on: Similarity of structure (attributes). Similarity of behavior (methods). Object-Oriented Analysis and Design 17

18 Object - 2 Visual notation: Possibly named instance (object) figures. Examples: Object-Oriented Analysis and Design 18

19 Object - 3 Examples: Object names are optional! Constraint : Object name can not be repeated for a class (in a specific context) Object-Oriented Analysis and Design 19

20 Class - 1 Class A group of objects (instances) that have common: Properties. Behavior. Relationships to other objects. Semantics. Finding classes in text: Common nouns, noun phrases. Constraint: In the context of a single diagram, a class has a unique name that identifies it! Object-Oriented Analysis and Design 20

21 Class - 2 Visual notation: Class information Example: Class Name Attributes Data type Operations Object-Oriented Analysis and Design 21

22 Class - 4 Class and object visualization is by default incomplete: Having no attributes does not mean that there are no attributes. Having no attribute types does not mean that there are no attribute types. Having no operations.. The only mandatory part is the class name: unique. Responsibility: A specification of the class intention. Always recommended (recall the high cohesion principle!) Understood as a contract or an obligation of a class. As the model is refined the responsibilities are transformed into attributes and operations. Object-Oriented Analysis and Design 22

23 Attributes Attribute: A named property within in a class An attribute is a mapping: Class Value-domain (Data type) Visual notation: Names in the lower part of a class rectangle. Finding attributes in text: adjectives, value abstractions. Constraint: Unique name per class! Object-Oriented Analysis and Design 23

24 Data types and Values Value: A piece of data. No identity. Data type: like an Abstract data type (interface): A set of values + operations. Values might have their own attributes. Finding values in text: Enumerations Examples in problem documentation. Visualization: Object-Oriented Analysis and Design 24

25 Objects vs. Values Objects have identities, can have attributes, operations, and participate in relationships. Two forms of equality: Identity equality. Content equality. Values do not have identities A single form of equality: Value equality Value duplications are indistinguishable. Values - can only be used to form other values, or as the values of attributes and parameters for operations. Object-Oriented Analysis and Design 25

26 Objects vs. Values An object attribute value is a VALUE not an object An element of a data type. To be an object or to be a value, that is the question Depends on the application (one application values may become an object in another application): In a library system Date is probably a data type. Its elements are values. In a calendars translation system Date is probably a class. Its elements are objects. Object-Value heuristic rule: If it s important it s an object! Object-Oriented Analysis and Design 26

27 Terminology A Class is a set of objects (instances) A Data type is a set of data values An Attribute is a mapping from a class into a data type. Object-Oriented Analysis and Design 27

28 2. Basic Association Concepts Object-Oriented Analysis and Design 28

29 Link and Association concepts - 1 Link conceptual or physical connection between objects A link is (denotes) a tuple A binary link is a pair. A ternary link is a triplet, etc. Visual notation: Possibly labeled line among objects. The label is the name of the association to which the link belongs. Object-Oriented Analysis and Design 29

30 Link and Association concepts - 2 Association A group of links with common structure and common semantics : Links among objects from the same classes and with the same structure (similar properties) Visual notation : Possibly labeled line among classes. Object-Oriented Analysis and Design 30

31 Link and Association concepts - 3 The line label is the name of the association It is optional (but mandatory for multiple associations among classes) Associations are not directed! Finding Associations in text: verbs. Constraint: The name of an association between a set of classes is unique! Object-Oriented Analysis and Design 31

32 Classes and Associations A link is an instance of an association. A link is not a value. A link is not an object: No identity. Analogy: Association link Class object Object-Oriented Analysis and Design 32

33 Associations vs. Attributes - 1 Novice modelers (especially with DB experience) tend to overuse attributes instead of associations. Associations are the essence of object-oriented modeling. Connections between objects are always modeled as links. Attributes provide additional (secondary) information about identified objects. Attribute heuristic rule: If it s important it s not an attribute! Object-Oriented Analysis and Design 33

34 Link and Association concepts: Roles - 1 A role is a relation between a class in an association the association A role denotes the role of the class in the association. It provides a (conceptual) direction on the association. A (binary) association has exactly two roles. A role has a name. Object-Oriented Analysis and Design 34

35 Link and Association concepts: Roles - 2 Visual notation: The role name is marked as a label on the class edge in the association line. Role names are used in the Object Constraint Language (OCL) for traversing associations: aflightdescription.origin accesses the origin airport. aflightdescription.destination accesses the destination airport. Object-Oriented Analysis and Design 35

36 Link and Association concepts: Roles - 3 Role names function as pseudo-attributes Should be distinguished from the attributes of the origin class: A role B role If the name of a class adequately describes its role, you may omit role names. DriverLicense.Owner The class name is used as the role name, if needed. Object-Oriented Analysis and Design 36

37 Link and Association concepts: Roles - 4 Constraint: Role names are mandatory in ambiguous situations: 1. Multiple nameless associations between classes. 2. Multiple roles for a single class in an association. aperson.parent accesses the parents of a person. aperson.child accesses the children of a person. The parent-child association is cyclic (recursive). Describes hierarchical instance structures (directed graphs). Object-Oriented Analysis and Design 37

38 Roles vs. Objects - 1 Roles should not be confused with objects. Example: Consider: A person has exactly two parents and any number of children. Question: Are Person, Parent, Child roles or objects? Answer: Person is a class; parent, child are roles in a parent-child recursive association on Person. Correct Model Wrong Model Object-Oriented Analysis and Design 38

39 Roles vs. Objects - 2 To be a role or to be an object, that is the question depends on the application (one application roles may become another application objects). Object-Role heuristic rule: It s an object only if it is an entity characterization! Think if you wish to characterize it with attributes and associations. Otherwise, it s a role in an association! In most applications: Person is a characterization of people. Parent, child are not characterizations of entities : a child can be a parent. a parent can be a child. But in a school application Parent and Child might be appropriate classes. Object-Oriented Analysis and Design 39

40 Roles vs. Objects - 3 Examples: Consider: A Flight Description has an Origin Airport and Destination Airport. Question: Are Flight Description, Airport, Origin Airport, Destination Airport roles or objects? Answer: In standard airports: Flightdescription, Airport are classes; destination, origin are roles in flightdescriptionairport associations between flightdescription and Airport. Consider: A Sale Transaction has a Seller and a Buyer. Question: Are Sale Transaction, Seller, Buyer roles or objects? Answer:??? Object-Oriented Analysis and Design 40

41 3. Class Diagrams and Object (instance) Diagrams Object-Oriented Analysis and Design 41

42 Class diagrams: Syntax - 1 A class diagram is a visual specification of UML class level concepts. It includes: Classes, associations, attributes, roles, multiplicity constraints, and more. Alternative names: Object model, class model. Object-Oriented Analysis and Design 42

43 Class diagrams: Syntax - 2 Syntactically correct class diagram : An association line connects only class figures, not associations. No class name repetitions No association name repetitions among same classes. Mandatory role-name constraints. No attribute name repetitions within a class. And more Object-Oriented Analysis and Design 43

44 Class diagrams: Syntax - 3 A class diagram describes (constrains) possible realities (worlds). Such a world consists of: classes which are sets of objects. associations which are (are) sets of links (object tuples). attributes which are mappings. data types which are sets of data values. roles which are relations between associations and classes. and more class level data level Object-Oriented Analysis and Design 44

45 Class diagrams: Syntax - 4 Possible worlds: W1: Classes: Airport = {AOU, JAH}; City = {Houston}; Associations: Serves = {(AOU, Houston), (JAH, Houston)}; Attributes: city name(houston) = Houston ; W2: Classes: Airport = {}; City = {c1, c2}; Associations: Serves = {}; Attributes: city name(c1) = Tel-Aviv ; W3: Classes: Airport = City = {}; Associations: Serves = {}; W4: Question: How many worlds are there? Object-Oriented Analysis and Design 45

46 Class diagrams: Syntax - 5 A possible world of a class diagram consists of: An instantiation : For all classes, associations, and attributes in the diagram Only for classes, associations, and attributes in the diagram It should satisfy all constraints imposed in the diagram. Every symbol/figure has an instantiation! Only symbols/figures in the diagram have instantiations! All constraints hold! Object-Oriented Analysis and Design 46

47 Class diagrams: Semantics The semantics (meaning, denotation) of a class diagram is the set of worlds that it describes. A world that is described by a class diagram can be empty all classes are empty; non-empty some classes are non-empty; finite all classes are finite; infinite some classes are infinite. Intended worlds: Finite non-empty. The UML specification: does not provide formal semantics. Enormous research efforts (academic and industry). Object-Oriented Analysis and Design 47

48 Instance (Object) diagrams: Syntax - 1 An instance diagram is a visual specification of UML instance (data) level concepts. It includes : Instances, links, attributes values, roles. attributes data values objects links An instance diagram visualizes a non-empty and finite world. Empty means that it includes no objects no diagram! Infinite means that it includes an infinite number of objects: Diagrams cannot be visualized! Object-Oriented Analysis and Design 48

49 Instance (Object) diagrams: Syntax - 2 Syntactically correct instance diagram: An object (instance) cannot be repeated each instance figure stands for a different object. Instance names cannot be repeated within a class. A link line connects instances. A link cannot be repeated. Different links between same objects must belong to different associations. Attribute values are data values not objects. Object-Oriented Analysis and Design 49

50 Instance (Object) diagrams: Usage Instance diagrams are always used relatively to a class diagram. They are used for: Analyzing the intended application by demonstrating the worlds that can be described by the class diagram. Validating a class diagram by testing whether the worlds described by the class diagram meet the intentions of the designer. Object-Oriented Analysis and Design 50

51 Instance (Object) diagrams: Terminology An instance diagram instantiates/populates a class diagram An instance diagram is an instance of a class diagram if it instantiates only elements from the class diagram: Classes, associations, attributes An instance diagram is a legal instance of a class diagram if it is an instance and it satisfies all constraints imposed by the class diagram Object-Oriented Analysis and Design 51

52 Instance (Object) diagrams: Examples - 1 For the class diagram: The instance diagram: is a legal instance It visualizes the world: W 1 : Classes: Airport = {AOU, JAH}; City = {Houston}; Associations: Serves = {(AOU, Houston), (JAH, Houston)}; Attributes: cityname(houston) = Houston ; Object-Oriented Analysis and Design 52

53 Instance (Object) diagrams: Examples - 2 For the class diagram: The instance diagram: is a legal instance It visualizes a portion of the W 1 world: No Airport objects are visualized. No attributes of the City object are visualized. Note: The object name is not part of the described world objects are nameless. They exist by virtue of their identities. In the instance diagram, every object figure stands for an object identity. Names are added just for convenience of user references. Object-Oriented Analysis and Design 53

54 Instance (Object) diagrams: Examples - 3 For the class diagram: The instance diagram: is not a valid instance diagram Object-Oriented Analysis and Design 54

55 Instance (Object) diagrams: Examples - 4 For the class diagram: A syntactically incorrect instance: A legal instance: It visualizes the world: Classes: Person = {john, fred}; Associations: parent-child = {(john, john), (john, fred)}; This is a legal not-intended instance! The class diagram is too weak to enforce the designer intentions! Object-Oriented Analysis and Design 55

56 Instance (Object) diagrams: Consistency A class diagram is satisfiable (consistent) if it has a non-empty legal instance. A class diagram is strongly satisfiable if it has a nonempty legal instance that populates all classes (no empty classes). Later on we will see examples of unsatisfiable class diagrams. Ideally, CASE tools should: either reject such diagrams as semantically incorrect ones, or correct (provide advice) such diagrams. or reject and advice as to how to correct such diagrams. Object-Oriented Analysis and Design 56

57 Class & instance diagrams : the logic analogy UML static diagrams are sentences in a visual language. UML diagram logic symbols: visual figures language symbols syntax: class diagram universally quantified equality/implication formulae x, y( serves( x, y) Airport ( x) City( y)) x z( City( x) cityname( x, z))... Object-Oriented Analysis and Design 57

58 Class & instance diagrams : the logic analogy syntax: UML diagram instance diagram logic data assertions semantics: instantiation structure (interpretation) consistency: possible world model/world legal instance diagrams Airport ( HOU ) Airport ( JAH ) City( Houston) serves( HOU, Houston) serves( JAH, Houston) cityname( Houston," Houston")... Object-Oriented Analysis and Design 58

59 4. Multiplicity constraints on associations Object-Oriented Analysis and Design 59

60 Multiplicity constraints on associations - 1 A multiplicity constraint specifies the number of instances that can be related through links in the association, to a single instance of an associated class. Notations: * 0 or more: min=0, max= infinity. 1 exactly 1: Min=max=1 1..* 1 or more: Min=1, max=infinity or 1: Min=0, max= between 2 to 4: Min=2, max=4. 5 exactly 5: Min=max=5. 2,4 2 or 4. Object-Oriented Analysis and Design 60

61 Multiplicity constraints on associations - 2 Object-Oriented Analysis and Design 61

62 Multiplicity constraints on associations - 3 Multiplicity constraints refer to class diagrams. They are meaningless for instance diagrams: The 2 links must instantiate 2 different associations. Object-Oriented Analysis and Design 62

63 Multiplicity constraints on associations - 4 Existence dependency: An exactly 1 multiplicity implies existential dependency between objects: Deletion of an owner implies deletion of its driver license. Object-Oriented Analysis and Design 63

64 Multiplicity constraints on associations - 5 Multiplicity constraints do not involve attribute values: What is the meaning of this diagram? Draw a legal but unintended instance diagram. Draw an illegal but intended instance diagram. Object-Oriented Analysis and Design 64

65 Object-Oriented Analysis and Design 65 Multiplicity constraints on associations - 6 Multiplicity constraints can be expressed in logic: ) )), ( ), ( ) ( ((,, ))), ( ( ) ( ( 2 1 z x y z r y x r y C z y x y x r y x C x A minimum constraint requires existential quantification. A maximum constraint requires universal quantification.

66 Multiplicity constraints on associations - 7 An unsatisfiable class diagram has either an empty or an infinite legal instance diagrams: A legal instance has the structure of a directed binary tree, where every node has: exactly one incoming edge (the child). exactly two outgoing edges (the parents). an infinite structure! Object-Oriented Analysis and Design 66

67 Qualified Associations -1 A qualifier is a means for disambiguating the objects in a many role: A qualifier can be an attribute or a role A qualifier selects among the target objects. Not qualified: Qualified: b, a1, a2, n ( (Bank(b) & Account(a1) & accountnumber(a1, n) & r(b, a1) & Account(a2) & accountnumber(a2, n) & r(b, a2) ) a1 = a2) Object-Oriented Analysis and Design 67

68 Qualified Associations -2 A qualified association is more informative: Reduces multiplicity. Implies direction for traversing the association. Usually affects only the maximum bound. Object-Oriented Analysis and Design 68

69 Association classes - 1 An association class is an association whose links have identities. They can participate in other associations An association class is both: A Class. An Association. Object-Oriented Analysis and Design 69

70 Association classes - 2 The link identities derive from the identities of the related instances. Association classes add an extra constraint: A single instance of the association between any 2 instances of the associated class - the regular association constraint! An association class can have attributes. Object-Oriented Analysis and Design 70

71 Association classes : Examples - 1 Authorization in a relational DBMS: A user may own multiple tables. The owner of a table may authorize 1 or more other users access to the table. An authorized user may grant more permissions. Example: A owner of T. B, C are grantees for T by A, the grantor. B can authorize D, E, etc. Object-Oriented Analysis and Design 71

72 Association classes : Examples - 1 * * Preferred model with association class Degraded model with ordinary class Drawbacks of the regular class model: 1. Symmetric dependencies between Authorization and the User and Table classes. 2. grantee-table association and its unique multiplicity dependency on grantor is lost. 3. No traversal path for reading the diagram. Object-Oriented Analysis and Design 72

73 Association classes : Examples - 1 Does any class model (of the two given) capture all the requirements? Here are the requirements again: 1. The user may own multiple tables. 2. The owner of a table may authorize 1 or more other users access to the table. 3. An authorized user can grant more permissions. Requirements 2 and 3 are not fully enforced! Why? To see that provide a legal instance diagram that does not meet the requirements. or rewrite the class diagrams in logic and provide a model that does satisfy the requirements. Object-Oriented Analysis and Design 73

74 Association classes : Examples - 3 Employment association (a): Employment association (b): Object-Oriented Analysis and Design 74

75 Association classes : Examples - 3 In (a), every person can be employed only once in a single company! (why?) In (b), a person can work for the same company several times. Note the changes in the multiplicity constraints. Object-Oriented Analysis and Design 75

76 Association classes : Examples - 4 Compare the following : (a): (b): (a) is not appropriate if people can work for the same company in several different periods. (b) states the reasonable situation: A single person has a single level for a given skill. Object-Oriented Analysis and Design 76

77 6. Class Hierarchies Object-Oriented Analysis and Design 77

78 Class Hierarchies : Classification Class Hierarchy is a new kind of relationship between classes: It relates a class (the super-class) with some of its sub-classes. Class Hierarchy organizes classes by: Similarity. Differences. Class Hierarchy arises either from generalization or from specialization (sub-typing): Generalization -- a bottom-up notion. Specialization -- a top-down notion. Object-Oriented Analysis and Design 78

79 Class Hierarchies : Classification Size of a sub-classes group is greater or equal to 1. Object-Oriented Analysis and Design 79

80 A Class Hierarchy Without Grouping Size of each sub-classes group is equal to 1. Object-Oriented Analysis and Design 80

81 Class Hierarchy : Semantics - 1 A class hierarchy denotes the subset relation between the involved classes: Stock, Bond, insurance are subsets of FinancialInstrument FixedRateBond, VariableRateBond are subsets of Bond In logic: b (Bond(b) Finantialinstrument(b)) Object-Oriented Analysis and Design 81

82 Class Hierarchy : Semantics - 2 The subset semantics implies : Inheritance A subclass inherits from its superclasses their attributes, associations, operations, state-charts Class hierarchy is transitive - A class hierarchy specification associates a single direct super-class with each subclass, but possibly multiple non-direct super-classes. Object-Oriented Analysis and Design 82

83 Class Hierarchy Group Annotations - 1 Generalization Set Constraints: Incomplete Complete Disjoint Overlapping Dynamic. Object-Oriented Analysis and Design 83

84 Group Annotations 4 Generalization Constraints. Built-in generalization constraints: {incomplete} {complete} {disjoint} {overlapping} Object-Oriented Analysis and Design 84

85 Group Annotations 5 Generalization constraints in logic : Complete : Incomplete : Disjoint : Overlapping : x( Person( x) Man( x) Woman( x)) x( Person( x) Man( x) Woman( x)) x( Man( x) Woman( x)) x( Man( x) Woman( x)) Overlapping and disjoint semantics is ambiguous. can refer to: the intersection of all subclasses in the group non-liberal. the intersection of every two subclasses in the group mildly-liberal. the intersection of some two subclasses in the group liberal. Object-Oriented Analysis and Design 85

86 Group Annotations 6 Abstract and Concrete Classes. A concrete class can have direct instances. concrete An abstract class no direct instances. abstract Object-Oriented Analysis and Design 86

87 Kinds of Class Hierarchies - 1 Simple class hierarchy: A class is a sub-class of at most a single class hierarchy construct. Implies single inheritance. A tree structure class diagram. Entity-relationship modeling supports only simple class hierarchies. Complex class hierarchies: A class might have multiple direct super-classes. Implies multiple inheritance. A Directed Acyclic Graph (DAG) class diagram. Multiple inheritance might lead to contradictions. Requires policies for resolving inheritance contradictions. Object-Oriented Analysis and Design 87

88 Kinds of Class Hierarchies - 2 Simple class hierarchy: Restricted expressivity: In reality objects might have multiple categorization and multiple responsibilities: e.g., FullTime-Consultant, Local-Car, Student-Employee, Supported by all Object-Oriented programming languages. Complex class hierarchies: Real world compatible expressivity. Not supported by some Object-Oriented programming languages. Requires methods for transforming complex hierarchies into simple ones. Object-Oriented Analysis and Design 88

89 Removing complex class hierarchies - 1 Multiple inheritance from a single ancestor with different discriminators: Managerial status Employment status Removing multiple inheritance by factoring: Managerial status Employment status Employment status Object-Oriented Analysis and Design 89

90 Removing complex class hierarchies - 2 Multiple inheritance without a common ancestor: Removing multiple inheritance by subclass fragmenting: Object-Oriented Analysis and Design 90

91 Removing complex class hierarchies - 3 Multiple inheritance without a common ancestor: Removing multiple inheritance by replacing generalization with exclusive-or associations: Object-Oriented Analysis and Design 91

92 Association cycles within class hierarchies Example: Directed graph. Consists of nodes and edges. Each edge connects 2 nodes. An edge has a direction. Left : Directed graphs with at most a single edge between 2 nodes edges are captured by the Branch Node association. Right : Any directed graph. Object-Oriented Analysis and Design 92

93 Association cycles within class hierarchies Observing an instance diagram can help selecting a desired class diagram. Object-Oriented Analysis and Design 93

94 Association cycles within class hierarchies Instance diagram for left mode : Instance diagram for right mode : Object-Oriented Analysis and Design 94

95 Association cycles within class hierarchies Evaluation: Right diagram: More complex. Both Nodes and Edges are conceived as objects. Left diagram: Simpler. Direct correspondence to the graph model. The left diagram provides a structural enforcement of the constraint: At most a single edge between any two nodes. Object-Oriented Analysis and Design 95

96 Association cycles within class hierarchies Another directed graph. This graph cannot be represented by the left model. Instance diagram for right mode : Object-Oriented Analysis and Design 96

97 סיכום: Hierarchy Multiplicity Constraint and Class Advisor 1..* Employment 1 +employee +employer University Master PhD Class: Advisor and University Association: Employment Cardinality Constraint Legal Instance: mari : Advisor Class Hierarchy employment rami : Advisor rami : Master +employee employment +employee +employer +employer BGU : University Source: Efficient Methods for Solving Finite Satisfiability Problems in UML Class Diagrams, Mira Balaban and Azzam Maraee. SEPL Seminar, 97

98 Class Diagram: Generalization Set Concept Female Advisor Male {overlapping, {disjoint, {overlapping,incomplete} incomplete} Master 1..* Employment 1 University +employee +employer jame : Advisor Master PhD mari rami : Master, : Master PhD +employee employment +employer BGU : University 98

99 היררכיה של מחלקות: )5( Group Annotations Complete : Incomplete : Disjoint : Overlapping : ביטוי לוגי של אילוצי הכללה: x( Person( x) Man( x) Woman( x)) שהוא לא x( Person( x) Man( x) Woman( x)) x( Man( x) Woman( x)) x( Man( x) Woman( x)) או למעשה זו אמירה ולא אילוץ : אין מה לכתוב וגם למעשה זו אמירה ולא אילוץ: אין מה לכתוב או שהוא, או שהוא שלם לא שלם מחלקות זרות חפיפה מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים( מרצה - ד"ר גיא לשם 99

100 Inconsistency Emptiness disjoint 100

101 Infinity Problem Consider the pervious example: 1 Advisor +advisor Advise 2 +ma Master PhD 101

102 Infinity Problem (2) +advise john : Advisor +advise advise +advise +ma mari : Master +advise advise +advice advise +ma sharon : Master +advise advise +ma +ma +ma +ma frank : Master jack : Master rami : PhD sami : Master +advsie +aadvise +advsie +aadvise +advise +advise +advsie +aadvise advise +ma : Master advise +ma : Master advise +ma : Master advise +ma : Master advise +ma shreen : Master advise +ma michael : Master advise +ma : Master advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie advise +ma : Master +aadvise advise +ma : Master +advsie +aadvise advise +ma advise +ma : Master : Master 102

103 7. Constraints on Associations Object-Oriented Analysis and Design 103

104 Constraints on associations: exclusive-or:4 What is the preferred model? Object-Oriented Analysis and Design 104

105 member manager Constraints on associations: inclusion-1 Association inclusion means inclusion of the link sets. x, y( manager( x, y) member( x, y)) Does association inclusion extend UML expressivity? Answer: NO (why?) Object-Oriented Analysis and Design 105

106 Constraints on associations: inclusion-2 Association inclusion constraints are popular especially in the presence of class hierarchies, where the association of a sub-class provides more specific information. Object-Oriented Analysis and Design 106

107 8. Aggregations Object-Oriented Analysis and Design 107

108 Aggregation - 1 Aggregation : is an association between a class the assembly to its parts the component classes. Visual Notation: Object-Oriented Analysis and Design 108

109 Aggregation - 2 The aggregation relation is singled out in UML as a special kind of association. Aggregation is transitive. The transitive closure of an assembly is the full set of its parts. Aggregation is anti-symmetric. Aggregation is not ordered. Different aggregation assemblies are not visualized. May be marked/commented Object-Oriented Analysis and Design 109

110 Recursive Aggregation Creates Tree or DAG structures of unbounded depth. Object-Oriented Analysis and Design 110

111 Physical and Logical Aggregations - 1 Logical (catalog) Aggregation a component can be used in multiple assemblies. Physical (composition) Aggregation a component belongs to at most a single assembly. UML offers two kinds of aggregation notations: Logical (catalog) aggregation Physical (composition) aggregation denoted: denoted: Examples: A concrete car vs. a car model. The Program aggregation physical or logical? Object-Oriented Analysis and Design 111

112 Physical and Logical Aggregations - 2 The instances of a physical aggregation are trees. The instances of a logical aggregation are Directed Acyclic Graphs (DAGs). The instances of a recursive aggregation have unbounded depth. Tree aggregation can support: Propagation of properties. Default values. DAG aggregation requires resolution of clashes. Object-Oriented Analysis and Design 112

113 Physical and Logical Aggregations - 3 Logical elements exist independently of physical ones. Object-Oriented Analysis and Design 113

114 Physical and Logical Aggregations - 4 A catalog part may belong to multiple assemblies and contain multiple parts. A catalog part is identified by its role in the assembly. A physical part may belong to at most a single assembly and contain multiple parts. There might be indistinguishable catalog parts (like nail kinds). The Contains associations has a quantity attribute for quantifying these parts. Object-Oriented Analysis and Design 114

115 9. Relationships Overview Object-Oriented Analysis and Design 115

116 Relationships reviewed in UML All relationships are visualized by lines between classes. Sub-typing / generalization (in class hierarchies). Denoted by a solid line and an empty arrow. Instantiation. Denoted by a dashed line labeled <<instance>>. Association. Denoted by a solid line. Aggregation. Denoted by a solid line ended with a solid or empty diamond. Object-Oriented Analysis and Design 116

117 Sub-typing\Generalization Not inter-object relationships! They distinguish: Similarities and differences. Emphasize different aspects of instances. An OR grouping. Involve classes alone. Important during design, for reuse. Eliminate duplications. Object-Oriented Analysis and Design 117

118 Instantiation Instantiation: Involves an object and a class. Mixture of class diagram and instance diagram elements. Generalization Instantiation Object-Oriented Analysis and Design 118

119 Association Association: Describes relationships (links) among instances. Adds information beyond a class boundary. Important during analysis. Generalization Association Object-Oriented Analysis and Design 119

120 Association vs. Sub-typing Association: Do not confuse subclasses with roles: Subclasses Specialization. Roles Usage. Use generalization only when there are attributes or associations to distinguish: there are clear sub-types! Clear sub-types Usage Object-Oriented Analysis and Design 120

121 Aggregation Aggregation: A special kind of association between a whole and a part. An AND grouping relates different objects that together compose an assembly. Generalization Aggregation Object-Oriented Analysis and Design 121

122 10. Attribute Characterization Object-Oriented Analysis and Design 122

123 Class level attributes and operations - 1 A class attribute/operation refers to the class itself as an object. It can take one of two roles: 1. Characterize the class as an object: Average age of employees. Update/management operations. 2. Can stand for a property whose value is common to all instances of the class: Interest rate of all accounts of a common type. The location of BGU buildings. The origin country of all French cars. Object-Oriented Analysis and Design 123

124 Class level attributes and operations - 2 Class attributes/operations are not recommended! A better modeling: Add a new class of which the older class is an instance. Discouraged Model Preferred Model Object-Oriented Analysis and Design 124

125 Attribute Values 1: Multiplicity Attribute multiplicity specifies the possible number of values for an attribute of an object. This specification is relevant mainly for database purposes (persistent classes). Object-Oriented Analysis and Design 125

126 Attribute Values 2: Key Constraints A Key Constraint on a class (candidate key) is a minimal combination of attributes whose values uniquely identify objects of a class. This specification is relevant mainly for database purposes (persistent classes). Object-Oriented Analysis and Design 126

127 Attribute Values 3: Key Constraints A Key Constraint on an association is a minimal combination of roles and qualifiers that uniquely identify links of the association. {CK =(Semester.id, Professor.id, Course.name) } A course with a given name is given by at most a single professor, in a given semester. Object-Oriented Analysis and Design 127

128 Attribute Values 4: Key Constraints CK = (Product.catalogNo, City.name) } A product is sold by at most a single sales person, in a given city. Key constraints take the role of multiplicity constraints for non-binary associations. Object-Oriented Analysis and Design 128

129 Attribute Values 5: Domains A domain (Type) is a named set of possible values for an attribute. It has associated operations. Domain values do not participate in associations. A domain can be described in different ways: Intentionally: ODD = { n / n in NAT, n/2 not in NAT } Extensionally (enumeration domain): PriorityType = {NORMAL, URGENT, INFORMATIONAL } Structured: {PhoneNumber} a set of phone numbers. Date = < year: YEAR, month: MONTH, day: DAY > Object-Oriented Analysis and Design 129

130 Attribute Values 6: Domains An attribute can be followed by: Key indication. multiplicity indication. domain indication. default value. Object-Oriented Analysis and Design 130

131 Derived Attributes Derived data is information that can be calculated from other elements in a diagram: For a flightdescription: scheduledarrivaltime = scheduleddeparturetime + scheduledduration. Visual notation: a preceding slash: /scheduledarrivaltime Object-Oriented Analysis and Design 131

132 Derived Attributes Derived associations are also denoted using a preceding slash: Derived association: Object-Oriented Analysis and Design 132

133 1. התפתחות של דיאגרמת מחלקות (Evolution Of Class Diagrams) מתרכז בהתפתחות של דיאגרמת מחלקות לאורך מחזור החיים של פיתוח התוכנה מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 133

134 התפתחות של דיאגרמת מחלקות תרשימי המחלקות משתנים במהלך )סטטים( במהלך תהליך הפיתוח. ואינם החיים מחזור נשארים קבועים ישנם 3 מבטים של אותם דיאגרמת מחלקות שתואמים לשלבים של מחזור החיים. השלבים עליהם נדבר: ניתוח,)analysis( עיצוב )design( ומימוש.)implementation( ההבטים של,)Conceptual( איפיון דיאגרמת המחלקות עליהם נתייחס הם: התפיסה.)Implementation( והמימוש )Specification( (מודל כללי שמתרכז ביישויות מרכזיות במערכת הקשרים בניהם) Conceptual Analysis מתרכז בהוספת תכונות למחלקות, ובמחלקות הנדרשות למע ( Specification Design ' ) (משקף את הקוד של המע ' בצורתו הסופית ( Implementation Implementation עד עכשיו עסקנו במבט התפיסתי level( )conceptual של המע' לידי ביטוי בדיאגרמת המחלקות. כפי שבה מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 134

135 שלושה מבטים של דיאגרמת המחלקות מבט ברמה התפיסתית )קונספטואלית(: דיאגרמת המחלקות מתארת את התפיסתיות, את המחלקות המרכזיות בתחום הבעיה. הקשרים )associations( בין המחלקות באים לידי ביטוי במובן מתמטי שלהם, כלומר אוסף של לינקים )בשלב זה אין התייחסות למימוש(. מבט ברמת האפיון )ספציפיקציה(: התרשים מתאר את הממשקים של התוכנה, עדין אין מימוש. הקשרים בין המחלקות מתארים אחריות ובעצם את השרותים שמספקים אותם ממשקים. עדין אין התייחסות למבנה האובייקט כפי שיבוא לידי ביטוי בסוף התהליך. בשלב זה הקשרים בין המחלקות כבר מוכוונים, כלומר מעדנים אותם יחסית לרמה הקונספטואלית. מבט ברמת המימוש: דיאגרמת המחלקה מספקת לנו את המבנים למימוש, כלומר את מבנה האובייקטים כפי שיופיעו בקוד. הקשרים בין המחלקות השונות הופכים למעשה להיות הצבעות לאובייקטים אחרים מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 135

136 דוגמא לשלושת המבטים של דיאגרמת המחלקות ברמה התפיסתית רואים את דיאגרמת המחלקות בתצורה שעד עכשיו דיברנו עליה: את המחלקות: order,.customer, orderline את הקשרים בין המחלקות. ברמת המימוש אנו מדברים על מבנה את האילוצים. המחלקה כפי שיובא לידי ביטוי בקוד: ברמת האיפיון רואים את הממשקים שיש Class Order { למחלקה שנוצרו כתוצאה מאותם קשרים בין Private Customer customer; אם נסתכל על הקשר בין Order ל- customer נקבל המחלקות :(association) Class Order { את ה- customer בצורה של משתנה רפרנס. Private Vector orderlines; את הקשר בין Order ל- orderlines נקבל בצורה של Vector שבא לידי ביטוי בגלל הריבוי, נקבל של רפרנס לאובייקטים מסוג.orderLines } Class Customer { Private Vector orders; אם נסתכל על המחלקה Customer גם בו נקבל וקטור בגלל הריבוי של ההזמנות, } Public Customer customer(); אם נסתכל על הקשר ל- Customer הוא הופך למעין ממשק שאמור להביא את הלקוח הרלוונטי שקשור להזמנה. public Enumeration orderlines(); אם נסתכל על הקשר ל- orderlines נראה רשימה )enumeration( שאמורה להיות קשורה לאותה הזמנה. } המשתנה orders וה- Vector נובע בגלל הריבוי של הקשר בין Customer לבין.orders מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 136

137 שלושת המבטים של דיאגרמת המחלקות )navigation( של נתייחס לקשרים )associations( שלושת המבטים: ולכיווניות ברמה התפיסתית הקשרים )associations( אינם מוכוונים, כאשר הקשרים בין האובייקטים הינם ממודלים ע"י לינקים שבעצם נאספים לתוך הקשרים. ברמת האיפיון הקשרים )associations( מוכוונים, ובעצם הם מצביעים על צורת הניווט בין האובייקטים ולאחריות שיש לאובייקטים כלפי אובייקטים אחרים. ברמת המימוש הקשרים )associations( באים לידי ביטוי בצורה של משתנים מסוג רפרנס. מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 137

138 מידול של קשרים associations( )Modeling נראה דוגמא למידול של קשרים בשלבי הפיתוח השונים: ניתוח, עיצוב ומימוש: בשלב הניתוח יש את המודל התפיסתי: הכולל את המחלקות city ו- airport והקשר בניהם serves An implementation model Another implementation model במחלקה airport מופיעה שדה בשם cities במחלקה city מופיע משתנה בשם airports שכולל רשימה של שדות תעופה. שכולל רשימה של ערים. אך מגיעים למצב כזה? בשלב העיצוב אותה דיאגרמת איפיון מכילה קשר )association( מוכוון מ- airport ל- city, כלומר airport מכיר את city ולא להיפך. אם כך נכניס ל- airport משתנה מסוג רפרנס שיכיר את,cities למה ברבים? בגלל אילוצי הריבוי *..0. בשלב העיצוב אותה דיאגרמת איפיון מכילה קשר )association( מוכוון מ- city ל- airport, כלומר city מכיר את airport ולא להיפך. אם כך נכניס ל- city משתנה מסוג רפרנס שיכיר את,airports למה ברבים? בגלל אילוצי הריבוי *..0. בשלב המימוש מופעים שני מודלים אפשרים כתוצאה מהמודל התפיסתי: מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 138

139 1 - קשר תלות )Dependency( ) מבטא את העובדה ששינוי באיפיון של דברdependencyקשר תלות ( מסויים יכול להשפיע על הדבר שמשתמש בו. הכוונה שאלמנטים שונים של מודל שקשורים זה לזה, לדוגמא,דבר מחלקות. A class takes an object of another class as a parameter אם יש שינוי במחלקה Course זה יכול להשפיע על המחלקה CourseSchedule זאת מכיון ש- CourseSchedule משתמשת במתודות שלו )לדוגמא: )add, remove באובייקטים של.Course כלומר שינוי במתודות או משתנים שהם public של המחלקה Course יכול להשליך על משתנים במחלקה.CourseSchedule מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 139

140 2 - קשר תלות )Dependency( דוגמא נוספת: כאשר מחלקה או אובייקט מסויים מנסים לגשת לאובייקט של מחלקה אחרת, למשל. Windowו- Event אך הוא יכול לגשת לאובייקט של מחלקה אחרת? (, במקרה כזה שינויclose, openלמשל ע"י הצהרה על אותו אובייקט בתוך אחת המתודות )לדוגמא יכול להשליך על שינוים public באחת המתודות שלו או באחד המשתנים שהם Eventבמחלקה. Windowבמחלקה A class accesses an object of another class דוגמא נוספת: כאשר מחלקה מסויימת )לדוגמא )Dean תנסה לקרוא למתודה של מחלקה אחרת )לדוגמא.)Student שינויים במתודה של מחלקה אחרת, למשל שינוי של שם, פרמטרים או של ערך מוחזר יכולים לגרום לשינויים במחלקה שקוראת. A class calls a class operation in another class מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 140

141 2. ממשקים (Interfaces) מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 141

142 1 ממשקים )Interfaces( ) שבד"כ נוצר בשלב ADTמהו בעצם ממשק או מנשק? ממשק הוא טיפוס נתונים מופשט ( העיצוב. שכולל בתוכו קבוצה של מאפיינים לקבוצה של שרותים שאמורים "חוזה" ממשק הוא מעין להינתן ע"י מחלקות שמתחייבות לאותו ממשק. אותו ממשק הוא בעצם סיכום או הקבצה של שרותים שיכולים להינתן או שהם שותפים למס' אובייקטים ממחלקות שונות. המימוש של כל אחד מהשרותים ע"י המחלקות השונות יכול להיות בצורה שונה, יחד עם זאת השימוש באותם שרותים ע"י מחלקות אחרות צריך להתבצע בצורה אחידה. הממשק לא מספק מימוש. הממשק לא מספק מבנה. ) ישירים. ) instances : שאין להן מופעים ( abstract הממשק דומה מאוד למחלקות מופשטת ) לממשק יש שני סוגי מחלקות שקשורות אליו: מחלקות מממשות שלוקחות את התפקיד של אותו ממשק, ומממשות את השרותים השונים שנמצאים באותו ממשק. מחלקות לקוחות אותן המחלקות שמשתמשות או סומכות על כך שקיימים השרותים השונים המסופקים ע"י הממשק. מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 142

143 ממשקים )Interfaces( 2 דוגמא מ- JAVA על שימוש בממשקים :)interface( הגדרה: ממשקים )interfaces( הם רכיבים בתוכנית שמהווים מעין "הצהרת כוונות". כאשר מחלקה מכריזה שהיא מממשת ממשק, אפשר לדעת שהיא מממשת את כל השיטות המוזכרות באותו הממשק. למשל: אם ניצור ממשק שיכיל הצהרה על שיטה שמדפיסה את האובייקט, נוכל לדעת שכל מחלקה שמממשת את הממשק, מממשת את השיטה הזאת )אחרת היא לא תעבור הידור(, אך עם זאת - לא ניתן לדעת איך מומשה השיטה. תכונות הממשק: ממשק יכול להכיל אך ורק משתנים קבועים או שיטות ריקות. השיטות שמכיל הממשק חייבות להיות עם הרשאת,public והן יכולות להיות מופשטות.)abstract( מחלקה יכולה לממש ממשקים רבים. אם מחלקה מכריזה על מימוש של ממשק כלשהו - היא חייבת לממש את כל השיטות בו. מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 143

144 3 ממשקים )Interfaces( דוגמא: יש את הקשר )association( בין אוניברסיטה )University( : לסטודנט )Student( על פי רמת האיפיון. ברמה התפיסתית: יש קשר רבים לרבים בין סטודנט לאוניברסיטה, והאוניברסיטה יכולה לראות הרבה סטודנטים. שאובייקטים להגדיר נרצה אובייקטים של לאוסף לגשת אוסף של סוג באיזה להחליט של מסוג נרצה האיפיון: ברמת צריכים אוניברסיטה שנרצה הסטודנט להשתמש. מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 144

145 4 ממשקים )Interfaces( נראה דוגמא לעיצוב שהוא פחות טוב, שבו רואים שסטודנט יכול לראות מס' אוניברסיטאות, והאוניברסיטה רואה אוסף של סטודנטים במקרה זה הוא של Hashset )מחלקה זו מתארת מבנה נתונים שמיישם את Set וממומש אותה באמצעות המחלקה אחרת(. במקרה זה האוניברסיטה תלויה בממשק של Hashset בממשק אחד מסוים, עדין אנו ברמה מופשטת שלא תכפה מימוש כזה או אחר וגמישה לשינויים. מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 145

146 5 ממשקים )Interfaces( צורה אחרת של מידול, שבו האוניברסיטה משתמשת באיזה שהוא ממשק שנקרא. המשמעות היא אוסף של מתודות ופעולות שהאוניברסיטה יכולה לעשות על Student-Set לאוניברסיטה זה לא משנה. Hash או Treeאוסף של סטודנטים. האוסף יכול להיות בצורת, כלומר כל student-set-interface מבצע מימוש של student-set-tree הסימון מסביר ש- student-set-tree. יגדרו גם ב- student-set-interface הפעולות שמוגדרות ב- לכן כשהאוניברסיטה תרצה לפנות לאוסף מסוג כלשהו, היא תפנה לקבוצת הפעולות, ומכיון שהקבוצות שממשות את אותו ממשק יכללו את student-set-interfaceשקיימות ב- הפעולות האלה, זה לא משנה לאובייקט של אוניברסיטה אך יהיה המימוש מכיון שהיא פונה (. Interfacesאך ורק דרך אותו ממשק ( זה מאפשר להחליף את המימוש בצורה קלה, כי שומרים על אותו ממשק, וזה מאפשר גמישות בקבלת ההחלטה, ולא חייבים לקבל את ההחלטה בתחילת תהליך הפיתוח. מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 146

147 ממשקים )Interfaces( 6 ממשקים )Interfaces( הם במע' כאשר: אמצעי מרכזי כדי להשיג מודולריות המודולריות יכולה להיות בין השכבות כל שכבה תספק קבוצה של ממשקים כדי לתקשר אתה. המודולריות יכולה להיות בתוך השכבות למשל בשכבת התחום,)domain( או בשכבת היישום. גם במקרה זה אפשר לספק ממשק פנימי )כמו בדוגמא הקודמת: אוניברסיטה - אוסף של סטודנטים(. הממשק מקשר תלויים, כאשר: שכבות, בין מודולים, אובייקטים בלתי שהם מספק הפרדה בין המבט החוצה לבין המבט פנימה. הלקוח של מודול מסוים רואה רק את הממשק, המימוש לא מעניין אותו ולכן האינטגרציה בין אותו לקוח ובין אותו מימוש נעשית קלה יותר. ההפרדה בין המבט החיצוני למבט הפנימי מאפשרת הפרדה בין הלקוחות שדורשים שרותים כמו האוניברסיטה לבין המימוש, כמו שראינו קודם לכן:.student-Hashset מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 147

148 3. חבילות (Packages) נעסוק בחבילות בתוך מודל שמשמשות לצורך אירגון המודל מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 148

149 חבילות (Packages( חבילה היא קבוצה של אלמנטים עבור דיאגרמת מחלקות, האלמנטים יכולים להיות מחלקות,)aggregations( קשרי הכלה,)generalizations( קשרי הורשה,)associations( קשרים,)classes( חבילות אחרות.)packages( הרעיון שבכל חבילה יהיה קו מקשר, שיהיה בלכידות גבוה cohesion( )high עם החלקים שמרכיבים את אותה חבילה. במקרה זה אנו מדברים על מחלקות, קשרים, אלמנטים מבניים, יחד עם זה חבילות )packages( יכולות להכיל גם אלמנטים התנהגותיים כדוגמת דיאגרמות.sequence כאשר.packages packages על מדברים כאשר נדבר על קשרים בין של צימוד נמוך מסויים, packages )low coupling( להיות צריכה מחלקה מוגדרת רק בחבילה אחת ולא במס' חבילות. חבילה להכיל יכולה אלמנטים מסוגים שונים שמות של יחודיות לאלמנטים השונים אותו בתוך נרצה שהקשרים יהיו כמה שיותר מינימאלים, כדי לעמוד בעיקרון בצורה זו נוכל להחליף חבילה בחבילה חדשה בצורה קלה. )מחלקות, קשרים,...(. ירושות חבילות )packages( רקורסיבית. להיות יכולות הררכיות, כלומר packages להכיל יכול packages בצורה אחר )namespace( החבילה )package( עם אותו שם נותנת בחבילות שונות. מרחב שמות החלקים לכל להגדיר ניתן לכן בתוכו, מחלקות מרצה - ד"ר גיא לשם מכללת אשקלון הנדסת תוכנה א' )ניתוח ועיצוב מונחה אובייקטים ) 149

תוכנה 1 * לא בהכרח בסדר הזה

תוכנה 1 * לא בהכרח בסדר הזה תוכנה 1 תרגול 7: מנשקים, פולימורפיזם ועוד * לא בהכרח בסדר הזה 2 מנשקים מנשקים מנשק )interface( הוא מבנה תחבירי ב- Java המאפשר לחסוך בקוד לקוח. מנשק מכיל כותרות של מתודות המימוש שלהן. )חתימות( ללא קוד אשר

More information

מבוא למדעי המחשב תרגול 8 רשימה משורשרת כללית, Comparator

מבוא למדעי המחשב תרגול 8 רשימה משורשרת כללית, Comparator מבוא למדעי המחשב 2017 תרגול 8 רשימה משורשרת כללית, Comparator בתרגול היום. LinkedList בניית ההכללה מ- LinkIntList תרגול המבנה ושימושיו ממשקים: Comparator Sorted Linked List ל- LinkedList ע"י שימוש ב- Comparator

More information

תוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes

תוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes תוכנה 1 תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes class Outer { static class NestedButNotInner {... class Inner {... מחלקות מקוננות NESTED CLASSES 2 מחלקה מקוננת Class) )Nested

More information

- מבחן. - 4 עבודות ב- JAVA. הגשה בזוגות דרך ה- System Submission

- מבחן. - 4 עבודות ב- JAVA. הגשה בזוגות דרך ה- System Submission 1 - מבחן. - 4 עבודות ב- JAVA 60% 40% הגשה בזוגות דרך ה- System Submission 2 UML Class Diagrams Packages Class Path JAR Files חלק ראשון: חלק שני: 3 An abstraction of software features A structure that singles

More information

תרשים המחלקות ותרשים העצמים

תרשים המחלקות ותרשים העצמים 1 תרשים המחלקות ותרשים העצמים חלק שלישי: ניתוח ועיצוב מערכות מידע באמצעות שימוש ב- UML ומתודולוגיית ה- Process )UP( Unified E1 3 E2 2 Outline UML Introduction Class Diagram Class Association Self association

More information

תוכנה 1 * לא בהכרח בסדר הזה

תוכנה 1 * לא בהכרח בסדר הזה תוכנה 1 תרגול 7: מנשקים, פולימורפיזם ועוד * לא בהכרח בסדר הזה 2 מנשקים מנשקים - תזכורת מנשק )interface( הוא מבנה תחבירי ב- Java המאפשר לחסוך בקוד לקוח. מנשק מכיל כותרות של מתודות )חתימות(. מימוש דיפולטיבי

More information

הנכות 1 םוכיס לוגרת 13 1

הנכות 1 םוכיס לוגרת 13 1 תוכנה 1 סיכום תרגול 13 1 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים במנשק הם תמיד מופשטים וציבוריים public interface MyInterface { public abstract int foo1(int i); int foo2(int i); The modifiers

More information

מצליחה. 1. int fork-bomb() 2. { 3. fork(); 4. fork() && fork() fork(); 5. fork(); printf("bla\n"); 8. return 0; 9. }

מצליחה. 1. int fork-bomb() 2. { 3. fork(); 4. fork() && fork() fork(); 5. fork(); printf(bla\n); 8. return 0; 9. } שאלה : (4 נקודות) א. ב. ג. (5 נקודות) הגדירו את המונח race-condition במדוייק לא להשמיט פרטים. ספקו דוגמא. (5 נקודות) מהו? Monitor נא לספק הגדרה מלאה. ( נקודות) ( נקודות) ציינו כמה תהליכים יווצרו בקוד הבא

More information

תוכנה 1 * לא בהכרח בסדר הזה

תוכנה 1 * לא בהכרח בסדר הזה תוכנה 1 תרגול 7: מנשקים, פולימורפיזם ועוד * לא בהכרח בסדר הזה 2 מנשקים מנשקים מנשק )interface( הוא מבנה תחבירי ב- Java המאפשר לחסוך בקוד לקוח. מנשק מכיל כותרות של מתודות המימוש שלהן. )חתימות( ללא קוד אשר

More information

תוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes בית הספר למדעי המחשב אוניברסיטת תל אביב

תוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes בית הספר למדעי המחשב אוניברסיטת תל אביב תוכנה 1 תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes בית הספר למדעי המחשב אוניברסיטת תל אביב 1 2 STATIC VS. DYNAMIC BINDING 3 Static versus Dynamic Binding public class Account

More information

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model. Chapter 6: Entity-Relationship Model The Next Step: Designing DB Schema Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common

More information

תוכנה 1 סמסטר א' תשע"א

תוכנה 1 סמסטר א' תשעא General Tips on Programming תוכנה 1 סמסטר א' תשע"א תרגול מס' 6 מנשקים, דיאגרמות וביטים * רובי בוים ומתי שמרת Write your code modularly top-down approach Compile + test functionality on the fly Start with

More information

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes. Chapter 6: Entity-Relationship Model Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common data organization model The Relational

More information

משתנים שעור מס. 2 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1

משתנים שעור מס. 2 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 משתנים שעור מס. 2 דרור טובי דר' כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 תפקיד המשתנים הצהרה על משתנה השמת ערך במשתנה int a, b, c; a = 1234; b = 99; c = a + b; משתנים מאפשרים לנו לשמור

More information

תוכנה 1 ומחלקות פנימיות

תוכנה 1 ומחלקות פנימיות תוכנה 1 Design Patterns ומחלקות פנימיות תרגול 11: 1 Design Patterns A general reusable solution to recurring design problems. Not a recipe A higher level language for design Factory, Singleton, Observer

More information

UML Class Model Abstract Syntax and Set-Based Semantics

UML Class Model Abstract Syntax and Set-Based Semantics UML Class Model Abstract Syntax and Set-Based Semantics Mira Balaban and Azzam Maraee Computer Science Department Ben-Gurion University of the Negev, ISRAEL mira,mari@cs.bgu.ac.il March 31, 2017 The class-model

More information

Basic Structural Modeling. Copyright Joey Paquet,

Basic Structural Modeling. Copyright Joey Paquet, Basic Structural Modeling Copyright Joey Paquet, 2000 1 Part I Classes Copyright Joey Paquet, 2000 2 Classes Description of a set of objects sharing the same attributes, operations and semantics Abstraction

More information

Class modelling (part 2)

Class modelling (part 2) Class modelling (part 2) Fabrizio Maria Maggi Institute of Computer Science (these slides are derived from the book Object-oriented modeling and design with UML ) Qualified Associations What is the meaning

More information

Class modelling (part 2)

Class modelling (part 2) Class modelling (part 2) Fabrizio Maria Maggi Institute of Computer Science (these slides are derived from the book Object-oriented modeling and design with UML ) Qualified Associations What is the meaning

More information

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model.

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model. E-R Model Hi! Here in this lecture we are going to discuss about the E-R Model. What is Entity-Relationship Model? The entity-relationship model is useful because, as we will soon see, it facilitates communication

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java

Object-Oriented Software Engineering Practical Software Development using UML and Java Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes Lecture 5 5.1 What is UML? The Unified Modelling Language is a standard graphical

More information

Database Design with Entity Relationship Model

Database Design with Entity Relationship Model Database Design with Entity Relationship Model Vijay Kumar SICE, Computer Networking University of Missouri-Kansas City Kansas City, MO kumarv@umkc.edu Database Design Process Database design process integrates

More information

הנכות 1 םוכיס לוגרת 13 1

הנכות 1 םוכיס לוגרת 13 1 תוכנה 1 סיכום תרגול 13 1 בחינה באופק! הבחינה תכלול את כל הנושאים שכיסינו במהלך הסמסטר: כל ההרצאות כל תרגולים כל תרגילי בית חומר סגור שאלות אמריקאיות 2 קצת על מנשקים מנשק יכול להרחיב שירותים במנשק הם תמיד

More information

2004 John Mylopoulos. The Entity-Relationship Model John Mylopoulos. The Entity-Relationship Model John Mylopoulos

2004 John Mylopoulos. The Entity-Relationship Model John Mylopoulos. The Entity-Relationship Model John Mylopoulos XVI. The Entity-Relationship Model The Entity Relationship Model The Entity-Relationship Model Entities, Relationships and Attributes Cardinalities, Identifiers and Generalization Documentation of E-R

More information

Algorithms. Intro2CS week 5

Algorithms. Intro2CS week 5 Algorithms Intro2CS week 5 1 Computational problems A computational problem specifies an inputoutput relationship What does the input look like? What should the output be for each input? Example: Input:

More information

XV. The Entity-Relationship Model

XV. The Entity-Relationship Model XV. The Entity-Relationship Model The Entity-Relationship Model Entities, Relationships and Attributes Cardinalities, Identifiers and Generalization Documentation of E-R Diagrams and Business Rules Acknowledgment:

More information

הקלחמ ה תמרב ת ונ וכ ת (static members ) יליזרב דהוא Java תפשב ם דקת מ תונכת ביבא ל ת תטיסרבינוא

הקלחמ ה תמרב ת ונ וכ ת (static members ) יליזרב דהוא Java תפשב ם דקת מ תונכת ביבא ל ת תטיסרבינוא ת כו נו ת ברמת ה מחלקה (static members) אוהד ברזילי תכנות מ תקד ם בשפת Java אוניברסיטת ת ל אביב static keyword שדות המוגדרים כ static מציינים כי הם מוגדרים ברמת המחלקה ולא ברמת עצם כל העצמים של אותה מחלקה

More information

Tutorial 10. Introduction to C++ שימו

Tutorial 10. Introduction to C++ שימו Introduction to ++ שימו תרגול זה אינו התרגול הרישמי של הקורס. הוא מבוסס על חוברת התרגולים אך מכיל שינויים, הסברים נוספים ודוגמאות שונות או נוספות. + + תוכנ ית רא שונה ב הכרו ת עם + + תרגול // First ++

More information

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models CS 494 Object-Oriented Analysis & Design UML Class Models Overview How class models are used? Perspectives Classes: attributes and operations Associations Multiplicity Generalization and Inheritance Aggregation

More information

ASP.Net Web API.

ASP.Net Web API. ASP.Net Web API 1 מה זה? Web API View בלבד ולא Data אותו מממש השרת והוא מחזיר לקליינט API הוא Web API הבקשה והתשובה הן בפרוטוקול Http\Https הקליינטים של Web API יכולים להיות רבים : אפשר להשתמש גם בMVC

More information

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects,

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects, Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects, Classes, Class Diagrams Values and Attributes Operations

More information

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN NOTES ON OBJECT-ORIENTED MODELING AND DESIGN Stephen W. Clyde Brigham Young University Provo, UT 86402 Abstract: A review of the Object Modeling Technique (OMT) is presented. OMT is an object-oriented

More information

תוכנה 1 תרגול מספר 13

תוכנה 1 תרגול מספר 13 1 תוכנה 1 תרגול מספר 13 ו- HashCode Equals עוד על טיפוסים מוכללים )Advanced Generics( חריגים )Exceptions( בית הספר למדעי המחשב אוניברסיטת תל אביב 1 2 ו- HASHCODE EQUALS 3 תזכורת: המחלקה Object package

More information

תוכנה 1 תרגול מספר 13

תוכנה 1 תרגול מספר 13 1 2 תוכנה 1 תרגול מספר 13 ו- HashCode Equals עוד על טיפוסים מוכללים )Advanced Generics( ו- HASHCODE EQUALS חריגים )Exceptions( בית הספר למדעי המחשב אוניברסיטת תל אביב 1 3 4 package java.lang; תזכורת: המחלקה

More information

מבוא למדעי המחשב השפעת השינוי על סטודנט הרצאה 18: פולימורפיזם ומחלקות אבסטרקטיות אם ברצוננו ששכר הלימוד לא יעלה על 2500.

מבוא למדעי המחשב השפעת השינוי על סטודנט הרצאה 18: פולימורפיזם ומחלקות אבסטרקטיות אם ברצוננו ששכר הלימוד לא יעלה על 2500. public class { private static final int COURSE_PRICE = 1000; private String nae; private int id; private int nuofcourses; מבוא למדעי המחשב הרצאה 18 פולימורפיזם ומחלקות אבסטרקטיות תזכורת public (int id,

More information

Chapter 2: Entity-Relationship Model

Chapter 2: Entity-Relationship Model Chapter 2: Entity-Relationship Model! Entity Sets! Relationship Sets! Design Issues! Mapping Constraints! Keys! E-R Diagram! Extended E-R Features! Design of an E-R Database Schema! Reduction of an E-R

More information

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E) THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E) 2 CHAPTER 7 OUTLINE Using High-Level, Conceptual Data Models for Database Design Entity-Relationship (ER) model Popular high-level conceptual

More information

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables Entity-Relationship Modelling Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables 1 Entity Sets A enterprise can be modeled as a collection of: entities, and

More information

תכנות מונחה עצמים משחקים תשע"ו

תכנות מונחה עצמים משחקים תשעו move semantics 1 תכנות מונחה עצמים ופיתוח משחקים תשע"ו סמנטיקת ההעברה semantics( )Move move semantics 2 מטרה האצה של התוכניות, שיפור בביצועים על ידי חסכון בבנייה והעתקה של אובייקטים זמניים move semantics

More information

Full file at

Full file at Modern Database Management, 10e (Hoffer/Ramesh/Topi) Chapter 2 Modeling Data in the Organization 1) Data modeling may be the most important part of the systems development process because: A) data characteristics

More information

הנכות 1 םוכיס לוגרת 14 1

הנכות 1 םוכיס לוגרת 14 1 תוכנה 1 סיכום תרגול 14 1 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים במנשק הם תמיד מופשטים וציבוריים public interface MyInterface { public abstract int foo1(int i); int foo2(int i); The modifiers

More information

הנכות 1 םוכיס לוגרת 13 1

הנכות 1 םוכיס לוגרת 13 1 תוכנה 1 סיכום תרגול 13 1 בחינה באופק! הבחינה תכלול את כל הנושאים שכיסינו במהלך הסמסטר: כל ההרצאות כל תרגולים כל תרגילי בית חומר סגור שאלות אמריקאיות 2 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים

More information

CMPT 354 Database Systems I

CMPT 354 Database Systems I CMPT 354 Database Systems I Chapter 2 Entity Relationship Data Modeling Data models A data model is the specifications for designing data organization in a system. Specify database schema using a data

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 4 Enhanced Entity-Relationship (EER) Modeling Slide 1-2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes all modeling concepts of basic ER Additional concepts:

More information

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science Lesson 11 INTRODUCING UML W.C.Udwela Department of Mathematics & Computer Science Why we model? Central part of all the activities We build model to Communicate Visualize and control Better understand

More information

Related download: Instructor Manual for Modern Database Management 12th Edition by Hoffer Venkataraman Topi (Case studies included)

Related download: Instructor Manual for Modern Database Management 12th Edition by Hoffer Venkataraman Topi (Case studies included) Modern Database Management Test Bank, 12e (Hoffer) Completed download: https://testbankarea.com/download/modern-database-management-12thedition-test-bank-hoffer-venkataraman-topi/ Related download: Instructor

More information

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques Fundamentals, Design, and Implementation, 9/e Three Schema Model ANSI/SPARC introduced the three schema model in 1975 It provides a framework

More information

Unified Modeling Language (UML)

Unified Modeling Language (UML) Appendix H Unified Modeling Language (UML) Preview The Unified Modeling Language (UML) is an object-oriented modeling language sponsored by the Object Management Group (OMG) and published as a standard

More information

Graph Database, think different!

Graph Database, think different! Graph Database, think different! Written by Roni Licher Winter 2014-2015 236363 - Database Systems - Technion Nodes Edges (directed or not) Properties Neo4j and Cypher 4j Graph database (Like SQL server

More information

0. Database Systems 1.1 Introduction to DBMS Information is one of the most valuable resources in this information age! How do we effectively and efficiently manage this information? - How does Wal-Mart

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model, 7th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity

More information

Object-Oriented Systems Analysis and Design Using UML

Object-Oriented Systems Analysis and Design Using UML 10 Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design, 8e Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall Learning Objectives Understand

More information

MIS Database Systems Entity-Relationship Model.

MIS Database Systems Entity-Relationship Model. MIS 335 - Database Systems Entity-Relationship Model http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Database Design Main concepts in the ER model? ER Diagrams Database Design

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes 5.1 What is UML? The Unified Modelling Language is a standard graphical language

More information

ER modeling. Lecture 4

ER modeling. Lecture 4 ER modeling Lecture 4 1 Copyright 2007 STI - INNSBRUCK Today s lecture ER modeling Slides based on Introduction to Entity-relationship modeling at http://www.inf.unibz.it/~franconi/teaching/2000/ct481/er-modelling/

More information

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : , Course Code : MCS-032 Course Title : Object Oriented Analysis and Design Assignment Number : MCA (3)/032/Assign/2014-15 Assignment Marks : 100 Weightage : 25% Last Dates for Submission : 15th October,

More information

COSC 3351 Software Design. An Introduction to UML (I)

COSC 3351 Software Design. An Introduction to UML (I) COSC 3351 Software Design An Introduction to UML (I) This lecture contains material from: http://wps.prenhall.com/esm_pfleeger_softengtp_2 http://sunset.usc.edu/classes/cs577a_2000/lectures/05/ec-05.ppt

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A G R A M S ) WHAT IS CLASS DIAGRAM? A class diagram

More information

Enhanced Entity-Relationship (EER) Modeling

Enhanced Entity-Relationship (EER) Modeling CHAPTER 4 Enhanced Entity-Relationship (EER) Modeling Copyright 2017 Ramez Elmasri and Shamkant B. Navathe Slide 1-2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes

More information

הנדסת תוכנה 11. מבוא לתבניות תיכון. se15b-yagel 1

הנדסת תוכנה 11. מבוא לתבניות תיכון. se15b-yagel 1 הנדסת תוכנה 11. מבוא לתבניות תיכון se15b-yagel 1 מה היום? מבוא לתבניות תיכון Design Patterns הדגמה כולל BDD ו- Refactoring לפי הזמן, השלמת בקרת תצורה: Git Workflows בהמשך: עקרונות תיכון מונחה עצמים עבודה

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) The Entity Relationship Model Lecture 2, January 15, 2014 Mohammad Hammoud Today Last Session: Course overview and a brief introduction on databases and database systems

More information

Entity-Relationship Model

Entity-Relationship Model Entity-Relationship Model Data Models High-level or conceptual data models provide concepts that are close to the way many users perceive data, whereas low-level or physical data models provide concepts

More information

MTAT Introduction to Databases

MTAT Introduction to Databases MTAT.03.105 Introduction to Databases Lecture #4 Entity-Relationship Modelling Ljubov Jaanuska (ljubov.jaanuska@ut.ee) Lecture 3. Summary So far we have been dealing with a relational database (PCA.db)

More information

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data. Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting

More information

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques Fundamentals, Design, and Implementation, 9/e Three Schema Model ANSI/SPARC introduced the three schema model in 1975 It provides a framework

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Essentials of Database Management (Hoffer et al.) Chapter 2 Modeling Data in the Organization

Essentials of Database Management (Hoffer et al.) Chapter 2 Modeling Data in the Organization Essentials of Database Management (Hoffer et al.) Chapter 2 Modeling Data in the Organization 1) The logical representation of an organization's data is called a(n): A) database model. B) entity-relationship

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

SOFTWARE ENGINEERING UML FUNDAMENTALS. Saulius Ragaišis.

SOFTWARE ENGINEERING UML FUNDAMENTALS. Saulius Ragaišis. SOFTWARE ENGINEERING UML FUNDAMENTALS Saulius Ragaišis saulius.ragaisis@mif.vu.lt Information source Slides are prepared on the basis of Bernd Oestereich, Developing Software with UML: Object- Oriented

More information

מערכים שעור מס. 4 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1

מערכים שעור מס. 4 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 מערכים שעור מס. 4 דרור טובי דר' כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 למה מערכים? ברצוננו לאחסן בתוכנית ציוני בחינה כדי לחשב את ממוצע הציונים וסטיית התקן. נניח ש 30 סטודנטים לקחו

More information

תכנות מתקדם בשפת C משתנים

תכנות מתקדם בשפת C משתנים תכנות מתקדם בשפת C משתנים 1 משתנים סוגי משתנים בשפת C ההבדלים בין סוגי המשתנים השונים 2 /* This program computes m to the power of n */ /* Assumptions: m is an integer; n is a positive integer */ #include

More information

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys Chapter 7: Data Modeling Using the Entity- Relationship (ER) Model Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

More information

OMG Modeling Glossary B

OMG Modeling Glossary B OMG Modeling Glossary B This glossary defines the terms that are used to describe the Unified Modeling Language (UML) and the Meta Object Facility (MOF). In addition to UML and MOF specific terminology,

More information

Intro to DB CHAPTER 6

Intro to DB CHAPTER 6 Intro to DB CHAPTER 6 DATABASE DESIGN &THEER E-R MODEL Chapter 6. Entity Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of

More information

Object Modeling. Entity-Relationship (ER) diagrams (1976) Object Modelling Technique (OMT) diagrams (1991)

Object Modeling. Entity-Relationship (ER) diagrams (1976) Object Modelling Technique (OMT) diagrams (1991) Created by Janusz R. Getta, School of Computing and Information Technology, University of Wollongong Building 3, room 2120, ext 4339, jrg@uow.edu.au, http://www.uow.edu.au/ jrg Object Modeling Outline

More information

Communication Networks ( ) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University. Allon Wagner

Communication Networks ( ) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University. Allon Wagner Communication Networks (0368-3030) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University Allon Wagner Kurose & Ross, Chapter 3.5.5, 3.7 (5 th ed.) Many slides adapted from: J. Kurose

More information

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University Metamodeling Janos ISIS, Vanderbilt University janos.sztipanovits@vanderbilt.edusztipanovits@vanderbilt edu Content Overview of Metamodeling Abstract Syntax Metamodeling Concepts Metamodeling languages

More information

Chapter 2 Conceptual Modeling. Objectives

Chapter 2 Conceptual Modeling. Objectives Chapter 2 Conceptual Modeling Basic Entity Relationship Diagrams 1 Objectives Definition of terms Importance of data modeling Write good names and definitions for entities, relationships, and attributes

More information

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1 CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1 E/R: NOT IN BOOK! IMPORTANT: Follow only lecture slides for this topic! Differences

More information

מבוא לתכנות בשפת C. Tzachi (Isaac) Rosen

מבוא לתכנות בשפת C. Tzachi (Isaac) Rosen מבוא לתכנות בשפת C מצביעים והקצאה דינאמית כתובות של משתנים לכל משתנה כתובת של המקום שלו בזיכרון כבר ראינו: שם של מערך הוא למעשה הכתובת של התא הראשון )באינדקס 0( של המערך להזכירכם: תא של מערך הינו משתנה

More information

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Loop through Arrays. Array Creation and Initialization

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Loop through Arrays. Array Creation and Initialization מערכים תוכנה 1 Array: A fixed-length data structure for storing multiple values of the same type Example from last week: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5 6 7 תרגול 2: מערכים

More information

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus UML 2.0 Division of Computer Science, College of Computing Hanyang University ERICA Campus Introduction to UML 2.0 UML Unified Modeling Language Visual language for specifying, constructing and documenting

More information

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram UML Fundamental NetFusion Tech. Co., Ltd. Jack Lee 2008/4/7 1 Use-case diagram Class diagram Sequence diagram OutLine Communication diagram State machine Activity diagram 2 1 What is UML? Unified Modeling

More information

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Array Creation and Initialization. Loop through Arrays

תוכנה 1 מערכים. Array Creation and Initialization. Array Declaration. Array Creation and Initialization. Loop through Arrays מערכים Array: A fixed-length data structure for storing multiple values of the same type תוכנה 1 Example: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5 6 7 odds: 1 3 5 7 9 11 13 15 odds.length

More information

תוכנה 1 3 תרגול מס' מערכים ומבני בקרה

תוכנה 1 3 תרגול מס' מערכים ומבני בקרה תוכנה 1 3 תרגול מס' מערכים ומבני בקרה מערכים Array: A fixed-length data structure for storing multiple values of the same type Example: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5 6 7 odds:

More information

COMP Instructor: Dimitris Papadias WWW page:

COMP Instructor: Dimitris Papadias WWW page: COMP 5311 Instructor: Dimitris Papadias WWW page: http://www.cse.ust.hk/~dimitris/5311/5311.html Textbook Database System Concepts, A. Silberschatz, H. Korth, and S. Sudarshan. Reference Database Management

More information

Class Diagrams in Analysis

Class Diagrams in Analysis 3.2 Subject/Topic/Focus: Introduction to Classes Summary: Conceptual Modeling Notation: Classes Associations: Multiplicity, Roles, Aggregation, Composition Generalization Objects Analysis Process Literature:

More information

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling COSC 304 Introduction to Database Systems Entity-Relationship Modeling Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Conceptual Database Design Conceptual database design

More information

Chapter 2: The Object-Oriented Design Process

Chapter 2: The Object-Oriented Design Process Chapter 2: The Object-Oriented Design Process In this chapter, we will learn the development of software based on object-oriented design methodology. Chapter Topics From Problem to Code The Object and

More information

Entity Relationship Modelling

Entity Relationship Modelling Entity Relationship Modelling Overview Database Analysis Life Cycle Components of an Entity Relationship Diagram What is a relationship? Entities, attributes, and relationships in a system The degree of

More information

היצביט ומ - ןוכית ת וי נבת

היצביט ומ - ןוכית ת וי נבת תבני ו ת תיכון Patterns) (Design תבנ יו ת תיכון - מו טיבציה בחיי היום יום אנחנו מתארים דברים תוך שימוש בתבניות חוזרות: "מכונית א' היא כמו מכונית ב', אבל יש לה 2 דלתות במקום 4" "אני רוצה ארון כמו זה, אבל

More information

Conceptual Data Models for Database Design

Conceptual Data Models for Database Design Conceptual Data Models for Database Design Entity Relationship (ER) Model The most popular high-level conceptual data model is the ER model. It is frequently used for the conceptual design of database

More information

תוכנה 1 בשפת Java נושאים שונים בהורשה רובי בוים ומתי שמרת בית הספר למדעי המחשב אוניברסיטת תל אביב

תוכנה 1 בשפת Java נושאים שונים בהורשה רובי בוים ומתי שמרת בית הספר למדעי המחשב אוניברסיטת תל אביב תוכנה 1 בשפת Java נושאים שונים בהורשה רובי בוים ומתי שמרת בית הספר למדעי המחשב אוניברסיטת תל אביב Today Static vs. Dynamic binding Equals / hashcode String Immutability (maybe) 2 Static versus run-time

More information

Introduction to Software Engineering. 5. Modeling Objects and Classes

Introduction to Software Engineering. 5. Modeling Objects and Classes Introduction to Software Engineering 5. Modeling Objects and Classes Roadmap > UML Overview > Classes, attributes and operations > UML Lines and Arrows > Parameterized Classes, Interfaces and Utilities

More information

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts Chapter Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts Entities and Attributes Entity Types, Value Sets, and Key Attributes Relationships and Relationship

More information

Software Engineering Lab Manual

Software Engineering Lab Manual Kingdom of Saudi Arabia Ministry Education Prince Sattam Bin Abdulaziz University College of Computer Engineering and Sciences Department of Computer Science Software Engineering Lab Manual 1 Background:-

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information