Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Adam's Rules of Coding

, 19 Feb 2013
Rate this:
Please Sign up or sign in to vote.
These may be obvious to some, but I wanted to get them written down.

I have been writing software for a long time. During that time, some "rules" have presented themselves to me. These may be obvious to some, but I wanted to get them written down.

1. Do the work where it is most appropriate.

I like LINQ a lot. It allows me to do the same kind of selection, sorting, etc. with objects that SQL does with data. You can use it to get your data from a database. In some cases, LINQ will do an admirable job of building a SQL statement to get your data. When you have a complex LINQ query against a database, it will have issues. LINQ will download data (and sometimes huge amounts of it) to process data for a complex query when you are looking for a small data set result. In this situation, writing a SQL query is much more efficient.

2. Clean up your mess.

If you open it, close it. If you make it, destroy it. If you close it, open it. Return things to how you found them. Just like your parents taught you.

3. Before you touch any data, make a backup.

You can do this with most databases by using a Begin Transaction statement. This will give you the opportunity to Rollback if something fails. When working with files, they are fairly simple to make a copy. You can log all changes (old value, new value) to your own transaction log file.

4. Use the right tool for the job.

When you have to mow your lawn, you wouldn't use a bulldozer. Using a compiled Java program to only perform web form validation is not only overkill, but will slow downloading your web pages to a crawl. It will also significantly increase your bandwidth usage. JavaScript would be a much better fit for this situation.

These rules are not yet complete.

What are your coding rules?

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Adam Zuckerman
Software Developer (Senior)
United States United States
Long time software engineer who rambles occasionally about coding, best practices, and other random things.
Follow on   Twitter   Google+

Comments and Discussions

 
GeneralRoutine rule Pinmemberkevenm25-Feb-13 8:06 
GeneralRoutine rule Pinmemberkevenm25-Feb-13 7:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 19 Feb 2013
Article Copyright 2013 by Adam Zuckerman
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid