14 ms·
I have to wonder, how big is the overlap between people who understand and want to use algebraic datatypes, and people who program in PHP? PHP’s main selling p
by codeflo 6y ago
I have to wonder, how big is the overlap between people who understand and want to use algebraic datatypes, and people who program in PHP?
PHP’s main selling point has always been its low barrier to entry. Introducing high-level abstractions like ADTs will hurt that user group.
At the same time, I don’t think PHP can ever catch up with high-level languages that were built on less shaky foundations (and cleaner syntax). So what’s the end goal here?
- geek_at 6y ago> PHP’s main selling point has always been its low barrier to entry While this is 100% true (though latley more true for Python), the people who started using PHP years ago and stuck with it over the years have now gotten the tools for a more precise and structured code base. I personally use PHP even on servers for quick scripting of things because I never learned Python well enough to have all functions at my finger tips and don't get me started on powershell ;D
- darkcrag 6y agoJS has taken over the world and I wouldn't say that it has a more or less shaky foundation than PHP. See var.
- codeflo 6y agoYou do have a point, I’m not the biggest fan of JS either. But notice that var is linted out of every modern JS codebase. Where’s PHP’s equivalent of let/const? Also, I think a huge part of JS’s staying power was that besides its obvious warts, it always had a solid FP foundation as well. JS was one of the first mainstream languages with full closures. That was a powerful tool for building abstractions right from the start, and I don’t think Node.js would have happened without this.
- spdionis 6y agoNot clear why you think php needs let/const like in js.
- ryanianian 6y ago> Where’s PHP’s equivalent of let/const? Olde PHP used to declare global variables for all http get/post params, so "linter rules" basically said no undeclared globals. Of course the linter was a sternly-worded comment in the first <? block. Then we had the $POST array and $GLOBALS which, iirc, are considered bad-practice to interact with directly.
- tored 6y agoEquivalent of let/const for PHP would be manual use of include/require when loading php files, modern code bases rely on an auto loader. There are some legitimate use cases of manually loading a php file, e.g loading the auto loader, but that is usually the exception and not the rule today.
- stephenr 6y ago> Where’s PHP’s equivalent of let/const? Well php has actual constants that are.. constant. So if you’re asking for an equivalent misleadingly named feature, it’d be people declaring properties with an underscore rather than just making them private.
- Jach 6y agoThe overlap is probably in framework builders, and that trickles down a bit to the users who like to use them and some of the users forced to use them. I wonder if "I don't need a framework" gets you crazy looks in the broader PHP world today? Going no-framework was already increasingly out of fashion as of around PHP 5.3 (when I got out and stopped bothering to learn the new updates -- my last project used the Yii framework) so it wouldn't surprise me. Sure there's still the old practical business-needs-first PHP, I was able to update some old PHP to v7 without much fuss, yet it's more than just out of fashion it's ripe for any consultant or new employee looking to make a name for themselves to "clean up" and get with the times. Younger me would probably cringe but I'd just advise to use Java instead of modern PHP with all its bells and whistles and patterns, there seems to be little difference anymore.
- anticristi 6y agoThis. My first thought when I saw the title: PHP is still maintained?
- ChrisMarshallNY 6y agoYup. So is C++, as is FORTRAN, and even COBOL (although I don’t think they are actually adding to COBOL anymore). All of these languages are favorite targets of mockery by the “buzzword du jour” crowd, but they persist. I like modern stuff, and don’t miss some of the old crud, but there’s something to be said for a language that is over a quarter-century old, and runs a considerable portion of the world’s infrastructure. I think C++ was introduced 35 years ago, and FORTRAN is about 30 years older than that. And, of course, you have C, which is the engine behind Linux and Git.
- codeflo 6y agoIt’s not a question of age, and I think you’re comparing apples to oranges a bit. Cobol is simply kept running. Everything it does, newer languages do better. Nobody writes new systems in it. C++ on the other hand allows you to do things that other languages simply don’t, so of course it’s still alive. New C++ projects are started every day. A lot of actively developed languages have their niche. Python looks very elegant to mathematicians and engineers, and has fast math libraries. Java has an unmatched ecosystem. And so on. I think PHP's niche is low barrier to entry. Maybe I'm wrong, what do you think PHP does better than other languages? (Edit: Sorry for editing the post while you replied. I tried to word the question in a more friendly way.)
- ChrisMarshallNY 6y agoIt's a C++ and a COBOL. The language has a lot of stuff that drives me nuts (in reality, it's not much of a drive –more of a short putt [Ed]). But it is quite performant, stable and capable. I have done a lot of PHP programming, and would be very happy to never work in it again. I have a tremendous respect for the language. It also has –literally– tens (if not hundreds) of thousands of expert developers, worldwide. Many of these developers used to stink, but are now much better, as a result of their work with PHP. It also has a massive support infrastructure. HN doesn't really appeal to the types of developers that make the lions' share of PHP (and C++) implementation base, so you won't always hear about it, hereabouts. I remember reading an article, some time ago, called "IT Runs on Java 8"[0]. It talked about how much of the IT landscape is composed of folks working in tech and patterns that are not considered "shiny/sexy." [UPDATE]: Not a problem. I do the same thing ;). The main thing that PHP has, that very few other languages have, is a gigantic implementation surface. In one of my more successful open-source projects, I deliberately wrote it in PHP (4, then, reluctantly, 5.6), because I knew that would give it a far better chance of being implemented. I was right. It is now fast becoming the de facto world standard for its demographic. [0] http://veekaybee.github.io/2019/05/10/java8/ http://veekaybee.github.io/2019/05/10/java8/
- that_guy_iain 6y agoHonestly, I think people focus on the new PHP developers and the part time hobby developers and think only about that group when it comes to PHP. I think we as a whole need to understand that once you get to doing PHP professional for several years the skill level and the requirements are roughly the same for most programming languages. The company I work for is part of a large multinational company. The parent company decided to merge two of their children companies together since they operate in the same market. Sadly the two companies provide two different things in the same market and very few things overlap. When they did the merger and then COVID struck they decided they needed to get rid of developers, they took the approach that seems to be that the PHP developers were the weaker developers. So they got rid of the majority of them leaving only the ones they legally couldn't get rid of. The result, they now need to rewrite a system with only the Java and Kotlin devs who lack the fundmental business understanding of the system they need to rewrite. They also are stuck with a group of developers whose code is of a lower qualtity, that fear deploying anything at anytime on a Friday, that lack the understanding of how to build distributed systems while operating a distributed systems, who wrote systems that the day they went into production were scheduled to be rewriten because they simply weren't up to scratch with the requirements, and with a system that is labelled as scalable but can't scale as well as the system written in PHP it's meant to replace . Trying to evaluate the needs, skills, and undestanding of developers based on what language they're currently writing in is not the wisest of moves. Evaluating a system base on the language it's written in is equally unwise. Overall, I think PHP can compete with many languages and beat many languages in the web development area. In the areas such as data processing, concurrency, and system processes it's generally lacking due to the fact it's main selling point is building websites.
- tored 6y agoWhy would it hurt the low barrier group? PHP is designed that you can use the functionality you need and sub functionality to a functionality is usually also optional, e.g. you can use functions if needed and with functions you can have typed input parameters if you like, in many ways similar to TypeScript, you expand as you go. There is nothing in PHP that forces you to code in a certain style, like in other languages, it is truly multi paradigm. Why can’t you be a competent programmer that codes in PHP and also understands ADT? Where is that defined?
- tasuki 6y agoI have worked with many bright people whose day job was programming in PHP. In their free time, some maintained Haskell libraries, others wrote libraries facilitating pure fp in PHP.
- bowlich 6y agoAs someone who does PHP back-end work every day --- the lack of enums is probably my #1 complaint with PHP as a language these days and I probably find myself wishing I had access to them at least once a week.
- coldtea 6y ago>I have to wonder, how big is the overlap between people who understand and want to use algebraic datatypes, and people who program in PHP? The same as people who understood functional programming, async/await/generators/ummitabilily/etc and who program in JavaScript? JS was seen as for the lowliest of developers, but it has adopted (and people use) all those kinds of things. Understanding is often a function of availability and/or fashion, and there's not some inherent reason PHP programmers are "dumber". >At the same time, I don’t think PHP can ever catch up with high-level languages that were built on less shaky foundations (and cleaner syntax). So what’s the end goal here? On one side, it already has (caught up). On the other side, the point is moot. The end goal is that it's a very succesful language with millions of programmers and billions in projects done with it, and its team wants to keep improving it. What did you imagine as some "end game"? Getting the node of approval from Haskellers?