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
CouponThe challenge isn't just defining these classes – it is determining:
- Does an
Orderown itsOrderItems? - Should a
Customercontain aShoppingCart, or merely reference one? - Is a
PaymentGatewaypart of anOrder, or simly used by it? - Can a
Productexist without anOrder? - Should
Orderinherit fromDocument?
These question revolve around object relationship.
Choosing the correct relationship is one of the defining skills of a software designer.
Leave a comment
Your email address will not be published. Required fields are marked *
