Notices
Notice: Exam Form BE IV/II & BAR V/II (Back) for 2076 Magh
Routine: BE IV/II & BAR V/II - 2076 Magh
Result: BCE I/II exam held on 2076 Bhadra
Result: All (except BCE & BEI) I/II exam held on 2076 Bhadra
Notice: Exam Center for Barrier Exam (2076 Poush), 1st Part
View All
View Old Questions
Computer Engineering(BCT)
Electrical Engineering(BEL)
Electronics and Communication(BEX)
View All
View Syllabus
Computer Engineering(BCT)
Electrical Engineering(BEL)
Electronics and Communication(BEX)
View All

Notes of Object Oriented Analysis and Design [CT 651]

Object Oriented Design

 

Analysis to Design

Input

- The output of object oriented analysis is provided as input to object oriented design.
- Analysis and design may occur in parallel with incremental and iterative process.
- Conceptual model, use case, system sequence diagram, UI documentation and relational data model are the input artifacts.


Design

- With the help of the input artifacts, we can conclude the following:
1. Define object and class diagram from conceptual model.
2. Attributes are identified.
3. A description of solution to a common problem (design patterns) are used.
4. Application framework is defined.
5. The persistent objects or data are identified.
6. The remote objects are identified and defined.


Output

- Sequence diagram and design class diagram are the typical output artifacts of object oriented design.
- The comparison of analysis model and design model is shown in given table:

Analysis Model Design Model
  • Classes
  • Attributes
  • Methods
  • Relationships
  • Behavior
  • Objects
  • Data Structures
  • Algorithm
  • Messaging
  • Control

 


Describing and Elaborating Use Cases

Class Responsibility Collaboration (CRC) Cards

- It is a text oriented modelling techniques or tools used in design of object oriented software.
- It is a paper index cards in which the responsibilities and collaborators of classes are written.
- Each card represents a single class.
- The general format of CRC card is shown below:

Class Name
Responsibilities Collaborators

 


Realization of Use Cases

- It represents the implementation of use case in terms of collaborating objects.
- It may include textual document, class diagrams of participating classes and interaction diagrams.


UML Interaction Diagram

- Interaction diagram shows how objects interact via messages.
- It is used for dynamic object modelling.
- It is of two types. They are as follows:
1. Sequence diagram
2. Communication or collaboration diagram


Sequence Diagram

- A sequence diagram shows the interaction among objects as a two dimensional chart, in a fence format, in which each new object is added to the right.
- The objects participating are shown at the top of the chart as boxes attached to a vertical dashed line.
- The name of object with a semicolon separating it from the name of the class is written inside the box.
- The name of object and the class is underlined.
- The vertical dashed line indicates the lifeline of objects.
- The rectangle drawn on the lifeline is called activation symbol, which indicates that the object is active as long as the rectangle exists.
- Each message is indicated as an arrow between the lifeline of two objects.
- The messages are shown in chronological order.
- Each message is labeled with the message name.


Advantages:

- It shows the time sequence of messages.
- It has large set of detailed notation options.


Disadvantages:

- It is forced to extend to right when new objects are added, which consumes horizontal space, making it difficult to view by the user.

Basic Notations

uml-sequence-diagram


Collaboration Diagram

- Collaboration diagram shows both structural and behavioral aspects.
- Structural aspect includes objects and link between them.
- It illustrates the object interactions in a graph format in which objects can be placed anywhere.
- The link between objects is shown as a solid line.
- The messages are labelled with a arrow and prefixed with sequence number.


Advantages:

- It is flexible to add new objects.


Disadvantages:

- It is difficult to know the sequence of messages.
- It includes fewer notation options.


Basic Notations:

1. Class

Sale

 

2. Instance

:Sale

 

3. Named instance

S1 : Sale

 

4. Messages
seq no return := message (parameter : parameterType) : returnType ---------------->

5. Links
---------------------------------

6. Conditional messages
1[color = red] : calculate() --------------->

7. Iteration
1 * [r = 1 .. N] : num := nextInt()


Objects and Patterns

Patterns

- Patterns is a way of doing something.
- Design pattern is a category of patterns that deals with object oriented software.
- Design pattern is a general repeatable solution to a commonly occurring problem in software design.
- It is a description for how to solve a problem that can be used in many different situations.


Components

1. Pattern Name
2. Pattern Description
3. Solution
4. Consequences


Advantages

- It reduces a complex form to a simple one.
- It provides clear concept of the problem and its solutions.
- It provides a mean to model a good solution.
- It facilitates communication.


Usage

- It can speed up the development process, so used in Rapid Application Development (RAD)
- It provides a general solution, so can be used in any platform.


GRASP Design Pattern

- GRASP stands for General Responsibility Assignment Software Patterns.
- These principles are important to design object oriented software.
- It guides choices in where to assign responsibilities.

1. Information Expert:
- Problem : Which class should be responsible for doing certain things?
- Solution : Assign responsibility to the class that has the information necessary to fulfill the required responsibility.
- It describes that the objects do things related to the information they have.

2. Creator:
- Problem : Who should be responsible for creating a new instance of some class?
- Solution : Assign class B the responsibility to create an instance of class A if one or more of the following is true:
a) B aggregates A objects.
b) B contains A objects
c) B records instances of A objects
d) B closely uses A objects
- If more than one option applies, prefer a class B which aggregates class A.

3. High Cohesion:
- Problem : How to keep objects focused, understandable and manageable?
- Assign responsibility so that cohesion remains high.
- Cohesion is a measure of how strongly the responsibilities of an element are related.
- An element with highly related responsibilities and which does not do a tremendous amount of work has high cohesion.
- The classes with low cohesion suffers from:
a) hard to comprehand
b) hard to reuse
c) hard to maintain
d) constantly affected by change

4. Low Coupling:
- Problem : How to support low dependency, low change impact and increased reuse?
- Assign responsibility so that coupling remains low.
- Coupling is a measure of how strongly one element is connected to other elements.
- The class with high coupling suffers from:
a) forced local changes
b) harder to understand in isolation
c) harder to reuse

5. Controller:
- Problem : What first object beyond UI controls a system operation?
- Assign responsibility to a class representing one of the following choices:
a) Represents overall system
b) Represents a use case scenario within which system events occur


Frameworks

- Framework is a group of concrete classes which can be directly implemented on an existing platform.
- They are written in programming languages.
- They are concerned with specific application domain.


Patterns vs Frameworks

- Pattern is a concept while framework is code to be used.
- Pattern supports reuse of software architecture and design while framework supports reuse of detailed design and code.


Model View Controller (MVC) Framework

- It is a software architectural pattern to implement UI.
- It divides the given software application into three inter connected parts, to separate internal representation of information from the ways they are presented to the users.
- The central component is model that captures the behavior of the application independent of UI. It manages data, logic and rules of the application.
- A view can be any output representation of information visible to the users.
- The controller accepts input and converts it to commands for the model or view. It links model and view together.

mvc


Determining Visibility

Visibility

- It is the ability of an object to have a reference to another object.
- It indicates the scope of the objects.
- For a sender object to send message to a receiver object, the sender must be visible to the receiver.


Attribute Visibility

- Attribute visibility from A to B exists when B is an attribute of A.
- It is relatively permanent i.e. it persists as long as A and B both exists.


Parameter Visibility

- Parameter visibility from A to B exists when B is passed as a parameter to a method of A.
- It is relatively temporary i.e. it exists within the scope of the method.
- It is generally transformed into attribute visibility within a method.


Local Visibility

- Local visibility from A to B exists when B is declared as a local object within a method of A.
- It is temporary as it persists only within the scope of the method.
- It can be achieved by:
1. Create a new local instance and assign it to local variable.
2. Assign returning object from a method invocation to a local variable.


Global Visibility

- Global visibility from A to B exists when B is global to A.
- It is permanent.
- It can be achieved by:
1. Assign an instance to a global variable.


Visibility in UML

1. Public
- Any outside classifier with the visibility to the given classifier.
- It is denoted by '+'

2. Protected
- Any descendant of classifier can use this feature.
- It is denoted by '#'

3. Private
- Only the classifier itself can use the feature.
- It is denoted by '-'


Visibility Example

The example that shows details of the visibility is shown in figure below:

visibility


Class Diagram

- Class diagram is used for static modeling that illustrates classes, interfaces and their relationships.
- It shows the structural view of the system.


Types of Relationships

1. Association:
- It enables objects to communicate with each other.
- It describes a connection between classes.
- A link is the physical or conceptual connection between object instances.
- The association relationship of a class with itself is known as recursive association.
- It is represented by drawing a straight line between concerned classes.
- Arrow head can be used to indicate reading direction.
- The multiplicity is noted on each side.

2. Aggregation:
- It is the association in which the involved classes represent a whole-part relationship.
- It takes the responsibility of leadership.
- When an instance of one object contains instances of some other objects, then aggregation exists between composite object and component object.
- It is represented by a diamond symbol at the end of a relationship.
- It can never be recursive and symmetric.

3. Composition:
- It is the strict form of aggregation, in which the parts are existence-dependent on the whole.
- It is represented as a filled diamond drawn at composite end.
- The part instance can only be the part of one composite at a time.
- Creation and deletion of parts is managed by composite.

4. Inheritance (Generalization and Specialization):
- It describes 'is a kind of' relationships between classes.
- Object of derived class inherits the properties of base class.
- It is defined statically.

5. Dependency:
- It indicates that one element has knowledge of another element.
- It states that a change in specification of one thing may affect another thing using it, but not necessarily the reverse.
- It depicts non-attribute visibility between classes.

6. Realization:
- It indicates the implementation of functionality defined in one class by another class.

relationships


Attributes

- The format of attribute is given as:

            visibility name : type       multiplicity = default  {property - string}

 


Association Class

- It allows you treat an association itself as a class.

associationclass


Constraints

- It is visualized in text between braces.

constraints


Qualified Association

- It is the association with a qualifier.

qualifiedassociation

Sponsored Ads