When it comes to identifying attributes in object-oriented design, the task might seem daunting. But don’t worry — I’ve got some practical tips that will make it easier. Heuristics for determining attributes help us distinguish between classes and their properties, further ensuring we create well-defined models. Here’s how I approach it.
Noun in Combination with a Genitive
Firstly, one trick I use is to look for nouns combined with a genitive. This typically points directly to an attribute. The structure usually reads analogous to “the X of the Y,” where “X” is an attribute of the class “Y.” For instance:
- The date of the order
- The diameter of the circle
- The color of the car
In each of these examples, it’s clear that the attribute (date, diameter, color) belongs to a specific class (order, circle, car). Hence, what I love about this method is its simplicity. The sentence itself often gives away the class and its attribute without further interpretation.
Sentence Construction: Has
Another method that works for me is identifying sentences where a class “has” something. This often indicates an attribute. For example:
- A person has a date of birth
- An address has a postal code
- The process has a transition time of…
These sentences suggest that the “has” relationship points to an attribute within a class. It’s straightforward. Moreover, this construction can also reveal relationships between classes.
Adjective in Combination with a Noun
Next, I consider adjectives combined with nouns. This combination usually hints at an attribute. Thus, consider these examples:
- A fast car
- A large display
- A huge bank account
- A red car
- A black list
In these cases, adjectives describe a specific instance of a class, pointing to an attribute that needs to be identified. For instance, “large display” suggests that “size” is the attribute of the class “display.”
Sentence Structures: is
Sometimes, I encounter sentences structured as “ is ”. This structure doesn’t directly state the attribute but provides its value. For instance:
- If the person is an adult…
- If the application is approved…
Here, “adult” and “approved” are values of attributes like “age” and “status.” In this case it is essential to dig deeper and understand that the value refers to an attribute of the class, not the class itself.
Differentiating Objects
Finally, I always ensure that my objects are uniquely distinguishable. This is crucial in object-oriented modeling. To achieve this, I use different values of attributes to make each object unique. For example:
- Modeling an object like “James Miller” with just two attributes — first name and last name — might not be enough. Adding a date of birth ensures that even if there’s another James Miller, the two can be distinguished.
In this case, “date of birth” serves as a critical attribute that differentiates objects within the same class.
Conclusion
In summary, heuristics for determining attributes involve a mix of language cues and logical analysis. By carefully examining the structure of sentences and the uniqueness requirements of objects, I can effectively identify and distinguish attributes. It’s a methodical approach that simplifies the modeling process, and with practice, it becomes second nature.
By integrating these strategies into your work, you’ll find that distinguishing attributes from classes becomes much easier. And don’t forget, graphical illustrations can be incredibly helpful in visualizing these concepts, making them easier to grasp for both you and your audience.
This text is based on content from the source: International Requirements Engineering Board (ireb.org). The International Requirements Engineering Board is the owner of the copyright.
Read more about Confluence and How to Create a Space in Confluence Access Confluence and Jira for free Use shortcuts in Confluence Assign a task in Confluence Create a Confluence space from a template |