Better organization of my project

Asked

Viewed 217 times

1

My project has the following packages in its structure:

  • br.com.xxxx.model: Which contains the entities.
  • br.com.xxxx.negocio: That contains the DAO interface along with the implementing classes.
  • br.com.xxxx.control: Containing the Managed Bean’s.
  • br.com.xxxx.util: Has the utility classes.

My question is the following: my DAO classes need to follow the DAO implementation, but depending on the entity I can have different behaviors, example a query that can have different fields.

How can I treat this? I could create an "extra" class with these differences?

  • 3

    Man, to be honest, I find this question very subjective, I believe that there is an ideal answer, each one can have an opinion, the very concept of MVC has evolved a lot and any system today has much more than 3 layers for example, what makes everything more dynamic still and everything to the liking of the developer... (Obs, did not give downvote)

  • 2

    I asked a lot of questions of this kind, with the experience I gave. Focus on your business rule and on delivering value to the customer/user. Make a well-written code that other programmers understand, with high cohesion, no repetition, which is great. Study, read and program that will arrive at your ideal solution.

  • MVC in Java, right?

  • @Ciganomorrisonmendez yes

  • Another question: the construction is following some framework specific or you are leaving for a pure implementation?

  • @Ciganomorrisonmendez I am yes, JSF.

  • 1

    I wouldn’t duplicate this one? Organizing packages in a java project

Show 2 more comments

1 answer

1


I believe that this kind of question is a little subjective.

It takes another class for that ? The implementation of DAO is a bit personal too, some developers "pass the query" that want to run on a given object in the database, others separate within the model which querys will run, and when invoking the model pass which one of them wants to run.

I believe that the most important thing when it comes to project "standard", is the organization of your code.

Ask yourself, when looking at that code a few months from now, or if someone else opens your code, the reader would expect that access code to the bank to be next to each other or in a class to part ?

So I believe that each project asks for a specific pattern and every project pattern is a "guide line" not a rule, so the way you believe your code is organized and functional, will be the right way.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.