I was going over some C# code that was written for a non-profit earlier this year. It was fairly typical code and that's what disturbed me so. It consisted of a single ASP.NET Application with most of the work happening in the Page_Load. Although there was only one database, the connection string to that database appeared in at least a dozen places throughout the code. There were a few places where a SELECT * from WHATEVER occurred and they spun through a DataReader in order to set a boolean called "HasRows" to true.
So, I had to do something. I understand that not everyone cares, and that not everyone had (or chose to have) any formal Computer Science or Software Engineering academic life (not that there's anything wrong with that.)
Disclaimer: This post is just general advice. I know that reams of paper have been written on how to design software, layers, tiers, services, etc. This post is just to remind a few people that you can't have multiple layers until you start thinking about the responsibility of each layer - the contract and binding. Life has hierarchies and layers and responsibility - and so should most software.
That being said, here's little reminder about layers of abstraction. They are typically a good thing. Remember though, that in "Scott World" (which is hopefully your world also :) ) a "Tier" is a unit of deployment, while a "Layer" is a logical separation of responsibility within code. You may say you have a "3-tier" system, but be running it on one laptop. You may say your have a "3-layer" system, but have only ASP.NET pages that talk to a database. There's power in precision, friends.
This may seem overkill, but believe me, once you've done it a few times, you'll appreciate it when you come back to mess with the code in the future. Remember also that much of this CRUD stuff can be auto-generated by CodeSmith or by Deklarit. Please, do resist the urge to open up a SqlConnection from your next ASP.NET page.
Why should you do this? Because of the 'ilities and because the simplest even-slightly layered design hides complexity.
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. I am a failed stand-up comic, a cornrower, and a book author.
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.