Software, database and web development all have documented best practices and industry standards and conventions, but these are often easy to neglect in favour of a quick solution. But what exactly do we mean by ‘Best Practice Design’? The following article explains these techniques and what they mean to you, the customer.
The Importance of Best Practices
If your application is developed to Best Practice then it should be:
* More robust – In other words it should suffer less from data corruption, crashes and errors.
* More accurate – The information held within the database should contain less invalid data, fewer inconsistencies and few, if any, duplicates.
* Easier to support – Any problems that do occur should be identified and resolved quicker.
* Easier to maintain – Any minor changes or updates should be faster and cheaper to implement.
* Reduced reliance on the developer – For all of the above reasons you will be more independent and significantly less reliant upon the developer.
* Cheaper to upgrade or to upsize – If you decide to make major changes to your application, say upsizing it from Access to SQL Server, then this will be achieved in a shorter timescale and at a lower cost.
Some of the most important best practices are listed in the following sections.
What is it? – Organising the data tables of a database to eliminate certain common problems and errors from the database, as well as protecting the integrity of the data.
Why is it important? – A relational database that isn’t normalised can result in duplicated data.
What is it? – A means of protecting the integrity of the data in a database. Essentially it means that a record cannot be created or deleted until any associated records have already been created or deleted. For example an order header record could not be deleted if there were still order detail records linked to it.
Why is it important? – Referential Integrity means the system itself looks after the integrity of the data, rather than relying on the user.
What is it? – A coding practice to deal with errors that occur within an application.
Why is it important? – If an error occurs in a routine without error trapping then either the system will crash or, often worse, a misleading error message might be displayed. Error trapping ensures the error is handled ‘gracefully’, with friendly error messages displayed to the end-user.
What is it? – Ensuring the data entered into a system meets specified rules (e.g. End Date must be after Start Date)
Why is it important? – GIGO, which means Garbage In equals Garbage Out. A database is only as good as the information that it holds so it is important to try and trap as many mistakes as you can during data entry.
What is it? – Checking that the version of the application you are using is up to date. This is of particular importance with client-server applications where the application is ’split’ into two separate entities.
Why is it important? - If a discrepancy exists between versions (for example a user logs onto the version 2.1 database with a 1.1 front-end) then the system may crash or introduce errors into the data.
What is it? – Logging changes made to a running application – e.g. why the change was made, when it was made, what the new version number is, who made it, which parts of the system were affected, etc.
Why is it important? – If you later detect new errors or inconsistencies it is very helpful to be able to review any changes that may have affected that part of the system. It can also be of benefit to the helpdesk or IT support.
Table Driven Design
What is it? - Using updateable data tables to control the application’s design, such as the options that appear in dropdown boxes.
Why is it important? – Ensures design changes are implemented consistently across the entire application. A table driven design also allows some maintenance tasks to be performed by the user, rather than relying on the developer, and speeds up the whole process of updating the design.
What is it? – A naming convention establishes a standard for the names given to the objects of an application.
Why is it important? – A naming convention helps any developer looking at an application to understand it’s internal details much more quickly than would be the case if a naming convention has not been applied. In practice a system with a good naming convention can be up to twice as fast to modify as one without. Additionally it makes migration of the data to another system much easier.
Best Coding Practices
What is it? – Writing code procedures in a consistent, logical and readable way. This includes layout, commenting, declarations and other best practices.
Why is it important? - Following best coding practices helps any developer looking at an application to understand it’s internal details much more quickly. It also means the code is more reliable and robust.
What is it? – Technical documents outlining the structure of the database (known as the schema), source code for procedures, and any other appropriate documents. Can be included with the code change log.
Why is it important? – Documentation is vital in future updates to the system, helping any developer to understand what objects to change, and more importantly the impact those changes will have on the rest of the system.
Best Practice is not a tightly defined set of rules; it is more a combination of a detailed understanding of the underlying technical concepts, an appreciation that an application will continue to evolve and be developed over the coming years and a determination to do a good job & deliver a quality product.
An application developed with Best Practice will take slightly longer to write than one which does not and may therefore cost a little more. However, over the lifetime of the software, and usually over the first year of the project, overall costs should be significantly lower, data reliability will be better and the robustness of the database will be greater.
If one was being cynical you could say that by not following Best Practice a developer can create an ongoing revenue stream from all of the minor amendments and enhancements that will subsequently be required. However, ensuring that your solution is built with these practices in mind will nearly always work out cheaper in the long run.