Fairway Technologies Blog

blog

Generate Better Code, Faster!

In Insider, Development No Comments

Are you or your developers writing stored procedures by hand? Are they creating duplicate CRUD (Create Read Update Delete) logic in multiple places? If so, you should consider a code generator.

Advantages of using a Code Generator

The benefits of using a code generator, such as the PDSA Haystack Code Generator to generate your data access logic are huge! If you are not using one, you need to ask yourself why? If the answer is because you think no one else can write code the way you can, that is not a good enough reason. When you consider how long it takes you to create, test and debug data access code, and how much time you put in when the schema of a table changes, you will soon find out that you are wasting a lot of time. The major reasons for using code generation are as follows:

  • Generation of INSERT, UPDATE and DELETE statements
  • Generation of stored procedures to do INSERT, UPDATE and DELETE
  • Bullet proof code for doing the Create, Read, Update, Delete (CRUD) logic
  • Ability to regenerate CRUD classes if schema changes
  • Consistency of code from one application to another
  • Moves SQL out of the UI tier and into a middle tier where it belongs
  • Moves the dependence on a particular database provider out of the UI
  • Reduces code complexity in the UI layer
  • Ability to map columns to properties in a class
  • Provide IntelliSense of tables, stored procedures, views and columns
  • Provides strong-typing of data in one location
  • Ability to customize templates to fit "your" style
  • Abstracts and encapsulates all data access code
  • Ability to separate programmers working on UI and data access

How to Pick a Code Generator

Before you start using a code generator you need to find one that allows you to do all of the things listed above. Be sure you can quickly and easily modify the code that is generated. In addition looks for one that supports generating multiple UI layers such as WPF, Angular, MVC, etc. The ability to generate a SOA layer such as Web API calls or WCF is an added bonus. 

Summary

How you create your CRUD logic needs to be thought out just as much as how you design the rest of your application architecture. Making many small classes/methods and then combining those together produces much more robust and maintainable code. Sure you end up with more classes, but these can be move to other assemblies so you don’t have to see all those files. You will definitely benefit in the long run. Using a code generator can really help speed up the development and ensure quality when developing the CRUD logic for your database application.

There are several code generators available for you to use. PDSA has the Haystack Code Generator (www.pdsa.com/haystack). The Haystack Code Generator does support all of the items listed above including the ones listed in how to pick a code generator.

Visit www.pdsa.com/haystack to learn more about Haystack and to download a free trial version.

Click here to read a special report on what code generation can do for you.

Plan Your Technology Team with This Online Assessment Tool

Subscribe to Email Updates

Build a