Lukasz has posted 3 posts at DZone. You can read more from them at their website. View Full User Profile

Are You Afraid : Knowing Your Frameworks Well

  • submit to reddit

The last two weeks I've been simplifying an application flow engine based on Apache Struts 1 - I know it's an old technology but I don't care, I have a job to do ;-)

Anyway I discovered a lot of strange use cases where some custom mechanism was built instead of using what was already provided with the framework. It was like inventing a wheel once again! Frankly, I was truly surprised how someone could do this that way. And I start thinking what was the reason they did that...

The only thought that came to my mind was that someone was afraid to use what was already provided with Apache Struts 1 - he didn't know the framework well, was too lazy to check sources, and so on. I was really devastated! If someone was doing an application in such a way, no framework will help him or do the job for him!

Recently I've been solving issues in Apache Struts 2 and one of them was to add wildcard support to a file upload mechanism. I provided a patch that solved that problem with some homemade RegExp engine. I just added a test case to prove it was working properly and committed all the changes to a source code repository. After that a more experienced committer pointed out that I should use the existing PatternMatcher class instead, which I did and the code looks much better right now. You can see an example here Apache Struts 2 useful beans.
Published at DZone with permission of its author, Lukasz Lenart. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Alessandro Santini replied on Mon, 2010/05/24 - 9:38am

Let me recap: you were amazed at how previous developers solved problems that could be addressed in a much more elegant fashion; on the other hand, you committed the same "mistake" by providing a patch that was not needed because the framework already provided that function.

Now, the question is - leaving besides the fact that most people don't know 100% of a framework and that home-brewed extensions appear in any codebase for a variety of reasons - what shoud we be "afraid"of?

Raveman Ravemanus replied on Tue, 2010/05/25 - 4:09am

I disagree, i think its good to be afraid of useless frameworks. How will knowing struts help you in your work with Seam or Wicket or Grails or GWT or JSF otr SpringMVC? It won't. If it makes you feel better I bet that person that will have to change your code will just delete your custom extension and use something that is universal and easy to understand.

Alessandro Santini replied on Tue, 2010/05/25 - 6:38pm in response to: Raveman Ravemanus

Useless frameworks? Struts helping you work with Wicket, Grails, etc? Seriously - what are you trying to say?

If you had worked at least 5 minutes with Struts you would certainly know all the shortcomings of that framework (first and foremost - session management). Even JSF had so many deficiencies that developers introduced Seam and Facelets (which were extensions to existing frameworks which eventually became products in their own right).


Shaw Gar replied on Wed, 2010/05/26 - 1:52am

He is talking about trying to learn more about the framework, and use its features rather than writing own framework extensions. Framework code probably goes through more thought process/peer review before it gets in than yours. He points out his own experience on repeating this mistake, and realizing that it was indeed a mistake, and framework code provided better solution to the problem. You should be afraid of being lazy, not explore framework sufficiently before forking it and coming up with your own extensions.

Shaw Gar replied on Wed, 2010/05/26 - 1:56am in response to: Alessandro Santini

Do you ever read anything others say, try to interpret it before you jump on with your comments? Seems to me you never do He clearly mentions Struts does not help, and you interpret it as struts does help? Please save ourselves sometime reading your comments, when you could have just spent a little more time understanding what pothers have got to say.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.