Friday, January 18, 2013

Whats wrong with IoC and Spring?

My main concern with Spring and the Inversion of Control paradigm is that it encourages the separation of data from operations on the data. In the typical Spring project model classes carry the data and service classes contain operations on that data. So what's wrong with that? It breaks the best feature of Object Oriented software dev, the fact that the data "knows" what operations are available. As an IDE user you just need to press the magical dot which will give you a menu of methods to call. That is great because the knowledge of the programmer that created the class is now built-into the class itself. When the methods are moved into a separate service class the magical dot does not work any more. That is a big deal.

Does it have to be like this with IoC and Spring? I don't know yet. Since it's more or less impossible for an indenpendant Java consultant to avoid projects that uses Spring I'm reading Spring in Action. I've already read quite a bit on IoC but I thought I'd better learn some more practical struff. I will probably get back to this topic in the future.
Post a Comment