So without further ado here we go.
Use Spring Less.
I plan to use vastly less Spring this year.
Now Spring has pretty much become the de facto component framework in the Java ecosystem. This is not a bad thing; that is until every software nail must be nailed flat with the Spring hammer.
I been on the Spring Bandwagon now since about 2005 when Spring was still the breath of fresh air promising to save us from the evil Darth Ee-jay-bee. From about that time every developer with a glint in their eye and a will to type has tried to shoehorn everything to "integrate" into Spring.
Again this is not necessarily bad, however I work for a company where the perception is that anything prefixed with the word "Spring" is automatically better, sometimes coming at the cost of something that is actually better.
But lets not stop there...
- I'm tired of the "For Real?" look I get from my developers when they are debugging Spring configuration and they ask my why Spring is better.
- I'm tired of the massive War files I get and often the dependency clashes I have to fix because of the other stuff I need to pull in.
So this new year I plan to use Spring in it's pure simple form.
Stop treating JPA/Hibernate as the one stop shop for Java based persistence.
I want to use something besides JPA/Hibernate to do persistence this year, I want to do this because of the following:
- I want to have POJOs that are still POJOs at runtime.
- I want to stop having weird hibernate exceptions that happen after we've been in production for a bit, and then have my customer stop screaming at me.
- I want to stop having the rich domain model being so tantalisingly close to my grasp only to have it all come crashing down when the realities of ORM kick in.
- In reference to the previous point: I hate DAOs; JPA/Hibernate don't make them go away (at least not completely).
- I'm tired of the "For Real?" look I get from my developers when they are debugging JPA/Hibernate issues and I'm explaining to them how JPA/Hibernate simplifies things.
Now to fair a lot of the points listed is because JPA/Hibernate does a lot of complex heavy lifting on my behalf, but in many cases the power is just not needed.
Stop using Anonymous Inner classes and just bite the bullet and wait for 8.
I've been excited about the inclusion of closures in Java for a long, long time. I am a self confessed "closurist " and I fully plan to find as I many nails as I can when I get my closure powered hammer.
But I also have to accept that Java 8 especially in full production use is still going to be some ways away.
And before that I resolve to resist the temptation to butcher code with anonymous inner classes in order to recreate that style of coding.
Stop worrying about the procedural code.
Hah! bet you never saw that one coming.
I've been looking at the code that we produce, typically I do a lot of SOAP web services in my job, and what I see a lot of is that while we normally try to stick to SOLID principles, I don't see a lot of value coming out of the abstractions we create.
We have an anaemic domain model and most of the work is done in the Service tier implementation delegating to DAOs for data operations (although I've started introducing newer patterns here).
I can't help feel that had I done this code in pure C it probably wouldn't feel massively different. To this end I sometimes wonder if all we do is procedural code with a bit of OO sauce on top.
I also wonder is this is necessarily a bad thing; the code works, it's simple to follow and read and is not burdensome to maintain, so this coming year I plan to to stop worrying about it :)
1 comment:
Exactly my thought about the procedural programming!
I've been wondering those last years, using Spring and EJB3, if we're really doing OOP. I don't really think so. It looks more like functions that process data (DAOs, Services, etc) or pull data for our views. Objects here, only serve as containers of data, or structs in C language, really.
The OOP here is just the syntactic sugar, i think. I do recognize the need, however to have objects that are managed by a container (be it Spring, or the AS, or whatever).
But i've reached the conclusion, like you, that i shouldn't really worry about this. What with this new functional programming that kind of promotes other styles aside from OOP.
But i can't help feeling that as things are today, i have a hard time trying to explain even to myself why "our" OOP is any better than good ol' procedural.
Post a Comment