| |

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

  • | |

    Manifest Development Redesign 2011: The Homepage

    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![singlepic id=7 w=320 h=240 float=right] Last week I launched a redesign of my freelance site, Manifest Development. I started developing it in…

  • |

    Small Business Websites

    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!Yesterday I read a very interesting article in the USA Today about the 7 Deadly Sins of Website Creation. The article…

  • |

    I’m on Github!

    I know it’s something I should have had for a while but I generally don’t feel my code is up to snuff. Seeing as I’ve been promising people my code, however, it makes sense. My username on @github is jcasabona. You can get to my repo using the link below. My Github Repository Right now…

  • |

    Freelancing: Distractions

    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! As a freelancer that’s still in school, I move back home for the summer into a house with my parents…

  • |

    5 Functions You Should Consider Outsourcing

    In our daily lives, we outsource responsibilities and task management to apps. So when you want to find the time to grow your agency and create recurring revenue, why not outsource some of your business functions too? Here’s my list of the five functions you should be outsourcing.

One Comment

Comments are closed.