Java Reference
In-Depth Information
Figure 4
An Invoice
536
537
When finding classes, keep the following points in mind:
ȗ
A class represents a set of objects with the same behavior. Entities with
multiple occurrences in your problem description, such as customers or
products, are good candidates for objects. Find out what they have in common,
and design classes to capture those commonalities.
ȗ
Some entities should be represented as objects, others as primitive types. For
example, should an address be an object of an Address class, or should it
simply be a string? There is no perfect answerȌit depends on the task that you
want to solve. If your software needs to analyze addresses (for example, to
determine shipping costs), then an Address class is an appropriate design.
Search WWH ::




Custom Search