0% found this document useful (0 votes)
42 views13 pages

Class Responsibility: Identifying Attributes and Methodsssification

This document discusses identifying the attributes and methods of classes by analyzing use cases and UML diagrams. It provides guidelines for determining attributes, such as corresponding them to nouns, and methods, such as corresponding them to queries about attributes. Each class's responsibility is identified by analyzing how it will be used and collaborate with other classes based on the system's overall responsibility.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views13 pages

Class Responsibility: Identifying Attributes and Methodsssification

This document discusses identifying the attributes and methods of classes by analyzing use cases and UML diagrams. It provides guidelines for determining attributes, such as corresponding them to nouns, and methods, such as corresponding them to queries about attributes. Each class's responsibility is identified by analyzing how it will be used and collaborate with other classes based on the system's overall responsibility.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

Class Responsibility:

Identifying Attributes and


Methodsssification
Class Responsibility:
Identifying Attributes and Methods

•Identifying attributes and methods, like finding


classes, is a difficult activity.
•The use cases and other UML diagrams will be
our guide for identifying attributes, methods, and
relationships among classes.
Identifying Class Responsibility by
Analyzing Use Cases and Other UML
Diagrams

•Attributes can be identified by analyzing


the use cases, sequence/collaboration,
activity, and state diagrams
Responsibility
•How am I going to be used?
•How am I going to collaborate with
other classes?
•How am I described in the context of
this system's responsibility?
•What do I need to know?
•What state information do I need to
remember over time?
•What states can I be in?
Assign Each Responsibility To
A Class
•Assign each responsibility to the class that it
logically belongs to.
•This also aids us in determining the purpose
and the role that each class plays in the
application.
Guidelines For Identifying
Attributes Of Classes
•Attributes usually correspond to nouns
followed by possessive phrases such as
cost of the soup.

•Keep the class simple; only state enough


attributes to define the object state.
Guidelines For Identifying
Attributes Of Classes

• Attributes are less likely to be fully described in


the problem statement.
• You must draw on your knowledge of the
application domain and the real world to find
them.
• Omit derived attributes.
• For example, don't useage as an attribute since
it can be derived from date of birth.
• Drive attributes should be expressed as a
method.
Object Responsibility: Methods
& Messages
•Methods and messages are the work horses of
object-oriented systems.
•In O-O environment, every piece of data, or
object, is surrounded by a rich set of routines
called methods.
Identifying Methods by
Analyzing UML Diagrams and
Use Cases
•Sequence diagrams can assist us in
defining the services the objects must
provide
Identifying Methods
•Methods usually correspond to queries about
attributes (and sometimes association) of the objects.
•Methods are responsible for managing the value of
attributes such as query, updating, reading and
writing.

For example, we need to ask the following questions
about soup class:
•What services must a soup class provide? And
•What information (from domain knowledge) is soup
class responsible for storing?
Identifying Methods

Let's first take a look at its attributes which
are:
•name
•preparation,
•price,
•preparation time and
•oven temperature.
Identifying Methods
•Now we need to add methods that can maintain
these attributes.
•For example, we need a method to change a
price of a soup and another operation to query
about the price.
Identifying Methods

SetName
•getName
• setPreparation
• get Preparation
• setCost
• getCost
• setOvenTemperature
• getOvenTemperature
• setPreparationTime
• getPreparationTime

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy