| |

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

  • |

    Wrcnepa.Org

    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! When the WRC of Scranton, PA came to me for a redesign, their website was in poor shape. There was…

  • The Student Freelancer

    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! Over at FreelanceSwitch they have a nice write up on Student Freelancing. As all I’ve really known is student freelancing,…

  • | |

    Info Overload- The New Design

    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 hadn’t realized it, but next month will be 2 and a half years since my last redesign, which is…

  • | | |

    Trying Flexbox at Casabona.Org

    If you’ve visited Casabona.Org this week, you noticed that the homepage got a bit of a refresh; I decided to add more color, have more concise and focus content, and tried to give visitors an idea of what I do as soon as they get to the site. One new thing I tried was using…

  • | |

    I Have a New Podcast: Creator Toolkit

    I’ve been mulling this idea in my head for about a month now. See, in the last 2 years running How I Built It, a podcast that has gained some shocking popularity, I’ve realized something. Podcasting is the most fun part of my day. I love interviewing people and publishing to such a great medium….

  • |

    Thoughts on Buffer Pro after 1 Month

    Moving into 2017 I knew I needed to do more to increase engagement on social media for both WP in One Month & How I Built It. Simply promoting isn’t a great strategy; while I convert most listeners and students through my personal Twitter, I want change that. I tried doing it manually for a…

One Comment

Comments are closed.