Quantcast
Channel: Reza's Weblog
Viewing all articles
Browse latest Browse all 50

Java Frameworks and Pattern Usage by Developers

$
0
0

A couple of days ago I was thinking of the last time I used a pattern in my daily programming. I think it was 3 months ago! Then I tried to find out why.


What I mean about a pattern is a GOF or J2EE pattern for example. I am not talking about very basic patterns already embedded into programming languages like interface, accessor method, private method, etc.

As many other developers do (at least in Java world) I use many open source frameworks such as Hibernate, Struts, Spring, etc and now I am thinking that these frameworks make me use less patterns in my day to day developments! Although they are great tools and make programming hundreds of times faster but they stop developers to use (write) patterns in some areas since they carry the burden of writing those patterns themselves!

Don't get me wrong, working on a project you might still need to use (write) many patterns (depending on the size and complexity of the project) but many others may be hidden by the framework and you do not need to use them because the framework has already done it for you and you don't bother anymore. In many cases you just write some code on top of that pattern the way you should do it in that framework's specific way.

Also, most of patterns are written when the project is in early phases of development and the architecture is shaping. After that people need less usage of patterns. Writing the architecture or reference use-cases is usually the responsibility of senior developers or architects and other developers are not very exposed to these areas where more patterns are being applied.

Lets see an example. Imaging a simple web based project with a couple of database tables, some CRUD and a bit of security. Suppose you want to write this with hibernate/Spring or iBatis/Struts with Acegi. Using all that you might need some DAO, Value Object, Controller and some more. Using all these will free you from many complications.

But suppose you do not want to use any framework. Think of Sun's Pet Store example which is all plain. Definitely you need a hand full of patterns if you want to write it in a proper way. specially most of presentation tier patterns are hidden (such as Intercepting Filter, Context Object, Application Controller, View Helper,...).

I see the point of all frameworks as:

1- Faster Development
2- Developer focus on business
3- Other things!

Having these points in mind we see that a framework developer wants an application developer just to focus on business development not the underlying technology. This is good in the sense that you do not need to struggle with the technology but (in the context of our discussion) there are some problems with it:

1- Developers will not use most of the patterns
2- Developers become lazy
3- Developers will not learn bits and pieces or tricks of the underlying technologies


Well, we cannot stop framework development! I have also been developing some myself! They are good for their objective but have side effects!

Looking at the popular frameworks we see that they are full of patterns and tricks that a programmer can learn about but if you don't care about these things and just develop a design given to you then you will not learn the inside. As a good starting point I always suggest programmers to read frameworks codes. This way you will learn a lot of things and also you will know the way that framework behaves and will use them confidently.

I know the whole subject is relative so do not reply me saying that we are using patterns all the time!

Viewing all articles
Browse latest Browse all 50

Trending Articles