Thursday, December 07, 2006

Java?


I'm doing some Java coding. One of the things I find most weird about most Java programs is how much cruft there is - not in old weird programs, but in well maintained, TDD produced, Agile-approved code. I think the language encourages you to create lots of objects that no well defined purpose in life.



What do I mean by well defined purpose? Here are some warning signs your class is pointless:


  • Your interface has no methods whatsoever.
  • Your methods just call super versions of themselves.
  • Your methods don't really seem to actually _do_ much.
  • You seem to only exist to store data to return from another method.

And the list could go on. All of these are artifacts of the fact that in Java, everything, but everything, must be an Object. But, not everything actually is an object. So the problem is you have objects where you may not actually need or want objects.



If you want more, try reading Execution in the Kingdom of Nouns

No comments: