Before You Start Programming

May 22, 2009 by: Allen Sanford

K.I.S.S (Keep it simple stupid) the most famous words I know. I believe that every person has heard those words at some point in their life, and believe it or not they apply to everything except those things that are meat to directly oppose the very concept. There might actually be a few people out there scratching their heads saying what does that have to with “Before You Start Programming” will you guessed it I am fixin’a (that is a southern word those of you wondering means fixing to’) tell you.

Over the past few years I have come to realize that people in web development are just like everyone else they get comfortable then they forget to learn or plain just get lazy. Now I am going to give a few pointers here that can keep this from happening to you. If you follow my rules which will be reverberating the K.I.S.S method over and over you will be able to be productive, keep learning, and still be “lazy”: (Oops did I write that).

TIP #1

You should create yourself a library of reusable code. Now I don’t mean a collection of scripts that you have somewhere, I mean you should keep up with those tricky little code bits you write over and over and over. If you have written it twice you need to make a method in your library for it. OOP is your best friend here. You can create a base class called library and then you use inheritance to make them available forĀ  every class you ever write from here own out. For example, I am a huge PHP fan so this will of coarse be a PHP example. First, you could have a file named library.php that you copy to the root of every project of like in my own library I have a directory named library. Then I have devised a way for me to load different classes dynamically. For this example though I will stick with the easier example although the process is very similar in both methods and I would extend Library either way.

1
2
3
4
5
<?php
    include_once("library.php");
    class MyNew class extends Library
    {
    ...

Now what this does is let you just call a method from the Library when you need a particular function another example is in order here. This keeps your life “Simple” by keeping you from rewriting solutions over and over instead you just modify the one you have to be better as you learn better ways.

14
15
16
17
18
    ...
    $example = new MyClass();
    $results = $example->methodFromMyClass($var); // Some method that just does something
    $coolResult = $example->methodFromLibrary($results); // This is that reusable code written in the Library
   ...

TIP #2:

Write clean beautiful code. You should take the time to write your code in a standard well spaced, no tabs just spaces, nicely indented, and self documenting code. I won’t spend a whole lot of time here because there are many books at the book store on this subject. By writing “clean code” you are making it “Simple” to read later when you have not looked at it in four or six months.

TIP #3:

Continue learning if you want a raise or just want to keep your job (or in my case clients) you have to learn. This will keep your life “Simple” as you don’t have to find a new job or client to replace the lost one.

I you think I left off some good tips or the ones here are lacking please drop a comment letting me know. Thanks.

Leave a Reply