|
Generate Code Rapidly
by Don Kiely
September 2, 2005
Nearly every non-trivial software development project has at least some code that you've probably written dozens of times: standard CRUD stored procedures, data-access code, objects based on your chosen framework, and so on. Any object-oriented application is a great candidate for using code-generation tools to create this kind of redundant code. CodeSmith Tools' CodeSmith 3.1 Professional Edition is the first commercial version of a freeware code-generation tool.
CodeSmith's template-based approach to code generation uses a tag syntax similar to ASP.NET's, making it a familiar environment for many developers (see Figure 1). The product comes with a variety of pre-built templates to get you started, including some for generating stored procedures based on a database schema, creating objects based on Rocky Lhotka's CSLA framework, creating common collections objects, and other common programming tasks. You can modify the templates as you wish or use any of them as a starting point for custom templates.
CodeSmith Professional Edition consists of two primary tools: CodeSmith Explorer and CodeSmith Studio. CodeSmith Explorer, available as both a standalone version and a VS add-in, provides a control panel for running templates, editing them using a text editor of your choice, and maintaining templates. CodeSmith Studio is a complete template development environment that includes a code editor that rivals that in VS. It also features tools to write .NET code using the CodeSmith API and build the template when you're ready. The company has done a great job providing template tools that any VS developer will be comfortable with.
CodeSmith, based on the .NET Framework, uses ASP.NET's tag syntax and allows code-generation automation using C# and VB.NET. CodeSmith can generate any kind of text-based files you want to create a template for, including stored procedures, Java, and documentation.
CodeSmith 3.1 includes a complete online help file that does a great job of documenting the product and providing a complete reference to its features. It'll take some work to learn how to use the product effectively, but the documentation, sample templates, and online forums provide all the help you'll need.
CodeSmith 3.1 is an impressive product. Eric Smith, CodeSmith's creator, recently teamed up with Rob Howard and Telligent Systems to form CodeSmith Tools to continue to develop the product. Given its current high quality and the new partnership, CodeSmith has a bright future.
Back to top
|