CIT731: Database Development

Download Report

Transcript CIT731: Database Development

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.

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.

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.

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.

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.

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.

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).

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)

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

Building Blocks of the UML

 The vocabulary of the UML encompasses three kinds of building blocks:  Things  Relationships  Diagrams

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.

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

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).

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.

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.

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.

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.

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.

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.

Classes and Class Diagram

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.

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.

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.

Attributes

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.

Attributes

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

Operations

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

ClassName Attribute1 : type1 Attribute1 : type1 = “Default value” Operation1() Operation2(list of parameters) Operataion3 : returned value type

Operations

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.

Class Work

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