If you think that there is a significant chance that the data source provider will be changed then it makes sense to create separation. Most of the time this does not happen. We need to stop teaching people that abstraction is the "right" way to write code. It is not. It is the right way to write some code and solve some problems. It adds needless complexity most of the time. Layers are fine if you really share business objects between applications. I would argue that 90%+ of applications out there do not actually do this, so it just makes the code more difficult to change and maintain.
rdalton2100OrSomething
Posts
-
Is this a known pattern? -
Is this a known pattern?I think that you are talking about basic coding rules that unfortunately most people don't follow or teach or profess often enough, because they get caught up in making sure they separate everything out in to tiers or MVC or MVVP or whatever other bs is popular atm. 1) If you are going to re-use the logic then create a method to centralize the age check, so you don't have the same thing in 2 places. 2) If you are not going to re-use the logic then put it closest to where it will be used. I see people all the time create methods in the BL layer to encapsulate the call to the data layer, because someday another developer will browse through and say, hey...look, I already have a method that does that, and it will save them 5 seconds from having to write it themselves or search to see if it exists elsewhere. Put the logic closest to where it will be used unless you KNOW it is likely to be re-used. There are exceptions if you are working on really big applications, but most apps are small, and the added abstraction makes maintenance a beast. If you want to call it a pattern then please follow the one and only pattern that really matters: Keep It Simple. Abstraction by default is a sign of lack of experience. And those people with 20 years of programming experience on their resume that are itching to post how I got it all wrong (if you are harumphing right now, I mean you). You are idiots that make life difficult for the rest of us. Do us all a favor and go get a job mowing grass or something.
Raymond