tags:

views:

64

answers:

2

Hi All,

I know this question has been aksed and answered many times.but still asking the same question again.. i have started working on a travelling application and for which currently i am working on creating on the creation of the nderlying DAO so i am planning to create a generic DAO its implimentation and again an interface for each entity class.

My query is what is the best way to organise all these interfaces as well as there Implimentation..

Thnaks in advance

A: 

If I understand the question correctly your looking for suggestions on organising your packages?

I'd split then between. com.yyy.zzzz.dao.interfaces and com.yyy.zzzz.dao.impl

Kevin D
yes Kevin you have understood it well.is this organisation is a matter of choice or it has some other points when we talk about whole application?
umesh
I've impressed myself I only just woke up. :)
Kevin D
Anyone considering voting for this answer, please vote for @Colin Herbert his is a much better answer.
Kevin D
+1  A: 

You're the only one who can take decisions on how your application should be organized. You can, of course, follow some recommandations such as the Java Naming Convention for packages, or even try to split your packages for each tier implied in your application; but in the end, you have to choose for yourself.

@Kevin D's solution is correct, you could use the com.company.project.dao.interfaces (I wouldn't use interfaces as it's a plural and I avoid plural in package names, but again it depends on you) and com.company.project.dao.impl or you could use packages to split different implementations. It's as you want. And no one should tell you how to split your own application (except your team).

The only (but still facultative) rule I would tell you to follow is "Have coherent names".
That means choose your project convention, but stick to it, and of course the names you choose for your packages (but it also applies on classes, variables) must represent their content (but I suppose this is common sense).

On another note, I don't know the context of your work, but you should really read Adam bien's Weblog, you'll see some articles on best practices regarding DAO and "default implementation", maybe it will concern your project.


Resources :

Colin Hebert
@Colin Thanks for the details and yes i am agree its me who has to take the decision at the end of day i am asking for the views if there is really any benifits of one ver other..
umesh
@umesh, the most effective way to name things is to have names that everyone in your team can understand easily. Usually the naming convention a developer choose is making enough sense for anyone who reads the code. That's why packages are so different from a project to another but yet two projects with different conventions can be as much understandable.
Colin Hebert
You cannot use `com.company.project.dao.interface` because `interface` is a keyword!
Stephen C
@Stephen C, Ouch, nice catch, I'll change that.
Colin Hebert