Best organization of my project [closed]

1

My project has the following packages in its structure:

  • br.com.xxxx.model : Which contains the entities.
  • br.com.xxxx.business : That contains the DAO interface together with the classes that implement it.
  • br.com.xxxx.controle : Contains Managed Bean's.
  • br.com.xxxx.util : It has utilitarian classes.

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

How can I handle this? Could I create an "extra" class with these differences?

    
asked by anonymous 29.09.2016 / 13:50

1 answer

1

I think this kind of question is a bit subjective.

Is another class needed for this? The DAO implementation is a little personal as well, some developers "pass the query" that they want to execute on a particular object in the database, others separate within the model which querys they will execute, and invoke the model they pass which one they want to execute. / p>

I think the most important thing about being a "design" pattern is the organization of your code.

Ask yourself, by looking at this code in a couple of months, or if someone else opens your code, would the reader expect that this access code to the bank be with others or in a separate class?

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

    
29.09.2016 / 15:10