Level 1 scripting

When I first started with PHP a typical document would consist of a few if statements to control what would happen based on data sent from a form. Inside each if clause there would usually be a simple sql query to begin with followed by a horrible jumble of data manipulation mixed with markup rendering. At least I did not echo since I had read in some tutorial aimed at noobs that echoing was not the right way. Using the PHP tags were a much better way to go, still valid I suppose but my documents were pure horror. I didn’t include much either, my scripts were filled with massive amounts of similar looking code that could easily have been functionalized.

Why the hell did I do things like this, I already had two years of quite ok OOP with C++ and Java under my belt? First of all, this was how it was done in the noob tuts. I simply took that and scaled it to accomplish a simple system of handling communication with students at the school I was working for then. I didn’t have time or was too lazy or whatever to dig deeper into the capabilities of PHP. I just wanted everything finished asap and I realized I could accomplish what I wanted with the knowledge I had acquired from all the newbie tuts.

Soon enough insidious logical errors started to appear that I was unable to reproduce myself but my colleagues kept experiencing them in a horribly random way. Needless to say, after a few months I was the sole user of the system. Sometimes I got feedback from my students which could be really awkward; it could go something like this:

- Hey why aren’t the other teachers using this system, it is awesome to be able to login and get updated feedback from you.

- Ehm well, eh they can’t seem to get it to work for them at the moment but I’m working on it.

The bugs most likely were a result of me cramming data in massive text fields in the database since I didn’t even know that you could do joins and stuff with MySQL. My solution was to come up with my own homegrown serialization which meant that some characters were forbidden in the input. Supposedly all teachers were aware of which characters were forbidden but people forget, it is in our nature and my system was not robust enough to handle that.

So I tried to fix it but every time I started to review the code I got a serious headache. It just felt impossible to debug the hopeless jumble. I never managed to fix the bugs and I’m sure that school is not using my system today, and I suppose that is usually the fate of level 1 code. It’s doomed to oblivion.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Reddit
  • Simpy
  • StumbleUpon
  • Technorati
  • DZone
  • Ma.gnolia