Jason Baker's Blog
  • Show More Archive
  • Show More2012

    • September
    • October
    • December

    Show More2013

    • January
    • February
    • March
    • April
    • May
    • June
    • September
    • October
    • November
    • December

    Show More2014

    • January
    • February
    • March
    • April
    • May
    • June
    • July
    • August
    • September
    • October
    • November
    • December

    Show More2015

    • January
    • February
    • March
    • April
    • May
    • June
    • August

    Show More2016

    • January
    • March
    • August

    Show More2017

    • October

    Show More2018

    • February
    • April
    • November
    • December

    Show More2019

    • August

    Show More2020

    • June
    • July

    Show More2021

    • June

    Show More2022

    • December

    Show More2023

    • August
  • Show More Category
    • AJAX
    • Architecture
    • Automobiles
    • Birds
    • Cycling
    • Furniture
    • Health
    • HTML
    • iOS
    • Javascript
    • Linux
    • Music
    • MySQL
    • Nature
    • Photography
    • PHP
    • Science
    • SEO
    • Sphinx Search
    • Technology
    • Trees
    • TV
    • Whales
    • Windows
    • WordPress
  • About

Refactoring Again

6 January 2013

I can never leave well enough alone. I'm refactoring my website and adding features to my CMS. One of the main reasons I am refactoring is to make my code more reusable across the websites I have built. I wasted alot of time rewriting the same scripts over and over again. I would make a good change to one version of a script, but he similar version I had made on another website was just different enough that I couldn't copy the new script and use it.

One major thing I have been doing to make my code more reusable is by simplifying my HTML. Mostly, I have been reducing the number of divs, classes, and IDs. My mastery of CSS has grown by leaps and bounds over the past year. I finally have a good grasp on the box model so I don't have to put divs around evertyhing to get them do display properly. I have also wrapped my head around all the child relationships so I don't have to style everything by explicitly adding a class or ID to identify and element.

I have ideas for alot of websites I would like to do, but my poor coding practices have made it difficult to reuse code. I know that I will always need to write some new code for any new site I do, but I shouldn't be rewriting mail forms every time I do a new site. I'd rather spend my time on the graphic design aspects on a new site than reinventing the wheel. Now if I make an improvement to a script, I'd like to be able roll that out to all the sites I do.

Summary

Never doubt the importance of reusing code.

Filed Under

  • HTML
  • PHP

Site Map

  • Home
  • About

Site Info

  • HTML5
  • CSS
  • Login

Copyright

  • © 2025, Jason Baker

Follow Me

  • Follow Jason Baker's Blog via RSS!
Hemlock: Content Management System Close Login

Login

Username

Password

Stay signed in.