1 / 18

UML (Unified Modeling language)

UML (Unified Modeling language). Prepared by Miss Simab Shahid (s.shahid@uoh.edu.sa) Lecturer computer Science and Software Engineering department, University of Hail. Introduction to UML and Patterns. Software design is a process of problem solving and planning for software solution.

fred
Télécharger la présentation

UML (Unified Modeling language)

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. UML(Unified Modeling language) Prepared by Miss Simab Shahid (s.shahid@uoh.edu.sa) Lecturer computer Science and Software Engineering department, University of Hail

  2. Introduction to UML and Patterns • Software design is a process of problem solving and planning for software solution. • There are different designing tools are available for software designing. • UML and patterns are two software design tools that can be used within the context of any OOP (Object-Oriented programming) language. • UML(Unified Modeling Language) is a graphical language used for designing and documenting OOP software. • A pattern in programming is a kind of template or outline of a software task. Simab Shahid UOH, Girls Branch

  3. UML (unified Modeling Language) • Pseudocode is a way of representing a program in a linear and algebraic manner. • It simplifies design by eliminating the details of programming language syntax. • Graphical representation systems for program design have also been used: • Flowcharts and structure diagramsfor example. • Unified Modeling Language(UML) is yet another graphical representation formalism. • UML is designed to reflect and be used with the OOP philosophy. Simab Shahid UOH, Girls Branch

  4. UML Class Diagram • Classes are central to OOP(Object Oriented Programming), and the class diagramis the easiest of the UML graphical representations to understand and use. • A class diagram is divided up into three sections: • The top section contains the class name. • The middle section contains the data specification for the class. • The bottom section contains the actions or methods of the class. Simab Shahid UOH, Girls Branch

  5. UML Class Diagram(TEMPLATE) Class FUNCTIONS& constructors will come here Class VARIABLES will come here Class NAME will come here Simab Shahid UOH, Girls Branch

  6. UML Class Diagram • The data specification for each piece of data in a UML diagram consists of its name, followed by a colon, followed by its type. • Each name is preceded by a character that specifies its access type: • A minus sign (-) indicates private access • A plus sign (+) indicates public access • A sharp (#) indicates protected access • A tilde (~) indicates package access Simab Shahid UOH, Girls Branch

  7. UML Class Diagram • Each method in a UML diagram is indicated by the name of the method, followed by its parameter list, a colon (:), and its returned type. • The access type of each method is indicated in the same way as for data. • A class diagram need not give a complete description of the class. • If a given analysis does not require that all the class members be represented, then those members are not listed in the class diagram. • Missing members are indicated with an ellipsis (three dots). Simab Shahid UOH, Girls Branch

  8. Class Data Specification UML Class diagram (example) Class Name SimabShahid UOH, Girls Branch Class member functions

  9. UML Class Diagram(EXAMPLE) UML class Diagram for Point class Java code for Point class • class Point { • public int XCoord; • public int YCoord; • public Point( ) • { • XCoord=0; • YCoord=0; • } • public void display() • { • System.out.println(“X Coordinate = “+ XCoord); • System.out.println(“Y Coordinate = “+ YCoord); • } • } Simab Shahid UOH, Girls Branch

  10. Activity 01 UML class Diagram publicclass Cube { int length; int breadth; int height; public Cube() { length = 0; breadth = 0; height= 0; } public int getVolum ( ) { return(length*breadth *height); } } Simab Shahid UOH, Girls Branch

  11. Activity 02 • class Employee { • publicString name; • publicint id; • privatefloat salary; • public Employee( String Name, int Id, float Salary) { • name = Name; • id = Id; • salary = Salary; • } • public void setSalary( float s) • { • salary = s; • } • public float getSalary( ) • { • return salary; • } • } Simab Shahid UOH, Girls Branch

  12. Activity 04 Is this a valid class diagram ? Is this a valid class diagram ? Simab Shahid UOH, Girls Branch Java Code class Point{ public int XCoord ; public int YCoord ; } Java Code class Point{ public Point(){ } public void display(){ } }

  13. Activity 05 Simab Shahid UOH, Girls Branch Is this a valid class diagram ?

  14. Class Interactions • Rather than show just the interface of a class, class diagrams are primarily designed to show the interactions among classes. • UML has various ways to indicate the information flow from one class object to another using different sorts of annotated arrows. • UML has annotations for class groupings into packages, for inheritance, and for other interactions. • In addition to these established annotations, UML is extensible. Simab Shahid UOH, Girls Branch

  15. Inheritance Diagrams • An inheritance diagramshows the relationship between a base class and its derived class(es). • Normally, only as much of the class diagram is shown as is needed. • Note that each derived class may serve as the base class of its derived class(es). • Each base class is drawn above its derived class(es) • An upward pointing arrow is drawn between them to indicate the inheritance relationship. Simab Shahid UOH, Girls Branch

  16. Person Student Employee Staff Undergraduate Graduate Faculty A Class Hierarchy in UML Notation Simab Shahid UOH, Girls Branch

  17. Inheritance Diagram • The arrows also help in locating method definitions. • To look for a method definition for a class: • Examine the class definition first. • If the method is not found, the path of connecting arrows will show the order and direction in which to search. • Examine the parent class indicated by the connecting arrow. • If the method is still not found, then examine this parent's parent class indicated by the connecting arrow. • Continue until the method is found, or until the top base class is reached. Simab Shahid UOH, Girls Branch

  18. Person - name: String + setName(String newName): void + getName( ): String + toString( ): String + sameName(Person otherPerson): boolean Student - studentNumber: int + set(String newName , int newStudentNumber): void + getStudentNumber( ): int + setStudentNumber(int newStudentNumber ): void + toString( ): String + equals(Object otherObject): boolean Some details of Class Hierarchy Simab Shahid UOH, Girls Branch

More Related