4 ms·
There's nothing inherent in the language that makes building non-spaghetti code difficult. Technically, that's mostly true. Culturally and psychologically, I'm
by Zak 15y ago
There's nothing inherent in the language that makes building non-spaghetti code difficult.
Technically, that's mostly true. Culturally and psychologically, I'm inclined to say it isn't. Just as you're more likely to leave things lying around haphazardly in a room that's already messy, you're more likely to write sloppy code in a sloppy codebase. When the language itself feels sloppy, it's damn hard to avoid that effect.
Sure, you can write good code in PHP, but why would you want to when there are so many other languages out there? The only reason I can think of is if you're selling a product to be deployed on shared-hosting websites belonging to customers.
- MatthewPhillips 15y agoPHP is the default web language. If you're pitching to a client who expects to maintain the code once you're done and you suggest Clojure, Node.js, or even Ruby in a lot of cases you won't get the gig. By doing so you've raised their costs; PHP programmers are easier to find. This is the main reason I'm not doing web consulting!
- Zak 15y agoBy doing so you've raised their costs I don't think that's actually true, aside from maybe $10/month extra in hosting[0], I think costs tend to be lower with not-PHP. Using PHP greatly increases the probability that a random contractor will be a bad programmer who will write things that are broken, require more billable hours to get things done or make a mess that slows down the next guy. I've never lost work due to suggesting not-PHP to a client. I have, however regretted failing to do so several times. I've come to believe that a client's insistence on using PHP is nearly as much of a red flag as a programmer not knowing anything else. [0] If a client is worried about $10/month extra in hosting costs, you'll probably also have to fight them for every dollar. They might even try to get out of paying what they agreed to. I've had it happen.