This analysis makes sense, and states anything that avoids code duplication and simplifies maintenance speaks for a service layer.
What is the technical behavior?
- When a service client references a service, does it do so at runtime, or does it happen at compile time?
- When I change something in the service layer code, will this change be automatically taken into account in all it’s clients, or do they need to be individually recompiled?
- How does this make sense from a testing point of view – I have working code, based on some code from a service, but if that service changes, my code might break?!
- Typically service references are acquired through some sort of dependency injection, not hardcoded. They may even be remote calls.
- It should most definitely not be necessary to recompile clients when a service changes
- Yes, definitely. That’s why the service API should be narrow and explicitly specified. And see the upside too: you have broken code based on a buggy service, but if someone fixes the service now your code works!
2