1 / 151

Eng. Mohammed Timraz Electronics & Communication Engineer

University of Palestine Faculty of Engineering and Urban planning Software Engineering Department. Software Modeling SWE5441. Lecture 4. Eng. Mohammed Timraz Electronics & Communication Engineer. Outlines. Introduction Static/structural diagram Class diagrams Object diagrams

millicent
Download Presentation

Eng. Mohammed Timraz Electronics & Communication Engineer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. University of Palestine • Faculty of Engineering and Urban planning • Software Engineering Department Software ModelingSWE5441 Lecture 4 Eng. Mohammed Timraz Electronics & Communication Engineer

  2. Outlines • Introduction • Static/structural diagram • Class diagrams • Object diagrams • Package diagrams • Component diagrams • Dynamic/behavioral diagram types • Sequence diagrams • Activity diagrams • A data flow diagram UML Diagrams

  3. Modeling • A way of thinking about the problems using models organized around the real world ideas. • A modeling method comprises a language and also a procedure for using the language to construct models. • Visualize your design and check it against requirements before your crew starts to code.  • A Diagram is the graphical presentation of a set of elements, most often rendered as a connected graph of things and relationships. UML Diagrams

  4. Unified Modeling Language (UML) • Not simply a notation for drawing diagrams, but a complete language for capturing knowledge about a subject and expressing knowledge regarding the subject for the purpose of communication. • It is the result of unifying the information systems and technology industry’s best engineering practices (principals, techniques, methods and tools). UML Diagrams

  5. UML Diagrams • UML diagrams represent two different views of a system model: • Static /Structure diagrams • Dynamic / Behavior diagrams UML Diagrams

  6. UML Diagrams

  7. Static /Structure diagrams • Structure diagrams shows: • The static structure of the system and it's parts on different abstraction and implementation levels. • How they are related to each other. • The elements in a structure diagram represent the meaningful concepts of a system, and may include abstract, real world and implementation concepts. UML Diagrams

  8. Static /Structure diagrams • Class diagrams, • Object diagrams, • Package diagrams, • Component diagrams. UML Diagrams

  9. Class Diagram UML Diagrams

  10. Class Diagram • What is a Class Diagram? • Essential Elements of a UML Class Diagram. • Relationships in class Diagrams. • Class Diagrams Case Study UML Diagrams

  11. What is a Class Diagram? • Class diagrams are the backbone of object oriented analysis and design. • A central modeling technique that runs through nearly all object-oriented methods. • The richest notation in UML. • Class diagrams show: • The classes of the system, • Their inter relationships (including inheritance, aggregation, and association), • The operations and attributes of the classes. UML Diagrams

  12. Essential Elements of a UML Class Diagram • Class, • Attributes, • Operations, • Relationships: • Associations, • Generalization, • Dependency, • Realization, • Constraint Rules and Notes. UML Diagrams

  13. Window size: Sizevisibility: Boolean display()hide() Classes • A class is the description of a set of objects having similar: • Attributes, • Operations, • Relationships, • Behavior. Class Name Attributes Operations UML Diagrams

  14. Relationships Descriptions: • Associations, • Generalization, • Dependency, • Realization, UML Diagrams

  15. Associations • A semantic relationship between two or more classes that specifies connections among their instances. • A structural relationship, specifying that objects of one class are connected to objects of a second (possibly the same) class. UML Diagrams

  16. Association Name Association Works for University Professor Associations Examples • Association shows more significant link between two rows of objects representing a straight line connecting between the grades. • The following example illustrates the working relationship between the university and the professor because the teacher works at the University of UML Diagrams

  17. Association Name Association Manages of Manager Department managed manager Role Names Class Associations Examples The following example illustrates the relationship runs between the Director and the Director of the section because each section runs. UML Diagrams

  18. Factory Product creates Associations Examples Parental relationship between father and son Relationship between plant production and product UML Diagrams

  19. Associations Role name Association name instructor Staff Member Student 1..* instructs * Role Navigable (uni-directional) association Multiplicity * pre - requisites Courses 0..3 Reflexive association UML Diagrams

  20. Associations • To clarify its meaning, an association may be named. • The name is represented as a label placed midway along the association line. • Usually a verb or a verb phrase. Association name Staff Member Student instructs UML Diagrams

  21. Associations • A role is an end of an association where it connects to a class. • May be named to indicate the role played by the class attached to the end of the association path. • Usually a noun or noun phrase. • Mandatory for reflexive associations. Rolename Association name instructor Staff Member Student instructs UML Diagrams

  22. Associations • Multiplicity • The number of instances of the class, next to which the multiplicity expression appears, that are referenced by a single instance of the class that is at the other end of the association path. Role name Association name instructor Staff Member Student 1..* instructs * Multiplicity UML Diagrams

  23. Associations • Multiplicity Indicators: UML Diagrams

  24. 2..* 1..* Door Car House Aggregation • A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts. • Models a “is a part-part of” relationship. Whole Whole Part UML Diagrams

  25. 2..* Door Car Aggregation • Aggregation tests: • Is the phrase “part of” used to describe the relationship? • A door is “part of” a car • Are some operations on the whole automatically applied to its parts? • Move the car, move the door. • Are some attribute values propagated from the whole to all or some of its parts? • The car is blue, therefore the door is blue. • Is there an intrinsic asymmetry to the relationship where one class is subordinate to the other? • A door is part of a car. A car is not part of a door. Whole Part UML Diagrams

  26. Whole Part Student Schedule Composition Composition • A strong form of aggregation • The whole is the sole owner of its part. • The part object may belong to only one whole • Multiplicity on the whole side must be zero or one. • The life time of the part is dependent upon the whole. • The composite must manage the creation and destruction of its parts. UML Diagrams

  27. Bank Account Transactions Customer Info Composition • Example: Part Whole Part UML Diagrams

  28. An abstract class Shape{abstract} Super Class Generalization relationship Sub Class Circle Generalization • Indicates that objects of the specialized class (subclass) are substitutable for objects of the generalized class (super-class). • “is kind of” relationship. {abstract} is a tagged value that indicates that the class is abstract. The name of an abstract class should be italicized UML Diagrams

  29. Generalization • A sub-class inherits from its super-class • Attributes • Operations • Relationships • A sub-class may • Add attributes and operations • Add relationships • Refine (override) inherited operations • Note: A generalization relationship may not be used to model interface implementation. UML Diagrams

  30. Dependency • A dependency indicates a semantic relation between two or more classes in which a change in one may force changes in the other although there is no explicit association between them. • A stereotype may be used to denote the type of the dependency. Iterator <<friend>> Vector UML Diagrams

  31. Dependency • In an e-commerce application, a Cart class depends on a Product class because the Cart class uses the Product class as a parameter for an add operation. This relationship indicates that a change to the Product class might require a change to the Cart class. Thedependent class Dependency Relationship Theindependent class Cart Product add(Product p) UML Diagrams

  32. Realization • A realization relationship indicates that one class implements a behavior specified by another class (an interface or protocol). • An interface can be realized by many classes. • A class may realize many interfaces. LinkedList <<interface>>List LinkedList List UML Diagrams

  33. id: long { value > 0 } Customer 1 * Order may be canceled { total < $50 } Constraint Rules and Notes • Constraints and notes annotate among other things associations, attributes, operations and classes. • Constraints are semantic restrictions noted as Boolean expressions. • UML offers many pre-defined constraints. Constraint Note UML Diagrams

  34. TrafficReport Offender 1 issues * TrafficPoliceman 1..* 1 id : long name : String description : String id : long occuredAt : Date reports of 1..* Policeman Violation id : long name : String id : long rank : int description : String <<abstract>> TVRS – Traffic Violation Report System  Example: UML Diagrams

  35. Case Study: • Draw a class diagram for a information modeling system for a school. • School has one or more Departments. • Department offers one or more Subjects. • A particular subject will be offered by only one department. • Department has instructors and instructors can work for one or more departments. • Student can enrol in upto 5 subjects in a School. • Instructors can teach upto 3 subjects. • The same subject can be taught by different instructors. • Students can be enrolled in more than one school. UML Diagrams

  36. Case Study: School has one or more Departments. School Department has 1..* 1 Department Subject offers 1..* 1 • Department offers one or more Subjects. • A particular subject will be offered by only one department. UML Diagrams

  37. Case Study: Department has Instructors and instructors can work for one or more departments. Instructor Department 1..* assigned to 1..* Student Subject takes 0..5 * • Student can enrol in upto 5 Subjects. UML Diagrams

  38. Case Study: Instructors can teach up to 3 subjects. The same subject can be taught by different instructors. 1..* Instructor Subjects 1..3 teaches UML Diagrams

  39. Case Study: Students can be enrolled in more than one school. * Student School 1..* member UML Diagrams

  40. Department Instructor Subject Student School Case Study: Final Class Diagram has 1 1..* 1..* 1…* 1 offeres assignedTo member 1..* 1..* * attends teaches * 1..5 1..* 1..3 UML Diagrams

  41. Object Diagram • Object Diagram shows the relationship between objects. • Unlike classes objects have a state. UML Diagrams

  42. Object Diagrams • Models a set of objects and their interrelationships during a system snapshot. • A system snapshot is the state of the software system at a selected moment of time. • Object diagrams model another static perspective of the system. • Unlike other diagrams, object diagrams may contain multiple instances of the same class. UML Diagrams

  43. LMS Case Study: Object Diagram (partial) :Book currentP: Student : List name = “SOTY”author=“b. hooks”ISBN= ... name=“Gert Stein”libraryID=6747632homephone=5554321workphone=5551234membership=05011999expire=05012002 :Book name = “FOF”author=“Ehrenreich”ISBN= ... UML Diagrams

  44. Steps for Creating Object Diagrams • Identify a system snapshot within a scenario to model. • Identify participating classes and their interrelationships. • Identify all allocated objects at the time of the snapshot. • Show the state of each object in the snapshot. • Determine all inter-object links. UML Diagrams

  45. c1: Company name=“UniMelb” Object Diagram - Example c1: Company d1: Department d2: Department name=“Sales” name=”CSSE” manager employee p2: Person p1: Persont name=“Raj” name=“Rao” UML Diagrams

  46. Class Vs. Object Diagrams Class Name Association Name Customer Rental Item Rents +id:integer +id:integer 0..n +name:string +released:date 0..1 Class Diagram Attributes Object Name Link Name Aly: Customer UML: Rental Item Rents +id:1667 +id:22340 +name: Aly ahmed +released:1942 Object Diagram UML Diagrams

  47. Class and Object Diagrams 2 Class Vs. Object Diagrams UML Diagrams

  48. Name UML Packages • A package is a general purpose grouping mechanism. • Can be used to group any UML element (e.g. use case, actors, classes, components and other packages. • Commonly used for specifying the logical distribution of classes. • A package does not necessarily translate into a physical sub-system. UML Diagrams

  49. Logical Distribution of Classes • Emphasize the logical structure of the system (High level view) • Higher level of abstraction over classes. • Aids in administration and coordination of the development process. • Contributes to the scalability of the system. • Logical distribution of classes is inferred from the logical architecture of the system. UML Diagrams

  50. A D E F G C B Packages and Class Diagrams • Add package information to class diagrams UML Diagrams

More Related