Updated on 29 Jun, 20264 mins read 11 views

Writing individual classes is only a small part of software design. Real-world software systems consists of hundreds or thousands of objects that interact to solve business problems. The quality of these interactions largely determines whether a system is maintainable, extensible, and easy to understand.

Consider a simple online shopping system:

Customer
Order
Product
ShoppingCart
Payment
Invoice
Warehouse
Shipment
Discount
Coupon

The challenge isn't just defining these classes – it is determining:

  • Does an Order own its OrderItems?
  • Should a Customer contain a ShoppingCart, or merely reference one?
  • Is a PaymentGateway part of an Order, or simly used by it?
  • Can a Product exist without an Order?
  • Should Order inherit from Document?

These question revolve around object relationship.

Choosing the correct relationship is one of the defining skills of a software designer.

Buy Me A Coffee

Leave a comment

Your email address will not be published. Required fields are marked *