3 ms·
I work extensively in PHP, am rather fond of it, and have built out quite a lot of tooling in the language. The reputation it has from the early 00s is quite m
by munk-a 3y ago
I work extensively in PHP, am rather fond of it, and have built out quite a lot of tooling in the language. The reputation it has from the early 00s is quite mismatched against its current capabilities and I'm glad to see more people picking it up. The API you've put together is modern and follows a lot of the best practices so thanks for your hard work!
- pphysch 3y agoI don't think it's capabilities were ever in doubt -- it had early adoption because it had capabilities that other languages didn't have/express well, not because it was a particularly nice language to work with. The OPs code is quite readable and I wouldn't mind maintaining it (vastly better than the real-world legacy PHP code I have to maintain), but my main takeaway is "this is like Python with Java syntax" (interestingly the opposite of Kotlin, i.e. Java with Python syntax).
- joeymckenzie 3y agoAppreciate the feedback! I'll be the first to admit I have a tendency to C#/Java-ify code in languages that I attempt to learn (could definitely argue it's a bad habit) due to nearly a decade of working with them. Any advice you might have to make things a bit more idiomatic to modern PHP? Always looking to improve the code however I can.
- munk-a 3y agoIt's my opinion (but one I strongly hold) that good maintainable code is modularized and clean - with strict types and a heavy emphasis on clean contracts between different components (since in an organization/large open source project many people will be contributing in parallel). It relies heavily on common patterns and styling for easy recognition and tries to do things in the least sneaky way possible. If you're aiming for this state of a codebase you'll lean heavily towards Object/Modular oriented styles which strongly resemble Java/C++ etc - even languages that express them in dramatically different manners (like OCaML) end up looking really familiar when built in a sustainable manner. There is a common visual expectation we have around code that promotes readability[1] and we'll form code in most languages to match that common visual expression. This is actually one reason I decidedly dislike python - since it's visual expression is encoded into the syntax evaluation of the language itself. Anyways the TL;DR is that, IMO, clean maintainable code looks like clean maintainable code and the language only minorly impacts this appearance. 1. That isn't to say this is necessarily the best visual expression - it could just have been chosen early on and then just ingrained in us all.
- pphysch 3y agoI completely disagree with this. The classic Java-style "enterprise OOP" code is a symptom of poor software design and papering over bad abstractions with more abstractions. There's a lot of this code also written in Python. However, I think Python's forced indentation and cleaner syntax is a boon because it makes bad code look bad and unreadable. Too often, variations in style conventions are used as a smokescreen for rubbish software.
- joeymckenzie 3y agoThank you! I've found modern PHP to be quite a joy to work with, given how much it gets dunked on in the greater tech community. It has some awesome tooling that's on par with other the languages/ecosystems I work in, and I'm always looking for a reason to write more it now.