Over a million developers have joined DZone.
Silver Partner

Are You Afraid : Knowing Your Frameworks Well

· Java Zone

The Java Zone is presented by Hazelcast.  Learn more about Hazelcast on Azure and the best practices for seamless deployment of Hazelcast on Azure Virtual Machines.

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.

The Java Zone is presented by Hazelcast.  Learn more about Hazelcast on Azure and the best practices for seamless deployment of Hazelcast on Azure Virtual Machines.

Topics:

Published at DZone with permission of Lukasz Lenart .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}