A business layer method containing a object as parameter and just a single line of code with Data Layer call in method body is a BIG NO NO.
Some may find this very silly and have a question how is this possible. But recently I have seen code like that and it really caught me by surprise. The justification I heard was it’s a 3 Tier Architecture. I could just smile about such a deep problem in it, I too made such a mistake during my early days of programming. I was wondering how could someone make ignorance a friend. The incident was while using Asp.Net Web based application but can apply otherwise.
Even though the code file will separating Data Layer dependency from User Interface layer still it had below mentioned concerns :
- We have not created a good business class with specific single responsibility.
- We could not understood the business domain and thus not able to create related classes.
- There must be at least a validation check for the POCO objects that are been passed.
- This means that we have not understood object oriented programming. There may be instance where the methods will just call Data Layer.
- There is no advantage of creating the method and its interface declaration, just to call Data Layer.
- Unit Test written for this method is actually calling the Data Layer method so it is redundant.