30

Unified modeling language

  • Upload
    amity2j

  • View
    126

  • Download
    0

Embed Size (px)

Citation preview

Model is a simplification of reality. A model provides the blueprint for a system

we want to build. Very often, one model may not be sufficient

for a given task, especially if the task is huge. Why we model? Continue

You want to build a doghouse for your dog…You take your tools, and start your work…

IIn the end, this is how it ends up…The dog is angry…But think he can live with it…Or else…

You can always start again…Or…

You can kick him out and get a new one…

You need to build a house for your family… and you start your work…

Maybe something went wrong…

If it doesn’t work, you can kick…oooops, you can’t do that!!! Should have planned something…

Visualize a system as it is or as we want it to be.

Permit us to specify the structure or behavior of a system.

A template which guides us in constructing a system.

Document the decisions we have made.

UML means Unified Modeling Language. The Unified Modeling Language (UML) is a

graphical language for visualizing,specifying, constructing, and documenting the artifacts of a software-intensive system.

The UML offers a standard way to write a system's blueprints, including conceptualthings such as business processes and system functions as well as concrete things suchas programming language statements, database schemes, and reusable softwarecomponents.

There are 3 basic building blocks in UMLThingsRelationshipsDiagrams

Structural ThingsClass InterfaceCollaborationUse CaseActive ClassComponentNode

Behavioral Things InteractionState Machine

Grouping Things (Packages)

Annotational Things

Dependency Association Generalization Realization

Class diagram Object Diagram Use Case Diagram Sequence Diagram Collaboration Diagram Statechart diagram Activity Diagram Component Diagram Deployment Diagram

A class is a set of objects that share the same attributes, operations, relationships, and semantics.

A class is represented by a rectangle in UML. It contains the class name as the header. It contains its data members and member

functions as well, sometimes with the associated data types.

Student-rollno :int-name :string-marks :float+ <<constructor>>Student(r:int,n:string,m:marks)+print()

--initialize each object of student class--print the details

NAME

ATTRIBUTES

OPERATIONS

RESPONSIBILITIES

class student{

int rollno;char name[20];float marks;public:student( int r,

char n[20],float m);

void print();}

Frozen data members : They are data members which cannot be modified .

Multipliers: It refers to the number of instances of a particular class or attribute.

Dependencies: Relations “using” relations among classes

Generalizations: Typical inheritance relations Associations: Structural relations among

objects

class gradstud : public student {

char degree[20];public:void getdeg();void put();

}

Student#rollno :int#name :string#marks :float+ <<constructor>>Student(r:int,n:string,m:marks)+print()

--initialize each object of student class--print the details

gradstud-degree: string

+ getdeg()+put()

Scope Inheritance Type

Scope simply refers to the number of copies of a data member for a class.

If there is only one instance for the whole class, it is called classifier scope.

If each instance has a separate copy, it is called instance scope.

Student

-rollno :int-name :string-marks :float

+ <<constructor>>Student(r:int,n:string,m:marks)+print()

--initialize each object of student class--print the details

+ classno :string

Classifier Scope : Note it is underlined

Instance Scope : Note, not underlined

Abstract classes and functions are specified by making them italicized.

Class with no children is labelled leaf. Class with no parents is labelled root. Typically, child functions override parent

functions, and are called polymorphic. If it is not so, label it as a leaf function.

Shape#Origin:point=(0,0)

+display()+getorigin()

Rectangle

-l:int-b:int-h:int

+display()

Member functions can be specified with their return types.+ isFull() : int

Arguments in the argument list can also be specified. in :input argument, cannot be changed out : output argument inout :input parameter, can be changed

Functions can also have associated properties like isQuery, sequential, guarded and concurrent.

Class Name

[visiblility] name [multiplicity][:type][=initial value] [{property}]

[visibility]name [(parameter list)][:return type] [{property}]