rajika tandon
Download
Skip this Video
Download Presentation
RAJIKA TANDON

Loading in 2 Seconds...

play fullscreen
1 / 56

RAJIKA TANDON - PowerPoint PPT Presentation


  • 67 Views
  • Uploaded on

RAJIKA TANDON. SOFTWARE DESIGN. CIS 453 - Software Specification & Design Instructor: Dr. E. Sibert. DESIGN. The design of a system is essentially a blueprint or a plan for a solution for the system.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'RAJIKA TANDON' - tarannum


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
rajika tandon
RAJIKA TANDON

SOFTWARE DESIGN

  • CIS 453 - Software Specification & Design

Instructor: Dr. E. Sibert

slide2

DESIGN

  • The design of a system is essentially a blueprint or a plan for a solution for the system.
  • Here we consider a system to be a set of modules with clearly defined behavior which interact with each other in a defined manner to produce some behavior or services for its environment.
  • The design process for software systems often has two levels. At the first level the focus is on deciding which modules are needed for the system, the specifications of these modules, and how the modules should be interconnected.
  • This is what may be called the module design or the high-level design.
  • In the second level, the internal design of the modules, or how the specifications of the module can be satisfied, is decided. This design level is often called detailed design or logic design.
  • Detailed design essentially expands the system design to contain a more detailed description of the processing logic and data structures so that the design is sufficiently complete for coding.
object model
Object model?
  • An object model defines the structural relationships and dynamic interaction between a group of related objects.
  • An object diagram represents a specific collection of objects,

with specific attribute values and relationships.

  • Therefore it looks like a snapshot of an O-O system at some instant in time.
outline
Outline
  • Object modeling
  • Class vs instance diagrams
  • Attributes
  • Operations and methods
  • Links and associations
  • Examples of associations
  • Two special associations
    • Aggregation
    • Inheritance
definition object modeling
Definition: Object Modeling
  • Main goal: Find the important abstractions
  • Steps during object modeling
    • 1. Class identification
      • Based on the fundamental assumption that we can find abstractions
    • 2. Find the attributes
    • 3. Find the methods
    • 4. Find the associations between classes
  • Order of steps
    • Goal: get the desired abstractions
    • Order of steps secondary, only a heuristic
    • Iteration is important

What happens if we find the wrong abstractions?

    • Iterate and correct the model
class identification
Class Identification
  • Identify the boundaries of the system
  • Identify the important entities in the system
  • Class identification is crucial to object-oriented modeling
  • Basic assumption:
    • 1. We can find the classes for a new software system (Forward Engineering)
    • 2. We can identify the classes in an existing system (Reverse Engineering)
pieces of an object model
Pieces of an Object Model
  • Classes
  • Associations (Relations)
    • Part of- Hierarchy (Aggregation)
    • Kind of-Hierarchy (Generalization)
  • Attributes
    • Detection of attributes
    • Application specific
    • Attributes in one system can be classes in another system
    • Turning attributes to classes
  • Methods
    • Detection of methods
    • Generic methods: General world knowledge, design patterns
    • Domain Methods: Dynamic model, Functional model
object vs class
Object vs Class
  • Object (instance): Exactly one thing
  • A class describes a group of objects with similar properties
  • Object diagram:A graphic notation for modeling objects, classes and their relationships ("associations"):
    • Class diagram:Template for describing many instances of data. A class diagram describes object classes.

Object class: group of objects with similar properties (attributes), common behavior(operations), common relationships to other objects)

Useful for taxonomies, patters, schemata...

    • Instance diagram: A particular set of objects relating to each other. Useful for discussing scenarios, test cases and examples
class and instance diagrams
Class and Instance Diagrams

Inspector

Class Diagram

anonymous:

Inspector

joe:

Inspector

mary:

Inspector

Instance Diagram

slide10
Common uses of object diagrams are:
  • to illustrate the system state at a high level of abstraction, before and after some action (e.g. instruction execution)

i.e. dynamic modeling !!

  • to analyze the structure of recursive data types (classes) by unfolding a class diagram.
attributes a data value held by the objects in a class

Inspector

name:string

age: integer

joe:Inspector

mary: Inspector

name = “Joe”

name = “Mary”

age = 24

age = 18

Attributes – A data value held by the objects in a class.
operation signature or method what when feature a generic word for either attribute operation
Operation: A function or transformation applied to objects in a class. All objects in a class share the same operations (Analysis Phase)

Signature:Number & types of arguments, type of result value. All methods of a class have the same signature (Object Design Phase)

Method: Implementation of an operation for a class (Implementation Phase)

Polymorphic operation: The same operation applies to many different classes.

Workorder

File_name: String

Size_in_bytes: integer

Last_update: date

Stickies: array[max]

print()

delete()

open()

close()

write()

read()

Operation, Signature or Method? What when?( Feature –A generic word for either attribute /operation)
links and associations
Links and Associations
  • Links and associations establish relationships among objects and classes.
  • Link:
    • A (physical/conceptual) connection between two object instances. A link is like a tuple.
    • A link is an instance of an association
  • Association:
    • An association describes a set of links like a class describes a set of objects.
    • Basically a bidirectional mapping.
    • One-to-one, many-to-one, one-to-many.
slide14
Notation for multiplicity:
  • 1 one and only one exactly 1
  • 0 zero or one 0 or 1 (optional)
  • +1 one or more > = 1
  • M- N from M to N M to N
  • greater than or equal to zero > = 0 (many)
1 to 1 and 1 to many associations

Country

City

name:String

name:String

Workorder

schedule()

1-to-1 and 1-to-many Associations

Has-capital

One-to-one association

StickyNote

x: Integer

y: Integer

z: Integer

One-to-many association

object instance diagram

:Sticky

:Sticky

:Sticky

:WorkOrder

x,y,z=(-1,0,5)

x,y,z=(1,10,1)

x,y,z=(10,1,2)

Object Instance Diagram

Example for 1-to-many

slide18
Ternary and n-ary relations are represented

using the diamond as before, e.g.

Object_1 :

Class_1

Object_2 :

Class_2

Object_3 :

Class_3

slide19
We can use object diagrams to understand

recursively defined classes. For example,

the class diagram

Binary_Tree

0,1

0 .. 2

slide20

T1 : Binary

Tree

T2 : Binary

Tree

T3 : Binary

Tree

T4 : Binary

Tree

T5 : Binary

Tree

do associations have direction
Do associations have direction?

A

B

  • A association between two classes is by default a bi-directional mapping.
  • If you want to make A a client, and B a server, you can make the association unidirectional. The arrowhead points to the server role:
    • Class A can access class B and class B can access class A
    • Both classes play the agent role.

Name of association

Name Direction

A

B

accesses

Association Direction

  • Class A ( the “client”) accesses class B (“the server”). B is also called navigable.
slide23
Relation R between classes X and Y is:

n-to-… if for every object y :Y there are

n distinct objects x1 ,…, xn : X with

xiR y for i = 1 ,…, n

…-to-m if for every object x :X there are

m distinct objects y1 ,…, ym : Y with

x R yi for i = 1 ,…, m

roles
Roles
  • A role name is the name that uniquely identifies one end of an association.
  • A role name is written next to the association line near the class that plays the role.
  • When do you use role names?
    • Necessary for associations between two objects of the same class
    • Also useful to distinguish between two associations between the same pair of classes
  • When do you not use role names?
    • If there is only a single association between a pair of distinct classes, the names of the classes serve as good role names
example of role

Person

Person

Person

Person

Example of Role

Pr

oblem Statement

:

A

person assumes the role of repairer

with respect to another person, who assumes the role of

inspector with respect to the first person.

Creates Workorders

inspector

Creates Workorders

repairperson

qualification

File

1

*

Directory

filename

0..1

1

Directory

File

filename

Qualification
  • The qualifier improves the information about the multiplicity of the association between the classes.
  • It is used for reducing 1-to-many multiplicity to 1-1 multiplicity

Without qualification: A directory has many files. A file belongs only to one directory.

With qualification: A directory has many files, each with a unique name

example

StockExchange

lists

Company

tickerSym

Example

Pr

oblem Statement

:

A

stock exchange lists many companies.

However

, a stock exchange lists only one company with a

given ticker symbol.

A

company may be listed on many stock

exchanges, possibly with different ticker symbols.

Find company with ticker symbol AAPL.

use of qualification reduces multiplicity

Company

StockExchange

tickerSym

StockExchange

Company

tickerSym

Use of Qualification reduces multiplicity

0..1

1

Directory

FILE

filename

slide29

officer

Company

Person

office

Organization

Many-to-Many Qualification

aggregation
Aggregation
  • Models "part of" hierarchy
  • Useful for modeling the breakdown of a product into its component parts (sometimes called bills of materials (BOM) by manufacturers)
aggregation1
Aggregation

Plain association: peer relationship.

Aggregation: whole/part relationship.

- An object may be a part of ONLY one aggregate at a time.

Company

whole

1

*

Department

part

aggregation2
Aggregation
  • Special kind of association
  • For “part-whole” relationships
  • For “has-a” relationships
  • Aggregation-by-Value: Composition
  • Aggregation-by-Reference: Aggregation
composition
Composition

In Composition (composite aggregation):

- An object may be a part of ONLY one composite at a time.

- Whole is responsible for the disposition of its parts.

whole

Window

1

*

part

Frame

composition by value
Composition (by Value)

gfdgfdgfdgfdgfdg

aggregation by reference
Aggregation (by Reference)

Product Catalog

Product

1

*

Roll Call

Student

slide36
Aggregation vs. Composition
  • Both denote whole-part relationships
  • Both enable modeling at multiple levels of abstraction: whole or part
aggregation vs composition contd
Aggregation vs Composition (contd.)
  • Aggregation: does not link the lifetimes of the whole and its parts. Aggregation can occur when a class is a collection or container of other classes, but where the contained classes do not have a strong life cycle dependency on the container—essentially, if the container is destroyed, its contents are not.
  • Composition: usually has a strong life cycle dependency between instances of the container class and instances of the contained class(es): If the container is destroyed, normally every instance that it contains is destroyed as well. Note that (where allowed):
      • Parts with non-fixed multiplicity can be created after the composite itself.  lifetime
      • Such parts can be explicitly removed before the death of the composite.  lifetime
      • An object may be a part of only one composite at a time.  strong ownership
slide38
Generalization
  • Also called Inheritance or Specialization.
  • Connects generalized classes to more specialized classes.
  • Sometimes called the “is-a” relationship because each instance of a subclass is an instance of the superclass as well.
  • NOTATION :

A triangle connecting the superclass to its subclasses. The superclass connected by a line to the apex of the triangle. The subclasses are connected by lines to a horizontal bar attached to the base of the triangle.

aggregation vs generalization
Aggregation Vs Generalization

Both associations describe trees (hierarchies)

AGGREGATION:

  • Aggregation relates instances (involves two or more different objects).
  • Two distinct objects are involved; one of them is a part of the other.
  • An aggregation tree is composed of object instances that are all part of a composite object.
  • “part-of” relationship.

GENERALIZATION:

  • Generalization relates classes (a way to structure the description of a single object).
  • It is a way of structuring the description of a single object.
  • An generalization tree is composed of classes that describe an object
  • “a-kind-of”,”is-a” relationship.
slide40

Class relationships

  • Aggregation:
  • Represented by has-a relationship
  • Also called Whole-part, Composition, or Embedding
  • Cardinality is associated with this relationship
  • Inheritance
  • Represented by Is-A relation
  • No cardinality is associated
  • Also referred to as generalization/specialization
  • Association
  • It is used when objects of two classes communicate or
  • there is a dependency that doesn’t fit the category of
  • aggregation or inheritance
  • Cardinality is associated
grouping constructs
Grouping constructs:

Module:

A logical construct for grouping classes, associations, and generalizations. It captures one perspective or view of a situation.

For example:

Electrical, Plumbing and ventilation modules are different views of a building.

SHEET:

A mechanism for breaking a large object model into a series of pages.

revision relationships
Revision - Relationships

1. Dependency

a semantic relationship between two things in which a change to one thing (independent) may affect the semantics of the other thing (dependent).

Directed is optional and label is optional.

2. Associations

a structural relationship that describes a set of links, a link being a connection between objects.

Can bedirected labels Can havemultiplicity & role names

employer

employee

0..1

*

Aggregation

a special kind of association. It represents a structural relationship

between the whole and its parts. Aggregation is inherently TRANSITIVE.

An aggregate has parts, which may inturn have parts.

Represented by a diamond.

3. Generalization

a specialization/generalization relationship in which objects of the specialized element (the child) are more specific than the objects of the generalized element.

aggregation vs association
Aggregation Vs Association
  • Aggregation relates instances.
  • If two objects are tightly bound by a part-whole relationship, it is aggregation.

Vs

Association:

  • If two objects considered are independent, even though they may often be linked

Division

Department

Company

Works for

Person

how do you find classes
How do you find classes?
  • Learn about problem domain: Observe your client
  • Apply general world knowledge and intuition
  • Take the flow of events and find participating objects in use cases
  • Apply design patterns
  • Try to establish a taxonomy ( classification, derivatives )
  • Do a textual analysis of scenario or flow of events (Abbott Textual Analysis, 1983)
  • Nouns are good candidates for classes
mapping parts of speech to object model components abbot 1983
Mapping parts of speech to object model components [Abbot 1983]

Part of speech

Model component

Example

Proper noun

object

Jim Smith

Improper noun

class

Toy, doll

Doing verb

method

Buy, recommend

being verb

inheritance

is-a (kind-of)

having verb

aggregation

has an

modal verb

constraint

must be

adjective

attribute

3 years old

transitive verb

method

enter

intransitive verb

method (event)

depends on

example scenario from problem statement
Example: Scenario from Problem Statement
  • Jim Smithenters a store with the intention of buying a toy for his 3 year old child.
  • Help must be available within less than one minute.
  • The store owner gives advice to the customer. The advice depends on the age range of the child and the attributes of the toy.
  • Jim selects a dangerous toy which is unsuitable for the child.
  • The store owner recommends a more yellow doll.

( Is is-a (kind-of) and has-a present in the above text ? )

object modeling in practice class identification

Foo

Balance

CustomerId

Deposit()

Withdraw()

GetBalance()

Object Modeling in Practice: Class Identification

Class Identification: Name of Class, Attributes and Methods

object modeling in practice encourage brainstorming

Account

Foo

“Dada”

Balance

Balance

Balance

CustomerId

CustomerId

CustomerId

Deposit()

Deposit()

Deposit()

Withdraw()

Withdraw()

Withdraw()

GetBalance()

GetBalance()

GetBalance()

Object Modeling in Practice: Encourage Brainstorming

Naming is important!

object modeling in practice

Account

Balance

AccountId

Customer

Bank

Name

CustomerId

Name

Deposit()

Withdraw()

GetBalance()

Object Modeling in Practice

Find New Objects

Iterate on Names, Attributes and Methods

object modeling in practice a banking system

Account

Balance

AccountId

Bank

Customer

Name

CustomerId

Name

Deposit()

Withdraw()

GetBalance()

Object Modeling in Practice: A Banking System

*

Has

Find New Objects

Iterate on Names, Attributes and Methods

Find Associations between Objects

Label the associations

Determine the multiplicity of the associations

slide51

Account

Balance

AccountId

Customer

Name

Deposit()

Withdraw()

GetBalance()

Object Modeling in Practice: Categorize!( many accounts belong to 1 bank OR a bank holds many accounts – aggregation)

Bank

*

*

Name

Has

CustomerId

Savings

Account

Checking

Account

Mortgage

Account

Withdraw()

Withdraw()

Withdraw()

object modeling in practice heuristics
Object Modeling in Practice: Heuristics
  • Explicitly schedule meetings for object identification
  • Try to differentiate between entity, boundary and control objects
  • Find associations and their multiplicity
    • Unusual multiplicities usually lead to new objects or categories
  • Identify Aggregation
  • Identify Inheritance: Look for a Taxonomy, Categorize
  • Allow time for brainstorming , Iterate, iterate
summary
Summary

In this lecture, we described:

  • Identification of objects and classes
  • Refinement of objects with attributes and operations
  • Generalization
  • Associations
  • Aggregation
  • Composition
  • Multiplicity
slide54

A static class model for ABC distributing company

Create the class model using the following class relations and the

business rules:

  • An Invoice is composed of one or more Entries
  • An Invoice is created for exactly one Customer
  • An Invoice is created from one or more CustomerOrders
  • An Invoice is used to update the AccountsReceivable account
  • An Inventory is composed of zero or more StockItems
  • A PackingOrder is initiated from one or more Invoices
  • A PackingOrder is created from Inventory items
  • A PackingOrder is used to update the Inventory
  • A StockOrder is received from a Supplier
  • A StockOrder is used to update the Inventory
  • A StockOrder is used to update the AccountsPayable account
slide55

Class Diagram (a rough sketch for the above problem)

AccountsReceivable

Invoice

CustomerOrder

Account

Customer

Entry

PackingOrder

Created from

updates

Inventory

Supplier

Received from

AccountsPayable

StockItem

StockOrder

updates

updates

slide56

Notes:

  • Please refer to Design_Principles.doc, for details on:
  • Coupling
  • Cohesion
  • References:
  • Notes derived from
  • Ms. Chandrakala .C.B.,
  • Dept. of Information & Communication Technology,
  • Manipal Institute of Technology, Manipal University, India:
ad