Designing Classes

1.   Designing classes
2.   Designing protocols and class visibility
3.   The UML object Constraint language
4.   Designing methods
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 time
  for developing new application
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
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
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
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
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
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
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
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
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
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
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):
Packaging and managing classes

More Related Content

PPTX
Unit4 desiging classes
PPT
Unit 4 designing classes
PPSX
MDE in Practice
PPTX
Polymorphism
PPTX
Packages
PPTX
Introduction to oop and java fundamentals
PPTX
Object oriented programming
PDF
Unit4 desiging classes
Unit 4 designing classes
MDE in Practice
Polymorphism
Packages
Introduction to oop and java fundamentals
Object oriented programming

What's hot (18)

PPTX
Lecture 1 uml with java implementation
PPTX
OOP Unit 2 - Classes and Object
PPTX
Local variables Instance variables Class/static variables
PPTX
Abstract class and Interface
PPT
PPT
Oop(object oriented programming)
PDF
Object oriented programming With C#
PPTX
OOPS – General Understanding in .NET
PPTX
Unit 4 plsql
PPT
2. Basics of Java
PDF
OOPs Concepts - Android Programming
PPTX
[OOP - Lec 01] Introduction to OOP
PPTX
Ch5 inheritance
PPTX
Better Understanding OOP using C#
PPTX
Abstract Class In Java | Java Abstract Class Tutorial | Java Tutorial For Beg...
PPT
inheritance
PDF
Metaprogramming ruby
PPTX
Basics of Object Oriented Programming
Lecture 1 uml with java implementation
OOP Unit 2 - Classes and Object
Local variables Instance variables Class/static variables
Abstract class and Interface
Oop(object oriented programming)
Object oriented programming With C#
OOPS – General Understanding in .NET
Unit 4 plsql
2. Basics of Java
OOPs Concepts - Android Programming
[OOP - Lec 01] Introduction to OOP
Ch5 inheritance
Better Understanding OOP using C#
Abstract Class In Java | Java Abstract Class Tutorial | Java Tutorial For Beg...
inheritance
Metaprogramming ruby
Basics of Object Oriented Programming
Ad

Similar to Unit 4 designing classes (20)

PPTX
Unit4 desiging classes
PPT
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
PPT
SDA ClassDiagram.ppt
PPT
Object Oriented Modeling and Design with UML
PPT
Object oriented programming in C++ programming language
PPT
Object oriented programming language in software engineering
PPT
Introduction to software engineering in data science.ppt
PPT
An Evolution of UML projects.and also what is project
PDF
Object oriented programming interview questions
PPT
Basics of uml
PDF
Software Testing and UML Lab
PPT
UML DIAGRAMS FOR IST SEMISTER OF BTECH STUDENTS
PPTX
introofUML.pptx
PPTX
PPTX
1. introduction to uml
PPTX
UNIT-2 OOM.pptxUNIT-2 OOM.pptxUNIT-2 OOM.pptx
PPT
OO Development 4 - Object Concepts
PDF
Lecture 4-oop class diagram
PPTX
Concepts of oops
PPTX
Software Engineering and Project Management - Introduction, Modeling Concepts...
Unit4 desiging classes
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
SDA ClassDiagram.ppt
Object Oriented Modeling and Design with UML
Object oriented programming in C++ programming language
Object oriented programming language in software engineering
Introduction to software engineering in data science.ppt
An Evolution of UML projects.and also what is project
Object oriented programming interview questions
Basics of uml
Software Testing and UML Lab
UML DIAGRAMS FOR IST SEMISTER OF BTECH STUDENTS
introofUML.pptx
1. introduction to uml
UNIT-2 OOM.pptxUNIT-2 OOM.pptxUNIT-2 OOM.pptx
OO Development 4 - Object Concepts
Lecture 4-oop class diagram
Concepts of oops
Software Engineering and Project Management - Introduction, Modeling Concepts...
Ad

More from gopal10scs185 (20)

PPT
Unit three identifying actors
PPT
Unit 5 testing
PPT
PPT
Unit 5 usability and satisfaction test
PPT
Unit 5 testing -software quality assurance
PPT
PPT
Unit 3 object analysis-classification
PPT
Unit 3 attributes, methods, relationships
PPT
PPT
Design rule 31
Unit three identifying actors
Unit 5 testing
Unit 5 usability and satisfaction test
Unit 5 testing -software quality assurance
Unit 3 object analysis-classification
Unit 3 attributes, methods, relationships
Design rule 31

Recently uploaded (20)

PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PDF
4 layer Arch & Reference Arch of IoT.pdf
PDF
sustainability-14-14877-v2.pddhzftheheeeee
DOCX
search engine optimization ppt fir known well about this
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PPTX
Module 1 Introduction to Web Programming .pptx
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
STKI Israel Market Study 2025 version august
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Consumable AI The What, Why & How for Small Teams.pdf
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
4 layer Arch & Reference Arch of IoT.pdf
sustainability-14-14877-v2.pddhzftheheeeee
search engine optimization ppt fir known well about this
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Enhancing plagiarism detection using data pre-processing and machine learning...
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
Taming the Chaos: How to Turn Unstructured Data into Decisions
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
Module 1 Introduction to Web Programming .pptx
Convolutional neural network based encoder-decoder for efficient real-time ob...
giants, standing on the shoulders of - by Daniel Stenberg
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
STKI Israel Market Study 2025 version august
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
OpenACC and Open Hackathons Monthly Highlights July 2025
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Consumable AI The What, Why & How for Small Teams.pdf

Unit 4 designing classes

  • 1. Designing Classes 1. Designing classes 2. Designing protocols and class visibility 3. The UML object Constraint language 4. Designing methods
  • 2. Introduction • Designer has to know – Specification of the class – interaction of that class with other classes
  • 3. Object oriented design philosophy • Designing class with reusability in mind -> more gain in productivity and reduce the time for developing new application
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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):