Posted by: terryhowe | September 28, 2009

Clean Code: Objects and Data Structures

There is a place for objects and there is a place for data structures. The Law of Demeter says that a module should not know about the innards of the objects it manipulates. The exception to this rule is for data transfer objects (DTO) and active records which are a type of data transfer object. Examples of DTOs are events, messages, a row in a database table. The objects might have getters and setters and no other useful functions, so they should be represented as data structures where all the member variables are public. I find this approach very useful at times.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: