Friday, November 21, 2014

Java-OOP fermentation


Java is a wonderful language. No doubt about that. Almost all my generation of university students were taught java. Most of them who became software engineers end up doing Java for the rest of their lives. Java and Object oriented principles (OOP) (also taught in uni) complements each other very well. If you love Java, you love OOP. When you only work with Java and OOP for years, with every passing year, there is something happening in-side you. I call it "Java-OOP fermentation". While fermentation has a positive effect on milk hence yoghurt, it has less desirable outcome on Java and OOP.

Here are some clues to know whether your Java-OOP is fermented.
  1. Your day-today thinking is based on objects and behaviours. Ball is an object and bounce is a behaviour of that object for you. ;)  (which is horribly wrong)
  2. When you see a class full of static methods,  you go "WTF?" and remove statics.
  3. You instantly vomit on your desk and leave the office if you happen to see a new key word.
  4. You believe that the purpose of life is to inject more and more beans as dependencies to surrounding beans.
  5. You usually get in to bar fights while arguing IOC is not DI.
  6. You believe, Mockito is not a mocking framework. Its the meaning of testing.
  7. You feel miserable, when someone refer to one of your stubs as a mock, and you instantly interrupt the conversation and correct them "Well..Its not a mock, its a stub"
  8. You either believe 1) Never test Private methods. Never. or I kill you. or 2) Test every method, or I kill you.
  9. You feel, POJOs are the purest form of code and extracted from earth.
  10. You wonder why "Organic" is not part of - POJO.
  11. You feel, annotations are so synthetic and never mix with your organic POJOS.
  12. You are big on layers.
  13. You love data transfer objects. To transfer data among Layers. Then Mappers. Enrichers...!
  14. Your DTOs lives in their own layers. (more layers)
  15. You usually get in to bar fights while discussing what level of testing you should do, Unit or Integration or functional and who does what.
  16. For you, curly braces defines the scope of everything. You are big on where to put the curly braces and they should ALIGNE !!
  17. For you, a language without curly brace is no language. Period.
  18. Your head spins and feeling bloated if you happen to see a Clojure snippet.
  19. You are proud of the speed of  for loop and you really feel it when it loops, and you think its mechanical sympathy.
  20. You use ORM. Use Hibernate. All the way. Everyday.
  21. You think, ORMs ? NO WAY ! It kills performance. Lets hand code SQL. All the way. Everyday.

The list goes on.. ;)

Non of these are essentially wrong. Actually, all these are fine and should consider doing in moderate. But not every time, every day, every where. There is no silver bullet, and there is no *one absolute right way*.  But once your Java-OOP fermented, you become highly opinionated and end up choosing camps. For an instance, if you can't think of writing unit tests without mocking the world using Mockito ? There is certainly something wrong !


No comments: