P
Philipp
Hello
My (simplified) understanding of OO design is, that objects are used
to hide data and processing and instead are oriented towards providing
a "service" to the client. In short: put relevant data in your objects
and provide a public interface to do something useful (abstracted)
with this data. In particular, hide implementation details.
Now I more and more come accross designs where data is not really
hidden (eg. some sort of beans where every field has a getter and
setter). Or where objects are used as pure data holders and some
sibling class does the work on the data (eg. MVC or JAXB unmarshalled
objects).
Also, one of the ever-repeated mantras for good design is to favor
lose binding between objects.
It is not clear to me how to bring these three concepts together in a
good design.
I can imagine a class structure where there is a wrapper class around
each data object. Where the data object really just holds the data and
provides access to it, but no real invariants are implement, except
maybe very simple ones (eg. null data allowed or not). Where the
wrapper class implements the public interface and aggregates the data
object. Where serialization is done on the data object alone.
Is this good design?
Do you have other advises on how to build a robust class structure?
(links to literature are welcome)
Thanks Phil
My (simplified) understanding of OO design is, that objects are used
to hide data and processing and instead are oriented towards providing
a "service" to the client. In short: put relevant data in your objects
and provide a public interface to do something useful (abstracted)
with this data. In particular, hide implementation details.
Now I more and more come accross designs where data is not really
hidden (eg. some sort of beans where every field has a getter and
setter). Or where objects are used as pure data holders and some
sibling class does the work on the data (eg. MVC or JAXB unmarshalled
objects).
Also, one of the ever-repeated mantras for good design is to favor
lose binding between objects.
It is not clear to me how to bring these three concepts together in a
good design.
I can imagine a class structure where there is a wrapper class around
each data object. Where the data object really just holds the data and
provides access to it, but no real invariants are implement, except
maybe very simple ones (eg. null data allowed or not). Where the
wrapper class implements the public interface and aggregates the data
object. Where serialization is done on the data object alone.
Is this good design?
Do you have other advises on how to build a robust class structure?
(links to literature are welcome)
Thanks Phil