Technical debt

I started this page back in 2003.

In that year, WordPress released version 0.7. Altavista was purchased by Yahoo. Smartphones weren’t a thing yet. This was 3 years before jQuery’s first release. And even Joomla was yet to be released.

This was a full decade before I’d finally move this project to its own domain name. I didn’t use a version control system since I didn’t have a server in which to install subversion (or *gasp* CVS) and Git/Mercurial hadn’t been “born” yet.

D&D’s third edition still felt new. And I’m pretty sure I started this project before 3.5 came around.

My code was small, I just had a couple of pages and a handful of DB queries. But developing these tools can be so much fun… that the codebase grew. Organically… and messily. Even though I reused a lot of code, the technical debt was piling on. And I don’t spend that much time on this page, so the earlier I tackled this debt, the better.

So in 2019 I settled on MVC as my pattern of choice and picked a framework with which I felt comfortable. Said framework has had two major revisions, but upgrading to the newer version so far seems to be less painful than was moving my spaghetti code to an organized structure. In retrospect, I should have started earlier.

But now, as 2024 draws to an end I’m 99% done.

Yeah, it took me 5 years. But in my defense, I did say that I don’t spend much time here. And I did take a couple of detours, like when I realized I could write the Deckplan generator or the Subsector generator thanks to heavy code reuse. Both these generators took an amazingly small amount of time. Yes, they’re very rough on the edges (as usual) and unfinished, but they might be useful to someone somehow.

If all goes according to plan, future features and improvements should take less time to develop.

Why PHP?

PHP seems to have a bad reputation.

If you search the web, you’ll find tons of rants on how PHP is terrible, flawed by design, and some even less flattering stuff. But I don’t share the sentiment. I think that PHP’s main crime was being attractive to too many crappy developers.

My Love/Hate affair with Java

I learned Java back in the mid-to-late 90s. Beans was still considered new and Swing was expected to be the next big thing.

I loved it. It was simple, elegant and worry-free. Write once and let JVM worry about the rest. What could possible go wrong?

IMO: it was overused (and a bit bloated).

Take the Eclipse IDE, for example. Sure, nowadays it works fast enough on any decent computer. But 10+ years ago, it was more resource hungry than what most affordable PCs could deliver. Would I choose to write an IDE in Java? Maybe today I’d consider it, but it wouldn’t be my first choice.

Around that time, lots of stuff was being written in Java. Everybody had to know Java if they wanted to have a job, and we’d get freshly-minted programmers insisting that they could do device driver development in Java.

So I learned to hate Java.

Enter PHP

I was convinced to learn PHP mainly because of the expected speed of development. I wouldn’t have thought to program in anything other than Perl at the time, but a friend talked me into it for a small side project. I loved how fast and easy it was to do something useful with MySQL.

The “register globals” incident

Yes, this was one big design mistake. I’ll even admit it: at one time I did rely on register_globals. Guilty as charged. Maybe we didn’t know any better. But even if the PHP group changed this more than 15 years ago, it seems like the detractors haven’t forgotten.

Yes I have written crappy bits of code (other than the register_globals). Many of those crappy bits are still in the current codebase. And yes, I feel kind of ashamed.

There is no absolute “best” language

In the same way we can’t (and shouldn’t) use Java to write low-level software, we shouldn’t use Assembly language to write a cross-platform word processor.

Lots of people have a “favorite” language and will defend it fiercely. But languages are tools and some may be better that others given a specific purpose.

Whether due to laziness, ignorance, or just for fun: you can write crappy software in any language. You may want to complain about that weird way PHP handles dynamic typing, or comparison operators… and you may be right.

I might even agree with you if you decide to choose another language for your next project.

And if it’s not your choice to make, best I can do is recommend that you use version control, stick to a coding standard, and test early.

Every language sucks. And every language is beautiful.

Seriously.

So… why PHP?

The way I see it, PHP is great for rapid development of (non-critical) websites.

I don’t allocate a lot of time to this site’s development, so I need to be able to get a complete function or block of code done in a very small amount of time. PHP is good for this.

It’s about moving forward.