There are so many tutorials that teach us to use for example some ORM directly with database, but in real life i cant remember a big project that was working directly with database and not with services, so the amount of that tutorials seems strange to me.
Directly connected applications have real benefits in speed of data transitions between database and the app, and they do not have restrictions in functionality that appear because of service layers(for example lets take Entity framework and WCF Data services(that uses same entity data model itself)). On the other side services solution is more secure and flexible, thats why i(and i think many other programmers) usually choose it for building large applications with some kind of common business logic...BUT! Sometimes lose in speed is up to 10 times! Thats just sad, application becomes less responsive than it could have been.
So the question i want to ask is: can you share your own experience of building enterprise applications without the layer with web/services and when is it a good choice?
Enterprise application != n-tier application. It means that you can write enterprise application without creating separate physical middle tier (business logic). Creating separate middle tier must always be part of requirements because it is a lot of additional complexity = a lot of additional costs.
Usual requirements for separate middle tier are:
- Security - sometimes web server is in DMZ and middle tier must be in secured network
- Reusability - you want to use middle tier in more then one application, this also leads to SOA requirement
- Scalability - the middle tier can be much more complex so it can be useful to scale it independently on the front end tier. If you want to use middle tier in more then one application you must also be able to scale it independently. Scalability requirement is usually based on performance and availability requirements.
If you don't have any such requirement you can make multilayer application where both front-end and business logic sits in the same process on the same server.
来源:https://stackoverflow.com/questions/5610922/build-enterprise-application-without-service-layer