Content

Good programming practices for web developers

submitted on 30th Oct 2004. A part of Articles.  submit an article

written by owen

This is a down and dirty article directed mainly to PHP and ASP website programmers.

Project Scope

Keep the scope of your project in your head at all stages during the development projects. Try to keep everything dynamic, especially when you dealing with large amounts of data that will be difficult to change in the future. Small additions today may make it easier to add extra features in the furture. A program that is too static will make it impossible to adapt to future change. Sometimes you can keep it simple but it comes down to whether your going to save time now or save time later.

Client expectations

Clients can frequently cause unnescessary headaches for programmers working against a deadline. It is important to keep track of what they are doing and what they expect will be the end result. Use hand signals and charts if necessary.

Auto-Increment id for every table

Doesn't matter how small the table, how many columns or what keys your using - put a auto increment index column on the table. Do it, do it now! This will also be included in another upcoming article Good database design practices for web developers

Protect your data and validate

Worst case scenario all your data and all your tables get deleted from your database and you have no way of getting it back. Validate your user input. Create a few server-side functions so you can do it quickly and consistently across multiple websites.

Javascript is an after thought

After you finish adding you error checking you can add you javascript but otherwise leave it out. You site will work better in the long run and you'll have fewer bugs to worry about.

Common Functions

Make functions for you commonly used code and keep them consistent across all the websites you develop. It'll save you time and allow you to qiuckly update and improve your websites and programming habits.

Write your own code if you can

There is simply nothing like custom code, especially if your able to write it very quickly. You should be able to access, debug, and fix errors quickly without that clueless look on your face. If you use open source code make sure it's good code and you pay respect to the copyrights owners.

If you didn't write it don't mess with it

The first sign of doom occurs when you start to change something you downloaded off the internet. One change here, another there and soon you have a rogue app on your hands. Try to make as few changes as possible, so that you can upgrade to newer versions quickly and document these changes so that people can know what you added. If you have to make extensive changes then you should have written it yourself.

Test

Get somebody to test your application, you can't do it yourself.

Read

The Top Ten New Mistakes of Web Design

Anything I missed?

permanent link, visited 1749 times.

comments

  1. I can't read other people's code, so all I have is my own. I am building my own library of commonly used functions, classes and regular expressions. Never trust user input. Last but not least keep names consistent (ie. same prefixes, same language, etc) and develop your own style and stick to it. If you code in the same style all the time, your development and debug times will go down. Not to mention constancy throughout all the pages.

    by Arie ( Sat, 30th Oct 2004 at 11:31 am )

  2. Owen,

    Nice article... looking forward to the next! I've recently started planning a CMS, and an trying desperately to research/document as much as I can before hitting the code.

    Any tips for moving forward on such a project?

    by Frank ( Fri, 05th Nov 2004 at 4:10 pm )

  3. start out with a simple plan, build it and then make it complicated. A simple plan is key.

    by owen ( Fri, 05th Nov 2004 at 4:48 pm )
    null pointer exception on the stack 

  4. Good thoughts for new persons as well as experienced coders. Keep em comin..

    by Billerg ( Sat, 13th Nov 2004 at 2:13 pm )

  5. Good article. I agree with a lot of it and I'm sure many persons will benefit.

    I disagree with the thing about changing other people's code. It is by standing on the shoulders of your peers that you progress, I don't believe in wheel reinvention (wheel improvement is so much better).

    I do most of my work with Python and Zope which means code is generally very easy to read.

    by pigeonflight ( Wed, 17th Nov 2004 at 8:31 am )

  6. I'm not sure I agree with the bit about Javascript. My manager's philosophy (which I have come to adopt) is to prevent the user from submitting erroneous data in the first place. Why have them fill out a long form, only to tell them after the submitt it that they can't? This works in our environment because we are running an intranet-based application and all our clients are using IE. In the bigger world out there, maybe your recommendation would hold, but I don't think its necessarily a rule.

    by nder ( Wed, 17th Nov 2004 at 1:39 pm )

  7. Don't understand a thing but it sounds impressive. I wonder if I should do a course in Web designing.

    by Gelas words ( Sat, 29th Jul 2006 at 6:58 am )


Post your comments on this article


add picture, your website and other options

More or less

How can you NOT like ketchup? 2 by owen

San Fernando, Trinidad 1 by Keith - Caribbean Ideas

Party Decorations 2 by Mad Bull

jump into jeans 1 by owen

Downtown 2 by owen

Info

JAMAICA FREE Classifieds

There have been 13 new comments since yesterday.


Hi Owen, long time, no see. Good luck with Dean, from what I can see on the maps it's coming in now. - Vegard ( Oslo, Norway )


Da blog yah hard...cool my yute. - Stunner ( Kingstun )


thanks for sticking up for me in the waferbaby dev list! - michael halvorsen ( elyria, oh usa )


Great site you have. Keep up the good work - Xpi ( Norway )


We were just wondering where we could purchase our very own Owensoft... we're planning on staging a mudwrestling match between it and our Microsoft...winner gets to take on Adobe Acrobat Reader (which has been known to fight DIRTY let me tell you). Thanks for visiting our site, Lori and Cutcha - Lori and Cutcha ( San Diego, CA )


Just browsing....an interesting read..... - Jamila ( Barbados )


Interesting site, i really like it . - Danielle ( Trinidad )


Luv dis site - Troy ( Jamaica )