Docsity

Design Workflow-Object-Oriented Design-Lecture 16 Slides-Computer Engineering, Slides of Object Oriented Analysis and Design

Partial preview of the text

Download Design Workflow-Object-Oriented Design-Lecture 16 Slides-Computer Engineering and more Slides Object Oriented Analysis and Design in PDF only on Docsity!

Department of Computer Engineering

1 Sharif University of

Object-Oriented Design

Lecturer: Raman Ramsin

Lecture 16 : Design Workflow

Department of Computer Engineering

Sharif University of Technology

Design Workflow  The design workflow is about determining how the functionality specified in the analysis model will be implemented.  The design workflow is the primary modeling activity in the last part of the Elaboration phase and the first part of the Construction phase.  The design model contains:  design subsystems;  design classes;  interfaces;  use case realizations-design;  a deployment diagram (first-cut).

Department of Computer Engineering

Sharif University of Technology

Design Workflow: Design a Class  The Design Workflow consists of the following activities:  Architectural Design  Design a Use Case  Design a Class  Design a Subsystem

Department of Computer Engineering

Sharif University of Technology

Design Classes  Design classes are the building blocks of the design model.  Design classes are developed during the USDP activity Design a Class.  Design classes are classes whose specifications have been completed to such a degree that they can be implemented.

Department of Computer Engineering

Sharif University of Technology

Design Classes: Sources

Department of Computer Engineering

Sharif University of Technology

Design Classes: Anatomy  Design classes have complete specifications:  complete set of attributes including:  name;  type;  default value when appropriate;  visibility;  operations:  name;  names and types of all parameters;  optional parameter values if appropriate;  return type;  visibility.

Department of Computer Engineering

Sharif University of Technology

Design Classes: Well-formedness  The public operations of the class define a contract with its clients.  Completeness - the class does no less than its clients may reasonably expect.  Sufficiency - the class does no more than its clients may reasonably expect.  Primitiveness - services should be simple, atomic, and unique.

Department of Computer Engineering

Sharif University of Technology

Design Classes: Well-formedness (Contd.)  High cohesion :  each class should embody a single, well-defined abstract concept;  all the operations should support the intent of the class.  Low coupling :  a class should be coupled to just enough other classes to fulfill its responsibilities;  only couple two classes when there is a true semantic relationship between them;  avoid coupling classes just to reuse some code.

Department of Computer Engineering

Sharif University of Technology

Inheritance and Aggregation  Subclasses should always represent "is kind of" rather than "is role played by" - always use aggregation to represent "is role played by".

Department of Computer Engineering

Sharif University of Technology

Multiple Inheritance  Multiple inheritance allows a class to have more than one parent.  Of all the common OO languages only C++ has multiple inheritance.  Design guidelines:  the multiple parent classes must all be semantically disjoint;  there must be an "is kind of" relationship between a class and all of its parents;  the substitutability principle must apply to the class and its parents;  the parents should themselves have no parent in common;  use mixins - a mixin is a simple class designed to be mixed in with others in multiple inheritance; this is a safe and powerful idiom.

Department of Computer Engineering

Sharif University of Technology

Templates  Templates allow you to "parameterize" a type  create a template by defining a type in terms of formal parameters;  instantiate the template by binding specific values for the parameters.  Of all the commonly used OO languages, only C++ and Java currently support templates.  Explicit binding uses a dependency stereotyped «bind»:  show the actual values on the relationship;  each template instantiation can be named.

Department of Computer Engineering

Sharif University of Technology

Templates: Example

Department of Computer Engineering

Sharif University of Technology

Nested Classes  Defined as a class inside another class.  The nested class exists in the namespace of the outer class - only the outer class can create and use instances of the nested class.  Nested classes are known as inner classes in Java, and are used extensively for event handling in GUI classes.

Department of Computer Engineering

Sharif University of Technology

Reference  Arlow, J., Neustadt, I., UML 2 and the Unified Process: Practical Object-Oriented Analysis and Design, 2

nd

Ed. Addison-Wesley,