BASIC STRUCTURAL MODELING-I
Classes
Classes
- In object-oriented programming, programs are organized as cooperative collections of objects
- All objects are instances of a class
- A class is a description of a set of objects that share the same attributes, behaviors, relationships and semantics
- Hence, class becomes the important building block of any object-oriented system
- A class provides a blueprint for creating objects
- It can represent a software, a hardware or even a conceptual thing
- A class usually collaborates with other classes
- It is shown as a rectangle with three compartments that includes its name, attributes and operations
A Class typically has:
-Names
-Attributes
-Operations
-Responsibilities
|
Names:
- Extracted from the problem domain (statement)
- Nouns or noun phrases
- Concise and descriptive
- Path name is a class name prefixed by the name of the package in which that class lives
Attributes:
- Describe common characteristics of the objects in the class
- The values of attributes determine the state of an object
- For example, the value of the year attribute of a student indicates which year the student is studying
- They are usually nouns extracted from the problem statement
Operations:
- Operations indicate the services provided by the objects of the class
- They are usually verbs or verb phrases from the problem statement
Responsibilities:
- A Contract or obligations of a class to the users of the class means that an object of the class has to fulfill these responsibilities when requested by other objects
Post a Comment
Post a Comment