A Case for Architectural Simplicity
I would like to share an experience that is all too typical at my day job, in hopes that it may stop someone from saying, "Just one more framework isn't gonna hurt".
I'm working on a sales leading tracking system which has been handed down to unsuspecting developers for around 3 years. The architecture consists of Java, Portal, Struts, Tiles, Spring, Hibernate, EJB's, and probably some other stuff I'm forgetting. I mainly work on the front end Portal/Struts stuff.
Today I was working on the new phase, and I needed to find a JSP to make some simple formatting changes. I could navigate to the page through Portal, but actually finding the JSP wasn't so easy. I thought I knew what file it was, because a portion of the html matched, but there was a large piece missing. So I started digging.
The first problem is that Portal has it's own completely unreadable URL mumbo jumbo. So there's know easy way to say, "this page, is using this action/JSP/whatever". So I had to look at the form from whence it came. The form pointed to a struts action, which I proceeded to look for in the eleven struts configuration files contained in this project. It wasn't in the first two files that actually made since, so I had to do a file search for it. I found the configuration, however it just pointed to another struts action, which luckily was in the same file.
That Struts action pointed to a Tiles (Templating Framework) configuration, which I had to find amongst thirteen config files. Of course one configuration points to another, which finally points to a JSP! However, it's totally not what I was looking for. Frustration! I have no idea how this happened, but I needed a new tactic.
I took a blurb of copy from the rendered HTML and searched for that. I figured it would be in the ApplicationResources.properties file, which for those unfamiliar is a place where you store text labels with unique identifiers, used for i18n. I got the key for this text and searched for that in JSP's. The JSP I find is the one I thought it might be in the first place. I double check, and this is definitely not it. Anger!
At this point feel like I'm getting very lost, and I'm struggling to remember what I was looking for in the first place. This time I take the name of a text field from the rendered HTML and search for it. I find a JSP, and it actually looks like the right one this time. However there's another problem, there are two jsp files, batch_categorize.jsp and batchCategorize.jsp. %$%#^&@*! MADNESS! What the crap, man?! To make a long story longer, I traced the file back through two tiles configs, and a struts action, and confirm that it's the underscored version I'm looking for, even though every other JSP in the project is camel cased.
Of course by this time I've totally forgotten what the heck I was trying to do in the first place.
Don't let this happen to you.