Khangharoth

September 29, 2009

FrameWork: Spring-JPA-Hibernate (Annoation Based)

Filed under: Architecture,Java,JEE — khangharoth @ 4:56 pm

This skeleton web framework I wrote for Quarks , as they wanted a core framework on top of which they can build the applications.

As I had a luxury to design a Framework from scratch and so decided with these technologies.This dev stack is now becoming a vary dominant framework or to say in developers words “The next Popular Stack”.

Testing env I have used in this framework is TestNg , which I feel is much more suited to present day testing needs than our old JUnit(even after realese of Junit 4).

And with JDK 5+ , Spring 2.5+ which give support for Annoatations , you can have a very Simple yet very powerful framework to work with.So with this what we have is

  • Spring as a Application Framework
  • JPA as Persistence Framework (Hibernate as JPA impl)
  • Annotation based Transactional Control.
  • Spring Dependency injection with Annotation.
  • Spring MVC : This can be changed if you want to use something else.
  • Annotation based Validation framework.

These all elements give us enough power to create a generic and robust framework ,which can be customized for various needs.

Now let’s get to the actual work ……

Core Design Principle : The whole framework is desigend in Layers.Each Layer can only be called by layer above it and no skip hierarcy call’s are allowed.

Various Layers are

  • Web : Comprises of Spring MVC & JSP , this is due to the fact that most developer in quarks are quite familiar with JSp and so we wanted to start with this.Although I am not really happy with technology choice and wanted to have GWT or Flex based GUI.
  • Delegate : This is logical seperation between Web(Front End) and Service (back End).If you think that GWT or you something else suits you then this is the place where you should take a detour.
  • Service : Spring based beans, annotation based Dependency & Transaction management.
  • DAO : Db access layer , based on JPA and using hibernate as Persistence provider.
  • Persistence Domain model : Java Beans on lines of JPA Entities.

So the principle is that a layer can only call layer below it so in this Web —-> Delegate and any call direct to say services or DAO’s should be discourged.

Another way to see this is that if we just delete a particular Layer then code below it should compile just as fine without any problem.

I wanted the package structure to reinforce this idea  .Also its easier for a new person to see as how the packages are organized . The package structure is

  • com.quarks.a.web.controller
  • com.quarks.b.delegate
  • com.quarks.c.service
  • com.quarks.d.dao
  • com.quarks.e.persistence

Used a,b,c,d,e so that packages are shown in order in project view and aslo it gives clear idea of dependency in project.

Now looking at this I can easily say that DAO is only dependent on persistence pacakge.

Note : Still in edit , I’ll upload code as well . Please do give your valuable opinion about how can we have a Generic framework on this Dev Stack .

October 18, 2007

Software : Time and budget estimation.

Filed under: Architecture,Software Design — khangharoth @ 3:30 am

In continuation of my previous blog about “Failure of Software Project” .

This one topic has really amazed me as people are able to estimates such huge building with such good accuracy.How many times you have heard in News that this Stadium will be ready by this date with these functionalities and they do deliver.Also in these situation maximum worst that happen is delay,but vary rarely whole thing gets scrapped,but this happens in Software Industry all the time!

Is it to do with Team-Work as this industry very much reward individualism  and so you will see lot’s of Talented guys who can single handedly deliver a small to Mid Size project.But a team of 5-6 of them fails to deliver some what bigger application.So is this why Failure rate of Software is directly proportional to its size.

And if this is one of the reason why people in other industry can work so well in Teams?                                                             One of the answer i have in mind is  as this Industry pays a lot and this could be a simulator for  Huge Ego and individualism.

Well these are all guesses and it may be that  inherent process of Software development is difficult and hence  this gap’s in estimation’s.

So why estimation of Software is so hard,well the point is “Software is Hard”.In Maths we know that in any equation as we have more and more variables,prediction is less and less accurate from couple of variable values in hand.

To read more on this subject , i regularly search internet and  today stumbles upon this.I think its quite a bold statement and also very close to reality.

It is impossible, by examining any significant piece of completed code, to determine within a factor of two how many man-hours it took to produce that code.

And the corollary:

If you can’t tell how long a piece of code would take when you have the finished product available, what chance do you think you have before the first line of code is written?

My first response to this : am reading the above line’s again and again,Isn’t it true?

Blog at WordPress.com.