Doing More with Less
By Jonathan Goodyear
Most software projects don t come with a time budget that is big enough. Therefore, we ve all got to find ways to get more things done in less time. An obvious place to start on that endeavor is to purchase third-party components and tools. After all, it is rarely more cost effective to build vs. buy. The not invented here syndrome can cause a project do die a slow, horrible death. A little math and economics can go a long way toward convincing the powers that be in your organization who may not see the value in purchasing third-party components.
There are plenty of component vendors to choose from, and most do a pretty good job. To give a couple of examples, my consulting company has had very good luck with ComponentArt (http://www.componentart.com) for Web controls and Infragistics (http://www.infragistics.com) for WPF controls. For hard-core grid requirements, we usually go with FarPoint Spread (http://www.fpoint.com). I hear that ComponentOne (http://www.componentone.com) will be releasing a set of Silverlight controls soon, so I will certainly be keeping my eye on that. I ve been waiting for a mainstream component vendor to jump into that fray.
Another way to cut down on the amount of time that it takes to complete a software project is code generation. Admittedly, I have been pretty slow to jump on the code-generation bandwagon. Part of the reason for this is because, until the last couple of years, I was not very happy about the code-generation tools that were available. If you really wanted to do code generation, you were stuck rolling your own (which is much more difficult to do properly than you might imagine). These days, there are two sure-fire tools to get an effective code-generation experience.
The first is SubSonic (http://www.subsonicproject.com), an object relational modeler (ORM) tool on steroids. Just point it at your database and it will create a complete set of objects to interact with your tables. It can do this dynamically through some configuration files, but I highly suggest pre-compiling your objects for production scenarios. SubSonic takes into consideration relationships between tables, and the objects can be bound to the controls in your applications. Although it can be used for Windows applications, it is really meant to be used for Web applications.
The only significant caveat that I ve found with SubSonic is that it currently doesn t handle aggregates with GROUP BY functionality. That makes it difficult to obtain report-like data. For those situations, you would have to resort to rolling your own queries. An oddity with SubSonic is that it uses all dynamic SQL. The SQL is parameterized and checked for things like SQL injection attacks, but that might strike a negative chord for those of you who like to use stored procedures as a security layer in your applications. SQL Server 2005 does such a great job of optimizing and caching execution plans that there is no longer a huge performance difference between stored procedures and dynamic SQL. The best part about SubSonic is probably the price tag: It s free! If you re in a time crunch, it s a great way to get a head start.
If you desire much more power in a code generator, let me introduce you to CodeSmith (http://www.codesmithtools.com). CodeSmith employs the concept of templates that you create using a scripting language that looks very much like ASP.NET (so you should all feel right at home using it). The templates can be nested for code re-use and can also easily access SQL Server as a source for template data.
The professional edition of CodeSmith includes the CodeSmith Studio IDE, which is an all-purpose code-generation environment that includes IntelliSense. Ironically, CodeSmith can be used for the production of just about anything via templates. For instance, you could use it to create advanced mail merges (something completely outside the concept of code creation). While CodeSmith comes with a large library of code templates, one of its greatest assets is that there is a vibrant community of developers creating and sharing templates for it. The best example is .netTiers (http://nettiers.com). The .netTiers template does a lot of what SubSonic does, except that it takes the approach of using stored procedures instead of dynamic SQL. Once again, you re a few minutes away from a fully functioning ORM layer for your application. The bad part about CodeSmith is that it is not free. It currently costs between US$99 and US$399, depending on whether you purchase the Standard Edition or Professional Edition. When you consider how much time you re going to save, though, the price doesn t sting quite so much.
A third way that developers can accomplish more with less time is magic. By magic, I mean leveraging functionality that the platform or your development environment does for you behind the scenes. In the days of Visual Basic 6 and prior, developers relied heavily on magic (which became painfully apparent as Visual Basic 6 developers attempted to adopt the .NET lifestyle). For instance, how many developers really knew (or cared) how VB6 enabled collection classes?
While some would say that the magic has gone away with .NET, it really hasn t. In fact, it s making a comeback. For instance, have you coded against an XML Schema Document as if it s a real class? How about programming against the ASP.NET Profile Provider based on settings in your web.config file? When is the last time you had to actually analyze the WSDL when consuming a Web service? Probably never (and that s a good thing). There are dozens of similar examples. It s true that magic can be detrimental at times (like when you re trying to debug a problem and you don t quite understand the underpinnings of what you re dealing with), but for the most part, it can be a real time saver.
So, there you have it. Three good ways to get your project done in less time. I m sure there are other ways, and each time I discover a new one, it makes my day. Spend some time researching time-saving tools and techniques before you head into your next big project. It ll save you a lot more time down the road.
Jonathan Goodyear is president of ASPSOFT (http://www.aspsoft.com), an Internet consulting firm based in Orlando, FL. Jonathan is Microsoft Regional Director for Florida, an ASP.NET MVP, a Microsoft Certified Solution Developer (MCSD), and co-author of ASP.NET 2.0 MVP Hacks (Wrox). Jonathan also is a contributing editor for asp.netPRO. E-mail him at mailto:[email protected] or through his angryCoder eZine at http://www.angryCoder.com.