Saturday, April 16, 2005

How to Ensure the Java you Write is Procedural

Step 1, remove inheritance. Articles such as "Why extends is evil" should give enough ideas as to why you should never, ever use inheritance.

Step 2, destroy encapsulation. Make it easier and accepted to create data objects. For example, use something similar to EqualsBuilder but make it a replacement to java.lang.Object and use reflection to determine things like equality. This also leads to continual usage of getter/setter. Pass these objects around to the other "doing objects".

Step 3, prevent polymorphism. Call something IoC but instead of the usual idea only allow one implementation of a particular interface to exist. Sort of like a .h file and a .c file. This not only prevents multiple implementations of an object but also multiple instances. Great for the "doing objects".
Post a Comment