The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Model Without a Cause

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Model Without a Cause Posted: Aug 28, 2005 7:39 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Model Without a Cause
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From David Buck - Blog

Advertisement

As Kent Beck says, Code has smells. One interesting code smell I've run into is one I call "Model Without a Cause".

I ran into it while working at a car manufacturing plant 10 years ago. They had taken a course on object oriented programming and learned about inheritance. To design a system to manage car parts, they were embarking on a taxonomy of the parts that they would model using inheritance. They had superclasses like MetalPart, SteelPart, and concrete classes like BallBearing.

I asked them what methods they would have for BallBearing that would be different than CamShaft. What happens when you need an entirely new part that you don't have a corresponding class for? What are you using these classes for in the first place?

It turns out that they just wanted to hold user-defined data for each part. We simplified the whole design down to one Part class that held onto a Dictionary of its attributes and corresponding values. The elaborate model they had been trying to create was pointless. There was no different behavior between the classes - it was just an attempt to model the parts using classes but they didn't realize that it was the behavior that was important, not the classes. As I said, it was a model without a cause.

Read: Model Without a Cause

Topic: Smalltalk for Java/C# folks Previous Topic   Next Topic Topic: WiFi in O-Hare: Spotty

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use