web 2.0

Software Development Do's and Don'ts

My first encounter with programming was around 1992 when I developed my first website. The website was complete with frames, flashing gifs and marquee tags. It was an absolute nightmare! Anyway, I gradually learned enough about computers and coding that I suckered a small company into giving me an internship. Although, I was hired to fix computers and maintain the test lab, I secretly always wanted to write code. Eventually, I convinced my boss to let me take home the Delphi 4 CD and a few months later I was hired full time as a software engineer.

Between my first hello world program and now, many things have changed. Programming languages have come and gone. We went from waterfall to agile and from extreme programming to test driven design. Nonetheless there are certain ideas and principals around computer programming that never seem to change. That is really the whole idea behind this post.

Never write code with the intention that you will fix it later - Chances are you will never have the time or opportunity to fix it later. Once code rolls into production, the maintenance windows become scarce. Like my Dad always said "Do it right, or don't do it at all".

Think large write small - When we develop new applications we generally start out with a few users and a little bit of data. For example, your application may start out with a thousand records but two years from now you may have 2 billion records. So think twice about queries that do a "select *" or methods that read in large datasets. Write your code with the anticipation that you will eventually have many users and lots of data.

Be "green" with your data - In general, I try to "Lazy Load" data whenever possible. There is no sense loading data that you may never use. My theory is load late and drop early.

Caching is also very important, especially with static information like lookup lists. For web development this could mean that you store some data in the Application or Session variables.

Also, don't store static lists in the database unless absolutely necessary. As a DBA, I have seen people store ridiculous things in a database such as month names or days of the week. Last time I looked those did not change!

Pick good defaults - Make the program usable in its default state. Most users do not read XML and aren't interested in editing it. By adding extraneous configuration settings you are only adding complexity to your application. Usable defaults are the way to go. If there are parameters that need to be modified by the end user then give them a user interface to change them.

Don't Overdesign - Every programmer has probably been guilty of overdesigning something. Sometimes we get tempted by fancy patterns and practices. In addition, some of us tend to abuse things like inheritance and abstraction. Most of the time its best to keep things simple. It is a rare occasion when I need to have more than 2 layers of inheritance.

Overdesign is also very common with databases. People get hung up on rules like "third normal form". Sometimes when you over-normalize a database is makes it impossible to query the data later on. If your application is going to require reports, sometimes its better to design the database with the reports in mind. In other words, let the reports dictate how the data is stored.

Code is not self commenting - I can't tell you how many times I have written a piece of code only to return to it a few years later and ask myself "What was I thinking? or "Why did I do that?". Nothing is worse then spending an entire day rewriting a section of code only to roll back the changes because you discover the original reason of why you wrote it that way.

And Finally, "Software is never finished. It is only abandoned" - One of my old co-workers told me this about 10 years ago and it stuck. The statement is absolutely true. There is always something that can be improved, optimized or re-written.

If you have any philosophies or rules that you developed over the years then please leave a comment. It is always fun to hear your thoughts!

Comments

Cadred (dotNET) , on 1/26/2010 11:49:54 AM Said:

trackback

.NET Pulse 1/26/2010

.NET Pulse 1/26/2010

blog.cwa.me.uk , on 1/27/2010 3:37:33 AM Said:

pingback

Pingback from blog.cwa.me.uk

The Morning Brew - Chris Alcock  » The Morning Brew #526

Kevin India, on 1/27/2010 11:23:35 AM Said:

Kevin

I would like to add the saying that our software will fail at sometime. While we cannot anticipate all the possibilities of failure, we can allow our software to fail gracefully. And provide information through logs and debug prints as to where the problem occurred.


http://kevinrodrigues.com/blog

kevinrodrigues.com , on 1/27/2010 1:00:11 PM Said:

pingback

Pingback from kevinrodrigues.com

Today's read: Software Development Do's and Dont's | Complete Coding

mikeceranski United States, on 1/27/2010 2:36:19 PM Said:

mikeceranski

I like the comment Kevin. Exception handling is an important topic. Sometimes it is tough to decide how much information to show to the user regarding exceptions. Some people trap all exceptions because they don't want the end user to know that something bad has occurred. However, you mask so many problems that way and make the code impossible to support. We should anticipate failure and code accordingly.

Matt Freeman United Kingdom, on 1/28/2010 1:33:54 AM Said:

Matt Freeman

I tend to agree except for "Think large write small", this tends to lead to over-engineering or as I witnessed the case of seeing a 50 person company purchase SQL Server Enterprise for no apparent reason than thinking big, of course the 1000x increase in users didnt occur (and certainly none of the enterprise features including dozen plus CPU support were utilized), one thing that did arrive though was the invoice from our software supplier. One can analysis and predict best-case growth to a reasonable extent, e.g. if you had 5000 order one year, test your software against 50000 orders the next, but not 5billion, that's rewrite time.

Btw, web browsers with frames and animated gifs in 1992? You mean 1996? or 1998?

thoughtclusters.com , on 1/28/2010 6:51:53 PM Said:

pingback

Pingback from thoughtclusters.com

Do The Basic Research | Thought Clusters

Michael Ceranski United States, on 1/28/2010 8:02:40 PM Said:

Michael Ceranski

Matt, "Think large write small" means that you should try to design your code so it is performant but also simple in design.

Ordering an Enterprise SQL license when you only need standard edition is a whole other issue. The point I was trying to make was that if your code is written correctly it will scale.

drakz.com , on 1/28/2010 9:54:47 PM Said:

pingback

Pingback from drakz.com

Code Capers | Software Development Do's and Dont's | Drakz Free Online Service

Software Development Lucknow India, on 1/30/2010 4:00:06 AM Said:

Software Development Lucknow

Hi, just visited your blog first time, and found it quite interesting. Nice post indeed. Thanks for sharing it to all
Regards
Rama
<a href=” http://www.cloud18.com”> Software Development Company Luck now </a>

rhondatipton.net , on 1/31/2010 8:34:20 PM Said:

pingback

Pingback from rhondatipton.net

Weekly Link Post 130 « Rhonda Tipton’s WebLog

MYOB Training Australia, on 5/5/2010 3:41:26 AM Said:

MYOB Training

Oh, Man!  I remember those flashing gifs and FRAMES - just shoot me. LOL  Thanks for the list of great tips. The one not to overdesign had me jumping up and down cheering.

Managed IT Services Melbourne Australia, on 5/5/2010 6:28:19 AM Said:

Managed IT Services Melbourne

You are making some really great points in this post.  I like the idea of "green" storage - maybe people can get it that way!  Lots of useless data just clogs up the system and screws you up down the road.

364.luna-atra.net , on 5/20/2010 1:13:15 PM Said:

pingback

Pingback from 364.luna-atra.net

Used 02 Mitsubishi Montero, Endeavor Performance Parts Mitsubishi Montero Sport

Comments are closed