I spent the better part of yesterday refactoring a huge chunk of the code that makes up this little blog engine.
I’d have to say that it’s really one of those embarrassing things… the more you learn… the more you cringe at the way you’ve been doing things.
Being entirely self-taught in programming and computer languages, I’m really missing some of the most basic design principals and patterns when it comes to writing code. Don’t get me wrong, I think I’m a pretty quick guy, and the stuff (usually) works—though looking back on the how or why it works can sometimes lead to a good deal of head scratching.
Now, in what can only be described as amazing circumstances, I’m currently being taught a fair amount of these things in a master/apprentice type situation. Learning more about what makes a good pattern. Or, for that matter, what a the heck a pattern even is. I’m getting the biggest kick out of this, and am learning a ton.
So, as I’ve mentioned, I’ve refactored a tremendous amount of the C# code that this blog (monkeyType as it’s affectionately named) is written in. Cleaning up and organizing the class files, re-writing (and re-thinking) many of the APIs, being more conservative about the amount of garbage that’s being created, and making much better use of static members. (so that’s what static means!)
With this new build of the blog (which I rolled out this morning) I’ve improved the average page rendering time by about 8x-15x… in some cases almost 30x. It’s amazing how much faster things are when you’re not hitting the disk repeatedly for every stinking page.
And, I’d imagine in 6-9 months, I’ll be looking back at this code (yet again) and shaking my head with embarrassment. The more you learn…