4 ms·
That's fine. We build code for issues that are here and now. Like most jobs: they answer immediate needs. The small amount of code that's useful for years or d
by jraph 3y ago
That's fine. We build code for issues that are here and now. Like most jobs: they answer immediate needs.
The small amount of code that's useful for years or decades needs to be built on a stable foundation and with few dependencies. This probably matters a lot more than the code being a bit messy. It should require as little maintenance as possible.
I have two pieces of PHP code I wrote more than 10 years ago, in PHP 5.1, that I still use. Both are messy, one is outright horrible, but they have no dependencies (the horrible one optionally depends on GeSHi, but there's a runtime check for its presence and has a "degraded" mode for when it's not there). They work and are relatively bug-free (the horrible one in particular is battle-tested). I didn't have much to do to run them on PHP 8.2. A few superficial fixes that were actual issues (and took half an hour to fix). By the way, I can't figure out how PHP 5 was even able to run this code. You could have mandatory parameters after ones with default values. Yuk.
- WA 3y agoSame here. I have PHP code in production that dates back to 2008. zero dependencies, a few quirks, it runs on PHP 7.something for now, might upgrade to 8 at some point. It’s ugly, but it gets the job done. Best thing is that front-facing HTML and JS from 10+ years ago still works flawlessly, even though the UI is certainly dated. But I guess that’s the same with HN, where the design never really changed at all and just works.
- withinboredom 3y agoYou do realize PHP 7 is EOL for quite a while now[1]? PHP 8.0 is on security updates only. You might want to upgrade sooner rather than later unless you're paying for backports. [1]: https://endoflife.date/php https://endoflife.date/php
- WA 3y agoYes, thanks for the reminder.
- aspyct 3y agoI must say, I never quite liked PHP as much as other environments, but I keep using it because it just gets the job done.