cit731: database development object oriented modeling (oom)

32
CIT731: Database Development Object Oriented Modeling (OOM)

Upload: elise-blundell

Post on 16-Dec-2015

225 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CIT731: Database Development Object Oriented Modeling (OOM)

CIT731: Database Development

Object Oriented Modeling (OOM)

Page 2: CIT731: Database Development Object Oriented Modeling (OOM)

What it is Modeling

Modeling is a central part of all the activities that lead up to the deployment of good software/database application.

A model is a simplification of reality. A model provides the blueprints of a

system. Models may encompass detailed plans, as well as more general plans that give a 30,000-foot view of the system under consideration.

Page 3: CIT731: Database Development Object Oriented Modeling (OOM)

What it is Modeling

Every system may be described from different aspects using different models, and each model is therefore a semantically closed abstraction of the system.

A model may be structural, emphasizing the organization of the system, or it may be behavioral, emphasizing the dynamics of the system.

Page 4: CIT731: Database Development Object Oriented Modeling (OOM)

Why Do We Model? We build models to:

communicate the desired structure and behavior of our system/Database System.

to visualize and control the system's architecture.

better understand the system we are building, often exposing opportunities for simplification and reuse.

manage risk.

Page 5: CIT731: Database Development Object Oriented Modeling (OOM)

Importance of Modeling…Overall

The main fundamental reason of modeling is that:

We build models so that we can better understand the system we are developing.

Through modeling, we achieve four aims.

Page 6: CIT731: Database Development Object Oriented Modeling (OOM)

Four aims of Modeling

Models help us to visualize a system as it is or as we want it to be.

Models permit us to specify the structure or behavior of a system.

Models give us a template that guides us in constructing a system.

Models document the decisions we have made.

Page 7: CIT731: Database Development Object Oriented Modeling (OOM)

Introduction to OO Modeling

Objected oriented modeling is the nowadays database design process in which database development takes an object-oriented perspective.

In this approach, the main building block of all database systems is the object or class.

Page 8: CIT731: Database Development Object Oriented Modeling (OOM)

Introduction to OO Modeling Simply put, an object is a thing, generally

drawn from the vocabulary of the problem space or the solution space; a class is a description of a set of common objects.

Every object has: identity (you can name it or otherwise

distinguish it from other objects),state (there's generally some data associated

with it),behavior (you can do things to the object, and

it can do things to other objects, as well).

Page 9: CIT731: Database Development Object Oriented Modeling (OOM)

UML

The Unified Modeling Language (UML) is a standard language for writing database system blueprints.

The major design tool used in object oriented is UML (Unified Modeling Language)

UML has so far had little success in displacing other approaches such as entity – relationship (ER)

Page 10: CIT731: Database Development Object Oriented Modeling (OOM)

Where Can the UML Be Used? ...Application The UMLhas been used effectively for such

domains as: Enterprise information systems Banking and financial services Telecommunications Transportation Defense/aerospace Retail Medical electronics Scientific Distributed Web-based services

Page 11: CIT731: Database Development Object Oriented Modeling (OOM)

Building Blocks of the UML

The vocabulary of the UML encompasses three kinds of building blocks:ThingsRelationshipsDiagrams

Page 12: CIT731: Database Development Object Oriented Modeling (OOM)

Building Blocks of the UML

Things are the abstractions that are first-class citizens in a model.

Relationships tie these things together.

Diagrams group interesting collections of things.

Page 13: CIT731: Database Development Object Oriented Modeling (OOM)

UML

Version 1.1 of UML was adopted in November 1997 by the OMG as a language for object-oriented analysis and design.

The UML notation is a set of languages rather than a single language. It includes a vast number of symbols, from which various diagrams may be constructed to model different perspectives of an application

Page 14: CIT731: Database Development Object Oriented Modeling (OOM)

UML

The 9 main diagram types in UML 1.5 are use case (use case diagram); static structure (class diagram,object diagram); behavior (statechart, activity diagram); interaction (sequence diagram, collaboration diagram); and implementation (component diagram, deployment diagram).

Page 15: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

Classes are the most important building block of any object-oriented system.

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

You use classes to capture the vocabulary of the system you are developing.

Page 16: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

Modeling a system involves identifying the things that are important to your particular view.

These things form the vocabulary of the system you are modeling.

For example, if you are building a house, things like walls, doors, windows, cabinets, and lights are some of the things that will be important to you as a home owner.

Page 17: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

Each of these things can be distinguished from the other. Each of them also has a set of properties.Walls have a height and a width and are solid.

Doors also have a height and a width and are solid, as well, but have the additional behavior that allows them to open in one direction.

Page 18: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

Windows are similar to doors in that both are openings that pass through walls, but windows and doors have slightly different properties.

Windows are usually (but not always) designed so that you can look out of them instead of pass through them.

Page 19: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram In the UML, all of these things are

modeled as classes. A class is an abstraction of the things that

are a part of your vocabulary. A class is not an individual object, but

rather represents a whole set of objects. Thus, you may conceptually think of "wall"

as a class of objects with certain common properties, such as height, length, thickness, load-bearing or not, and so on.

Page 20: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

You may also think of individual instances of wall, such as "the wall in the southwest corner of my study.“

The UML provides a graphical representation of class.

This representation allows developer to visualise an abstraction in the way that enable him/her to focus on class name, attributes, and operations.

Page 21: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

Page 22: CIT731: Database Development Object Oriented Modeling (OOM)

Classes and Class Diagram

The UML class diagram consists of several classes connected with relationships.

The rectangle is the icon for the class. The name of the class is by convention, a

word with an initial uppercase letter near the top of the rectangle.

If the class name has more than one word name, join the words together and capitalise the first letter of each word.

Page 23: CIT731: Database Development Object Oriented Modeling (OOM)

Attributes

An attribute is a named property of a class that describes a range of values that instances of the object may hold.

A class may have any number of attributes or no attributes at all.

An attribute represents some property of the thing you are modeling that is shared by all objects of that class.

Page 24: CIT731: Database Development Object Oriented Modeling (OOM)

Attributes

For example, you might model your customers in such a way that each has a name, address, phone number, and date of birth.

An attribute is therefore an abstraction of the kind of data or state an object of the class might encompass.

Graphically, attributes are listed in a compartment just below the class name.

Page 25: CIT731: Database Development Object Oriented Modeling (OOM)

Attributes

Page 26: CIT731: Database Development Object Oriented Modeling (OOM)

Attributes

An attribute name may be text, just like a class name.

You can further specify an attribute by stating its class and possibly a default initial value, as shown.

Page 27: CIT731: Database Development Object Oriented Modeling (OOM)

Attributes

Page 28: CIT731: Database Development Object Oriented Modeling (OOM)

Operations

An operation is something that a class can do, or that you (or another class) can do.

An operation’s name is written in lowercase letter.

If the name consists of more than one word, the words are joined and each word except the first word begins with an uppercase letter

Page 29: CIT731: Database Development Object Oriented Modeling (OOM)

Operations

The list of operations begins below a line separating operations from the attriibutes.

ClassName

Attribute1 : type1Attribute1 : type1 = “Default value”

Operation1()Operation2(list of parameters)Operataion3 : returned value type

Page 30: CIT731: Database Development Object Oriented Modeling (OOM)

Operations

Page 31: CIT731: Database Development Object Oriented Modeling (OOM)

Associations

When classes are connected together conceptually, that connection is called an association.

Visualisation of association is by a line connecting the two classes with the name of association just above the line.

Page 32: CIT731: Database Development Object Oriented Modeling (OOM)

Class Work

Given 3 classes Customer, SuperMarket, and Bill. Use class diagram to represent the classes with association “Buys from”