by codeflo · 5y ago · 0 comments
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?
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.
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?
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
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.
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.
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.
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.
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?
Honestly, after having used most of the languages at my disposal for past 22 years I've been doing this job - they were nothing special compared to PHP (or PHP compared to others).
You still have to figure the problem out before solving it with algorithms. No language or framework will help you do that.
I'm keen to hear why there are comments that demean one tool and elevate the other, when in reality - they're all just programming languages.
I agree, I've coded in PHP/Python/Ruby/Perl/Bash for many years. All languages have there own place if you can code!
Spend less time comparing lanuages and actually code something!
My subjective analysis is that each language has a niche that if fills nicely: - C - no BS, no runtime, close to hardware. - C++ - a bit further from the hardware, a bit closer to the developer. - Python - glue the two above with few lines of code. Go-to language for "data pipelines". - NodeJS - one code, can run both in the browser and on the server. Go-to language for web development. - Java - one syntax, runs both on Android and on servers.
- C# and Go - vendor-evangelised languages. Supported by huge vendors and their network of partners. - COBOL - too big to fail :))
I honestly don't get what niche PHP fills. Why would anyone choose PHP over another language? Developer pool? Ecosystem of libraries? Evangelized by a vendor? Front-runner in new concepts? Too big to fail?
PHP offers a development paradigm second to none. Drop a single file into a single directory and hit f5. Problem solved. Next.
Which language above can do that?
I am not saying that you are dumb. I am saying that your values clash with my needs. This clash is so strong that I predict that if I again try to program professionally in php and its frameworks, the interaction would again have a disastrous impact on my mental health, my livelihood, and my marriage.
-----------------------------------
Let's suppose you enjoyed baking bread, but someone rejected your work and told you that gluten gives them terrible intestinal pain. You would have a choice:
1. Conclude they're being overdramatic and be offended by their rejection.
2. Believe their self assessment, move on, and continue with your craft.
-----------------------------------
(They would have a similar choice whether or not to come into a threat about baking and yell at people about gluten)
> Let's suppose you enjoyed baking bread, but someone rejected your work and told you that gluten gives them terrible intestinal pain
Both these examples are ones where the problem isn't the tool, rather, the person using it. It's not really PHP (or the bread) being critiqued is it?
Don't get me wrong, but you don't seem interested in discussing, you rather appear to want to show how right you are without iota of PHP knowledge.
Since there's no dialogue here and you appear to be yet another code plumber, I'll bid you farewell and I wish you all the best in your career.
> If you're writing a program that only has to do something very simple, like number crunching or bit manipulation, you may as well use a less abstract language, especially since it may be slightly faster.
In your opinion, what percentage of web applications do you think are non-trivial?
And for what it’s worth, nobody chooses PHP because of the language. That’s not the selling point. The selling point is the development paradigm/runtime. It’s dead simple.
I recently started a small web project using the SAFE stack:
https://safe-stack.github.io/docs/quickstart/
I urge you to follow that QuickStart yourself (it only takes a minute or two).
Assuming you were actually able to build the project, now, look at your project structure. How many directories do you have (11)? How many files (15510)? Think about how much knowledge is required to understand what’s going on (if you’ve never touched F# you are probably lost).
What does this QuickStart app do? It is, I kid you not, a “Todo list”!
I could write an almost exact clone of this app using PHP in exactly 1 file. No configuration scripts. No build suite. No 3rd-party packages. No CLI commands. Just 1 PHP file. Thats why people choose PHP.
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.
They are working on a new COBOL standard, COBOL 202X. The last COBOL standard was 2014 which was only 6 years ago. So COBOL is still evolving
https://isotc.iso.org/livelink/livelink?func=ll&objId=194689...
Why would anyone pick PHP for a new project over, say, Python or NodeJS?
Because I wanted as many non-technical people as possible, running on wing-and-a-prayer, bottom-tier, shared hosting plans, to be able to run the platform I developed.
I made the right choice.
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.)
It is generally faster than Ruby and Python.
It's not the mess that javascript is.
Has a sane community with a wide range of well-maintained packages.
Symfony is easily a rival to Django and RoR. At that point it's a matter of preference, but Symfony is top-notch quality. I wouldn't care for the ActiveRecord usage in RoR for example.
I'm not sure that people saying low barrier to entry know what they're talking about. It's the same barrier to entry as for any other scripting language. If you're telling me about FTPing files: this is not how the PHP community has been working for the last ~10 years.
All those people commenting "I have no idea who would start a PHP project today" live in a bubble, probably based in SV.
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.
Most of the time is not language A vs language B in abstract, it really depends on the project and what experience you or your developers have.
Let me give an example that is not web development. We had a desktop app and we had a feature where the user can submit feedback or bug reports. This feedback was stored and managed in a third party product that had an API, we could not call this API directly from the application because we did not want to put our keys in the app. So we had to put 1 php file on our server that contain the secret key, we done a POST from the app to the server and the script would validate and then connect to the API. I am imagining that some people today would solve this with some super engineered containers or micro services but the solution I used with just 1 file with a few lines of code could be implemented in a few minutes by a developer and maybe 1 or 2 hours by some competent non-developer.