On Migrating femtoblogger from PHP to Go
After too many years of femtoblogger succumbing to PHP language drift, I’ve been idly reimplementing it in Go.
I’ve been through several iterations wherein I tried to force sophisticated abstractions onto Go, with rather poor success. I finally realized that Go deliberately eschews abstraction. I gave up abstracting and just wrote out the code in as many minor variations as required to do the job, and it was a much more pleasant experience.
In the end I’m looking at about 2,000 lines of Go (not counting imports I didn’t write) which has most of the functionality of the 3,000 lines of PHP. So, within a power of two, they appear to be a wash.
femtoblogger has gained some important ground:
It is statically type checked. Typos and errors won’t be lurking around to explode at run time.
I have an executable which will continue to run until I break it. No more will the web site disintegrate when I update PHP on the server because the language drifted or a Debian packager changed a setting.
I feel better about its security. PHP always made me slightly nervous.
I’ve ditched WYSIWYG editing for markdown. The HTML folk have had plenty of time to make editing work, it’s not my problem if they can’t get their act together without thousands of lines of Javascript repair code.
So here’s to another 7 years of femtoblogger. Who knows what I’ll rewrite it in when 2021 comes around.