Python Rocks! and other rants
Weblog of Kent S Johnson

2004-04-03 15:33:04

A place for everything and everything in its place

One of the keys to good object-oriented design is figuring out where to put things.

In general I'm suspicious of classes that are just containers for data with some getters and setters. Certainly there are times when they are needed but I generally look for ways to give them more to do. Usually there are some methods that can go into the bean classes.

Martin Fowler's Refactoring book has a smell for Data Classes (pp 86-87). Here is a great quote: "Data classes are like children. They are ok as a starting point, but to participate as a grownup object, they need to take some responsibility."

 
© Kent S Johnson Creative Commons License

Comments about life, the universe and Python, from the imagination of Kent S Johnson.

kentsjohnson.com

Weblog home

All By Date

All By Category

Essays

XML-Image

BlogRoll