java - Splitting up services -> Business Objects? -


I believe that I structure my projects, as many people do, you have a data layer (DAO) , Service level and presentation level (Spring MVC, Wicket, ...). Generally a service starts to be quite simple and 'small'. Gradually though the service should support more and more usage cases, as long as there is a large section with many lines and methods and it is difficult to read and maintain. At that time, you can either choose to stick with it or start a refactor, which is a cumbersome and 'dangerous' job that can work a lot.

I stop the need for any future refactoring I am looking for a solution for
One approach can divide your services into many sub-services and provide a service to its core service. For example, instead of a large user service, you might have a UserServiceFacade that calls a password service, registration service, .... This is not a bad solution that I feel, but I am not very excited about it because it is:

  1. It is difficult to define in advance to divide the colony work; For example, if you have no doubt, you may need a refactor again or there may be a service with only one method for example
  2. Re-use of business logic is more difficult For example if the password service and normalization of the registration service are required

    Another solution may be the use of business objects (in my understanding) to be a subsywis It can also be seen, but then for a specific UGS, so that you have CreateUserBO, CheckPasswordBO, DeleteUserBO, ... like BO.

    I am a little more excited about this approach, because in my opnion, it provides some benefits:

    1. BO is very readable and with this Contract is required to do this; All balances can be handed over to other bo, a single bow will be reduced and
    2. easy to use functionality again
    3. Change the implementation of a fixed use / Easy to switch: Another implementation injection with just spring
    4. Easy to test: Only specific use case needs to be tested, delegations can be joke to other BOs.
    5. Collaboration: If many developers work different b then they work on the same service

      But I also see some possible downsides:

      1. A little extra work (less In short sort term)
      2. More projects that can reduce the readability of your project?
      3. Another abstract layer: An extra step is needed to find the real implementation of a UJAS

        The question is, instead, the question (sorry): < / P>

        1. Are business options the ideal solution for this problem?
        2. Do you agree with the advantages / disadvantages of the BO that I have an above list ND / are you looking at the other?
        3. Are there any other (good) solutions to prevent mega services from wasting their day?

          I recommend you to view this article if your application is from a college assignment Something is serious The basic premise builds everything around your institutions and is a strong domain model. Differentiate between those services for things related to infrastructure (such as sending email, continuing data) and services that are actually your main business needs.

          I will also suggest finding out - whatever revolutionary material as if your layers are inclined, such as DAO layers etc. are not required.

          Hope that helps.

Comments