| |

Freelancers: Generalize Your Code

Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don't hold it against me. One of the perils of having a 20+ year old website!

One thing that was really driven home during my first year of grad school was the importance of reusable code. Not to say that it wasn’t taught to me as an undergrad, because it was; this year it just seemed to hit harder. As a freelancer in a niche market (small businesses, facebook apps), I tend to generate a lot of similar code. Just recently (within the last few months), I’ve started to generalize that code into reusable PHP objects, and it really helps.

I point out freelancers in the subject of this post because I feel, at least starting out, it’s not something freelance programmers (or designers for that matter) think to do. I know my concerns were more getting those jobs so I could code, not the process of coding. But whether it be a list of objects you can use on each site, or a HTML/CSS template with variables for the title, key words, headers, etc., you can save a lot of time in the long run by taking the extra time to abstract out the details and come up with something general you can use over a number of different sites. I, for example, have general code for: XHTML/CSS templates (NOT the design, just the general tags that should be applied to every site), [basic] contact forms, [basic] google maps, database objects, image uploading objects and XML parsing objects. Right now I am taking the time to look at other code I’ve done to see how I can generalize it.

This doesn’t only save time in writing the code either, but in testing. If you have core code that you know works, you don’t need to test for the general cases, or debug that code; just what you’ve added to customize it for that site or app. It’s stuff like this that will increase your productivity and your profits in the long run.

So generalizing code helps- and not just with time, but productivity and profits. And just about anything can be generalized to some extent. So the next time you code, take an extra moment to think how you can abstract away the details of that project (the variables if you will), and how much of what you are doing is reusable.

Similar Posts

  • | |

    WConroy.com

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! A new Featured Project. Bill Conroy is running in my district for Supreme Court Justice (of my district). He came…

  • The Right Way to Explain Your Freelancing Career to Your Dad

    Earlier this week I read an article offering advice on how to explain your freelancing career to your dad. It’s something a lot of young people, including myself, struggle with. However after reading the article, my thoughts were less than flattering. Not only was it bad advice, it was a demonstration of what not to…

  • | |

    College V2

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! I had the good fortune of redesigning a blog I read often, College V2. Sean posted that he was looking…

  • | |

    Manage Email Correspondence with GMail

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!This seems like a silly title, since GMail is an email client and all. However, wouldn’t it be nice if you…

  • |

    Getting Organized

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! With just a few weeks until school started (me going into my senior year I am both excited and apprehensive),…

One Comment

Comments are closed.