The modeling helps with understanding the domain and in solving the actual problem.
The problem is that in fact, no, OOP modeling regularly doesn't actually help with understanding the domain. Why? Because it promotes the illusion that you're "mirroring" the problem domain with classes, IS-A and HAS-A relationships, when in tons of cases your classes, operations and types need to be different from the problem domain.
The circle/ellipse problem is the classic example here. Why does the problem arise? Because while a geometrical circle IS-A geometrical ellipse, it doesn't follow that a Circle object IS-An Ellipse object. And the reason for this is that the type-subtype relationships in a programming language depend on the operations supported by the types, not on the sort of domain object that they're intended to model.
But isnt that the point of classes, to make new types so the program operates on them, and the types are a model of the domain? And your example only points out the flaws of the IS-A relationship, which is widely accepted as bad practice.
4
u/sacundim Feb 24 '12
The problem is that in fact, no, OOP modeling regularly doesn't actually help with understanding the domain. Why? Because it promotes the illusion that you're "mirroring" the problem domain with classes, IS-A and HAS-A relationships, when in tons of cases your classes, operations and types need to be different from the problem domain.
The circle/ellipse problem is the classic example here. Why does the problem arise? Because while a geometrical circle IS-A geometrical ellipse, it doesn't follow that a Circle object IS-An Ellipse object. And the reason for this is that the type-subtype relationships in a programming language depend on the operations supported by the types, not on the sort of domain object that they're intended to model.