Home > Uncategorized > Spring AOP autowiring scares the poopoo out of me

Spring AOP autowiring scares the poopoo out of me

Usually brains are quick to sort everything into one of two categories: GOOD and BAD

Some things refuse to go to either category or, even worse, ping pong back and forth until who knows what else gets scrambled up there. My brain still struggles with categorizing the following…

 The Scala Language

 Candy Corn

Richard Simmons Richard Simmons

Until now, autowiring in Spring was somewhere between Candy Corn and Richard Simmons. Let me explain how it got there.

Every ounce of logic in me had been screaming that autowiring is a good thing because it takes away a bad thing: XML. Autowiring should cannonball at light speed into the GOOD half of my brain pool, splashing memories of Oregon Trail out my nose.

But the brain isn’t very logical. It’s mostly associations. We often get hunches, gut feelings, and red flags but we can’t always articulate or why. 

Saturday morning (you’d think I’d have better things to do) I finally realized why it’s so hard to let go of XML, this melted green icing of our framework cake. When I inherit a project here’s what I do get my bearings, since there’s absolutely no documentation available because some ivory tower Architecture committee banned wikis for “security reasons” yet our division was too cheap to get SharePoint and too disorganized to keep a few Word docs on a shared drive (yes this is from past experience):

1) Read the JavaDoc. There are only two types of information here: author names (I commit these to memory so I can retrieve formal apologies – it’s a small world and I will meet these people some day) and some banal rewording of class and method names (a comment for a class called DataHelper will say “A class to help the data”) 

2) Look at unit tests. Methods like testSetDescriptionOnDataHelper reveal that the agile developers before me were apparently only concerned that Eclipse didn’t screw up auto-generating their getters and setters.

3) Poke around classes, trying to at least figure out which ones are domains. Cross my fingers that design pattern names like DAO and BusinessDelegate are mashed into the class names just to help my brain spatially map the architecture.  

4) Grumble about the naive programmer who thought “program to the interface” meant that we should create an army of interfaces to Impl-cripple our architecture.

At this point, my brain begins throbbing under pressure and blood shoots out of my ears.

4) Give up looking at code.

5) Read the configuration XML file. This is the only hope I have of learning anything about the application.

I love the XML I hate. It forces bad developers (and sometimes brilliant developers under ridiculous timelines) to do something kinda good.

What scares the poopoo out of me about autowiring is… what in the world I’m going to do at step 5 when my monolithic XML is gone!?

  1. Andrew P
    October 1, 2008 at 1:41 pm

    Yeah…for some reason when I started using Autowiring, I felt the same exact thing…part of me was like, “this is awesome!!” but whenever I said that, I started thinking, “why do I feel this could get out of control really fast??” I really did “depend” on the XML configuration at my old client because like you said, it was one central place you could go to figure out what the heck the programmers were thinking/doing…now that’s gone. So, I am also ping-ponging back and forth on how much I like it…

  2. Patrick
    April 5, 2010 at 6:37 am

    I’m with you on that feeling too. Another issue is that this starts to bleed Spring into components. Where you once had setters or constructors that quietly allowed you objects to take shape before you used them, you now know that Spring is your container. The imports for its Attributes are spred throughout your code. Depending on how you’re creating your entities, you now have a IoC entry to a framework that will eventually become old and busted. The job of the future developer has now become more difficult.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: