4 ms·
> I'm curious what is the value proposition of the latest PHP version(s). I think more and more people have started to realise that typed languages make better
by heurisko 5y ago
> I'm curious what is the value proposition of the latest PHP version(s).
I think more and more people have started to realise that typed languages make better, more reliable software. The incremental additions to PHP's type system are just a move towards this, I think and can be seen in other languages such as Typescript.
I'm just not a fan of dynamically typed languages anymore, even for small scripts.
> Why would I choose PHP when starting a greenfield project?
I think it depends on your greenfield project, but there are many domains where problems are just solved related to e-commerce or shuffling around content online.
To this point, PHP benefits just from the fact that it has been around for so long, and will continue to be supported far into the future.
Many PHP frameworks like Symfony have LTS releases that will ensure software is supported years into the future, with strong support from agencies.
- chefandy 5y agoI think that says more about your particular mental model of programming than about programming in general. In the couple of decades I’ve been coding, I’ve seen good use of both dynamically/weakly-typed and strongly typed languages. Sure— thinking you’re going to save time writing more complex applications by avoiding boilerplate is flatly wrong. However, if boilerplate would be a double-digit percentage of your code, you probably will save time avoiding it because any unlikely dynamic typing issues will be easily resolved. But if it’s small enough to be inconsequential and you’re in the typed-language zone, why not use your typed language, anyway? Avoid dogma and use the right tool for the job, I say.
- deleted 5y ago[deleted]
- heurisko 5y ago> I think that says more about your particular mental model of programming than about programming in general. Well, I originally started programming only using dynamic types. Then I moved to typed languages, and I could avoid whole categories of errors. I don't see it as dogma, I think typed languages are just qualitatively better at creating software. I also think this is starting to become industry experience, as efforts like Typescript, and the incremental additions to PHP's type-system show.
- DerArzt 5y agoI started on the other end (my first language was C89) and I am with you on types. Just being able to read a plaintext file and know what type every variable and parameter is just makes reading the code easier to me. My primary language is python at the moment, and I don't think I could continue without the type annotations that you can add in coupled with mypy (a static type checker that you can run on the cli as part of a build). Every time I see a regular Map with nested maps, I get a little annoyed.
- chefandy 5y agoCategorically better for everything and not categorically better for everything you write? How about for the type of task PHP is often used for? A nearly default CRUD web app w/loads of fields and tables? Rapid prototyping? How about a bunch of simple, standalone interface interactions in JS? The extra grammar won't provide much architectural or conceptual clarity in those super common coding tasks because they're already dead simple, or in the case of the rapid prototype, don't need to be durable. Most data transformation— e.g. from the database into hashes— is taken care of by worn-smooth libraries that won't likely cock things up. For these tasks, front-loading complexity for little subsequent benefit is a questionable choice. Maybe you're so used to working with types that you're just as fast,time isn't a factor? Great. If you're not, or another developer you're working with isn't, and time is tight, it's probably a bad choice. What many of these systems are starting to offer is the option of adding type hinting which is exactly what they should be doing. Python's type hints have been great in a new nontrivial project I'm putting together with multiple developers. If I had to use them for every bit of disposable utility script I write and every little prototype proof-of-concept I stand up then I'd be much less productive. I reckon skipping situation-specific cost/benefit analysis before asserting something is always better is definitely dogma. ¯\_(ツ)_/¯
- heurisko 5y ago> Categorically better for everything and not categorically better for everything you write? For everything. As I mentioned, I started out using dynamically typed languages. I don't agree with your idea that types somehow make it harder to develop things quickly--even the throwaway things. With types I get to grips with a new API quickly via autodiscoverability, and types provide guard-rails to know I'm using the API properly. With types, I can avoid whole categories of errors, as even the "simple" things like, for example, processing a CSV file can mess up, when someone has accidentally entered a date instead of an ID and that ends up failing for the user. It's not dogma to have an opinion that types provide a qualitatively better programming experience all around.
- cutler 5y agoThis static-for-everything trend is absurd. Compiling one-off scripts? Give me a break - they're not called scripting languages for nothing.
- heurisko 5y agoTypes != compilation. PHP provides types but is not compiled.