Microsoft, the company who provided the products and tools for millions of people to build careers off (myself included), has often forgotten that the simple solutions are often the best. In a recent blog post, hammett wrote about Microsoft’s missteps in this area and their focus on YAGNI (You Ain’t Gonna Need It) — at least, where “You” refers to most people.
[Digression: Someone at some point commented on Microsoft Word that “90% of the features are used by 10% of the people”. If I was designing a product and 10% of my features were used by 90% of the people, and the other 90% of the features were used by 10%, I’d either write two products, or I’d write one product that was incredibly extensible using a plug-in architecture.]
This feature-bloat approach to technology reminds me of Microsoft’s Enterprise Library and the Data Access Application Block (DAAB). In the first release of the DAAB, you can call a parameterized stored procedure and get a DataReader back using one line of code, as illustrated below.
IDataReader reader = SqlHelper.ExecuteReader(
connectionString, CommandType.StoredProcedure, storedProc,
new SqlParameter("@ID", 1));
In the latest DAAB (part of Enterprise Library 2.0), this becomes:
Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetStoredProcCommand(storedProc);
db.AddInParameter(cmd, "ID", DbType.Int32, 1);
IDataReader reader = db.ExecuteReader(cmd);
I also should mention I also should mention that the latter example also requires a special configuration section added to your application config file, whereas the former just requires a connection string (which likely you already include somewhere in your application configuration).
The first example hides the complexity that you may not need in most circumstances. Granted, you can still use (or write your own) SqlHelper, but why break away from this entirely?
Simplicity is a wonderful thing. Let’s hope Microsoft finds it again. Give power to those who need it, and simple elegance to those who don’t. It’s not hard to do both, if you accept the fact that one size does not fit all.