Your SlideShare is downloading. ×
0
Designing Classes1.   Designing classes2.   Designing protocols and class visibility3.   The UML object Constraint languag...
Introduction• Designer has to know  – Specification of the class  – interaction of that class with other classes
Object oriented design philosophy• Designing class with reusability in mind ->  more gain in productivity and reduce the t...
UML Object Constraint Language(OCL)•   The rules and semantics of UML are expressed using OCL•   OCL     – Specification l...
Designing classes : process• Apply design axioms to design calsses , their  atribute, methods and association , structures...
Class visibility: desiging well defined    public , private and protected                 protocols• 2 problems in designi...
Internal layer• Defines the implementation of the object• Apply axioms and corollaries ( corollary 1) to  decide what to p...
External layer• Design the functionality of the object• Public protocol  – Defined to pass message bw associated classes  ...
Encapsulation leakage• lack of well designed protocol leads to this  problem• Encapsulation leakage occurs when details  a...
Refining attribute• Attribute   – Represents the state of the object• Analysis phase -> name of the attribute is sufficien...
UML attribute presentation• OCL is used in the design phase to define the  class attributes• Attribute presentation  – Vis...
Designing methods and protocols• Specifying the algorithm for methods  – By using formal structure (ex uml activity diag) ...
Design issues : avoiding pitfalls• Better to have Large set of simple classes than  few large , complex classes  – Initial...
UML Operation presentation• Visibility name: (Parameter list ) : return-type-expression   – Visibility       • Public visi...
Packaging and managing classes
Upcoming SlideShare
Loading in...5
×

Unit 4 designing classes

485

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
485
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Unit 4 designing classes"

  1. 1. Designing Classes1. Designing classes2. Designing protocols and class visibility3. The UML object Constraint language4. Designing methods
  2. 2. Introduction• Designer has to know – Specification of the class – interaction of that class with other classes
  3. 3. Object oriented design philosophy• Designing class with reusability in mind -> more gain in productivity and reduce the time for developing new application
  4. 4. UML Object Constraint Language(OCL)• The rules and semantics of UML are expressed using OCL• OCL – Specification language – Uses simple logic to specify the properties of the system• UML modeling constructs requires expression. some example as follow – Item.selector • Item -> object • Selector -> attribute • Ex : kathir.regno – Item.selextor[qualifier-value] • Qualifier is uesd to select related values • Ex: – Kathir.phone[2] – Set->select ( Boolean expression) • Company.employee->salary>20000
  5. 5. Designing classes : process• Apply design axioms to design calsses , their atribute, methods and association , structures, amd protocols – Refine and complete the static uml class diagrams by adding details to that design • Refine attribute • Design methods and protocols – Uses uml activity diagram to represent algorithm • Refine the association bw classes • Refine class hierarchy and design with inheritance – Iterate and refine
  6. 6. Class visibility: desiging well defined public , private and protected protocols• 2 problems in designing methods or attributes of class – Protocol or interface to the class operation and its visibility – How it is implemented• Protocol layers – Private protocol – Protected protocol – Public protocol
  7. 7. Internal layer• Defines the implementation of the object• Apply axioms and corollaries ( corollary 1) to decide what to private• Private protocol – Includes messages that should not be sent from other objects – Accessible to only operations of that class• Protected protocol – Methods and attributes can be used by class itself or its subclass
  8. 8. External layer• Design the functionality of the object• Public protocol – Defined to pass message bw associated classes – Interpretation and implementation of each message is up to the individual classes
  9. 9. Encapsulation leakage• lack of well designed protocol leads to this problem• Encapsulation leakage occurs when details about classes internal implementation are disclosed through the interface
  10. 10. Refining attribute• Attribute – Represents the state of the object• Analysis phase -> name of the attribute is sufficient• Design phase -> detailed information must be added• Attribute types – Single valued attribute • Ex: dob of the student – Multiplicity or multivalue attribute • Subjects handled by the staff – Reference to another object or instance connection • Person hold the account
  11. 11. UML attribute presentation• OCL is used in the design phase to define the class attributes• Attribute presentation – Visibility name : type-expression = initial-value – Visibility • Public visibility : + • Protected visibility : # • Private visibility : - – Type expression • Language dependent specification of the type – Initial value • Language dependent expression for the initial value
  12. 12. Designing methods and protocols• Specifying the algorithm for methods – By using formal structure (ex uml activity diag) with OCL• Types of methods – Constructor – Destructor – Conversion method – Copy method – Attribute set – Attribute get – IO methods – Domain specific
  13. 13. Design issues : avoiding pitfalls• Better to have Large set of simple classes than few large , complex classes – Initially class might be too big – Apply design axioms and corollary • to reduce the size • Improve reusability
  14. 14. UML Operation presentation• Visibility name: (Parameter list ) : return-type-expression – Visibility • Public visibility : + • Protected visibility : # • Private visibility : - – Name • Name of the operation – Parameter list • List of parameters each specified by – Name : type expression = default value – Return type expression – Ex: • + withdraw(amount:type):
  15. 15. Packaging and managing classes
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×