web services - in 3 layered architecture can i skip business layer for crud operations? -


we have 3 layered application wich every call service layer goes business layer , peresist data layer. components of each layer can call layer below;

however because have hundreds of entities , have lots of services related crud operatins many contoverseries raised on our team.

some believe sake of maintenance , ease of development it's better call data access crud services doing crud operation , bypassing business layer.

on contrary saying have create wrapper data access of each entity in business layer , call these wrapper services , never allow services call data access layer.

in idea way should take? ok crud services call data accesses , bypassing business layer?

if there no business logic perform, there no reason enforce business layer. 3-tier architecture not arcane protocol, best practice formed assuming business processing.

in current application accessing daos directly jsf controllers when there no business process involved. idea given java champion stressed idea simplicity paramount.

edit: see worried future modifications may require adding business logic. think of issue way:

the additional business logic added business layer anyway, including data access, there no difference here.

crud code simple. change in service amount reroute single call or couple of calls fron dao ejb - simple refactoring. crud code still remain, pushed ejb - simple refactoring.

this not perfect, imo better alternative - having empty indirection layer. adds complexity serves no purpose. business object nothing forward calls dao.

there 2 code smells think apply in case: contrived complexity , feature envy.

edit2: not saying da in business layer somehow code smell. mean having business object nothing else proxy dao smell. it's same complexity - added data structure / architectural layer serves no own purpose - there seems dal in application already.

another aspect consideration - how surprising developer see service uses dao directly? having 5 services 2 of them access dao directly different having 100 services 1 service accesses daos directly.

in first case code simplicity outweigh added conceptual complexity (2 concepts single thing), in second case, rather stick business layer - surprise (also called wtf-effect ;) of doing differently once big.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -