Thanks Andrew. My first big app that really did great things was written in php. It was very simple but reduced the wait times in the hospital I worked for from 45 minutes down to an average of 15 minutes.
PHP was never designed. It's just a pile of stuff that makes sense because it's naive solutions to everyday web developers problems. It's a collection of small constructs and functions to help build a Personal Home Page.
So yeah beginners find that great because they quickly get results with it. Now when you work on bigger things or when you need to go faster (because you're not discovering things anymore and it's your actual job) then PHP is just a hurdle not worth it being given the vast amount of alternatives in this world.
What bothers me is that most the PHP haters think PHP has stop in time and all the code is like Wordpress.
But PHP has evolved a lot in the last years. Composer, Symfony, FIG-Standards, Laravel, Twig, Doctrine, Blackfire and many many more.
Sure the core language has a lot of inconsistencies and flaws but still I found it to be one of the most balanced languages regarding learning curve, performance and infrastructure costs.
Anyone with enough experience can go very fast in their favorite language. I can go very fast with PHP and with clean code.
Of course, I wouldnt use PHP for everything. I recognize there are stuff that are better suited to be implemented in another language. The ability to understand that and choose the most appropriate language or framework for a project is what, in my opinion distinguish a top developer for an average one.
In my company in the last 6 months I have worked in PHP, Go and Java, and I am doing some side projects in Node so I am not a "one language" man ;)
Despite that, I would stil start most of my projects in PHP. (unless other language is more appropriate of course based on the nature of the project) Symfony is just beatuful :P
Oh I don't think that PHP stopped at WordPress, even though it comes biting me in the ass now and then.
I've setup a full development environment for a PHP team with Composer, a private company repo, a Git workflow, unit tests and all the goodness you can imagine.
That's why I know how much work it is in comparison to other languages.
Good to know. the problem is that many people who say dont like PHP take WordPress or similar for reference and dont even bother to check the latest evolutions of PHP.
In your case I respect your opinion and experience.
I like Node and Go, but still I am in love with Symfony Framework and I am really productive with it. Without Symfony probably I wouldnt have the same opiniion, who knows.
You might be more productive with another language and /or framework and thats perfectly fine as long there is respect for others preferences ;)
Also, if you're "not discovering things any more", you're not a developer I'd ever hire for "a proper job".
Let me take an example.
In the medical world, there is many diseases and treatments that are worth trying for each of them. However, the usual go-to treatment used to be leeching. Although some people might have gotten cured after that, I think it's pretty safe to assume that it's not an efficient treatment for anything.
I'm not saying that PHP isn't evolving. It's not designed. Not the same thing. Most of what you put in the good sides of PHP comes from the PHP-FIG which is completely unofficial because the language is not providing any kind of help on this level.
(And even there, it's mostly importing bad ideas from Java... but it's besides the point)
Also, learning and getting your skills upgraded is indeed a very important part of the job. That's why I'm checking how PHP's doing every now and then. Still crappy to me.
Make no mistake, I judge PHP from today's perspective. And I still find it's an inefficient, inconsistent and slow way to develop.
Take another example. You can buy two houses for the same price. Let's say house A and house B.
House A has a problem with the doorlock which doesn't open well and needs to be greased. Besides, everything is nice and tidy and works well.
House B has a perfectly functioning door, however there's a window cut by a wall, a patio door in the bathroom and all the faucets randomly invert warm and cold water.
Do you prefer house A or do you consider that since the lock is broken then house B is worth the fun of fixing everyfuckingthing?
That being said it's only my opinion. I respect that you would choose house B for reasons that I cannot understand.
Boy am I bored of cute analogies like this. The fact is that every language with more than two users is evolving and coping with its legacy one way or another. Yes, PHP absolutely has its problems, maybe more than its fair share, but every time I've read someone's detailed critique, they've included things which are just as bad in several other languages. So to take your house analogy, what if house A is right next door to your family and your job, but has some leaky windows and noisy plumbing; house B only has noisy plumbing in the basement, but it's in France, and you don't speak French?
Once again. Some things are used by more than two persons and are debatable. A lot of them.
However in the case of PHP I cannot see any reasonable argument to start a project with that language.
Maybe it's just me but I honestly can't see anything good in PHP.
Just about everything that you said is clearly biased against PHP. You speak as someone who hasn't used PHP7 and is mad at Wordpress for promoting poor quality (not that I can blamr you for this last point). But I cannot take you seriously when most of your points are there to artificially inflate your post.
Easy to use: yes, it really is and you haven't used PHP if you deny this. It's not even up for debate, it's one of the core ideas of the PHP ecosystem. Setup is simple and the language is very permissive. Ease of use is the main reason you get so much low quality code, there are simply a lot of beginners using it. In fact you mentioned the ease of use when talking about beginners in your first post in this thread, did you change your mind?
Your community rant is not a real argument, sorry. A language with more than 80% presence in the backend web space is going to have a huge community even when you exclude its most popular CMS whether you like it or not.
Libraries: moot point. All popular languages have many libraries, PHP included. The number is so healthy as to be considered 'enough' anyway.
Other languages are evolving: like PHP has in the past few years? PHP has just been redesigned from the ground up and you compare this to the natural evolution of your average language? Oh boy.. Are you SURE you're aware of PHP7?
Faster to work with: your personal experience does little to affect everyone else's. A purely subjective opinion.I've always found it very quick to prototype in for example.
I understand you don't like PHP and that's fine. I respect your opinion. But do not try to build arguments based on subjectivity. They get shut down fast because they have no substance. Happy coding.
I'm pretty aware of PHP 7. What's the point of anonymous classes when you're still at risk that a typo will print something above every JSON response a break the whole API?
What I'm trying to say is: I really don't see any good reason to use PHP. There's dirt everywhere you look. It's not about every single flaw, it's about all of them combined.
Hello no, JS is bad enough on the front-end for me not wanting to use it on the back-end.
Disclaimer: I don't think PHP is better than Django, or vice versa.
You sight performance as a reason to steer clear of PHP, then say Django is your go to. Fair enough.
I just bypassed the Django orm to run a specific, non complex query due to performance problems. Let me state now, there was NO other change to increase throughput, than to bypass the Django orm. But this does not mean I will now go and say don't use Django, or python or orms, just that one developer's performance boost is another devs bottleneck.
At least, you can, without jumping through loops, with clear code and tests. Pascal and basic were my first languages, then Php then perl, java and later python.
I've even used good old pascal in a recent past but python is hands down the first choice for writing clean and understandable code.
Interesting, can you describe the situation? I've had some of those issues in the past few years but nothing since you can do custom lookups and function calls.
The situation related to a server to server API call which was essentially taking data for a local cache. High request rate, you could make an argument here that we are pushing Django outside of its intended use, we certainly asked the question. You can also say, it is actually a cascading failure of sorts, which caused page contention on our database, which was Aurora AWS high throughput db. So it essentially boiled down to the fact we needed to traverse a join table, 40mil plus rows, so the db design is also to blame, but, the killer was when Django had to populate all the data into Django objects, then serialise it all out again as json. The reason being, it was holding connections so we ended up with serial, not parallel requests, limiting throughput. So we worked our way from standard python query sets, tried Q objects, Raw queries, but under the hood, they all still populate objects. The final result worked out to be interesting, because we took a raw Django connection, executed SQL, we then mapped that to plain old python objects, no framework inheritance, and serialised out the data using standard python. We reduced the total time for this query from 6min to 16s. So yes, we gave up on Django protection for this one call, but performance was the tradeoff. We still use it almost everywhere else and for user facing stuff there will be no performance issues, unless they have some lightning click finger which can cause db page contention.
Oh, right I see. Didn't .values_list() help?
In this case no. We had been using that to produce a list of IDs from the join table, which would feed into the other query, but it was still blocking the db. Never could work out why, it still uses QuerySet underneath, but we thought it should have been way faster than it turned out.
Performance is not a good reason to steer clear of PHP, considering PHP7 is significantly faster than Python.
I agree. I'm not sure what you mean by 'faster' but as long as your software meets its operational requirements then the language becomes a matter for the team to decide.
I was referring general performance, an example: blog.famzah.net/2016/02/09/cpp-vs-...
But yeah really, as long as your software meets its requirements it's not even an argument. If it were like that everyone would be writing web apps in C++.
Although that won't stop people from loving to hate it. Not saying it's the best language out there, but I remember being pretty horrified by the public bashing before starting my first job with it. I quickly found out that it wasn't even remotely as bad.
And now with PHP7 it's evolved pretty nicely. Though to be fair Laravel helps it a lot.
PHP has really gathered the hate of many people for some reason.
Sure, and some of them are better than PHP, some of them are worse. There's a lot of comments on this page saying "use something other than PHP", but it would be a lot more helpful if people shared their favourite alternatives, and why they think they're worth learning for someone who already knows PHP.
I know there are more options, but the fact remains that PHP works very well in its space. And that space is wide, judging by the fact that it's used for all sorts of web apps, including APIs.
If you ask for my personal favorite, I always go with Django (so Python).
The prime reason is the ORM. It has become so powerful that I rarely need to write SQL anymore (even for very complex queries). It also provides introspection onto the data model, which allows automated forms, admin and so on. Basically any CRUD backend is done instantly. But most of all there is a migration system that gives deterministic results and works really well with versionning and branching.
Also there is the Django REST Framework which uses the introspection abilities to make REST APIs dead simple.
Then comes all the nice "batteries included" things from the templating engine (which inspired Twig) to standard RSS or sitemap apps you can just configure to go.
And finally there is a lot of apps that will help you for common tasks, like Wagtail which will provide a very flexible CMS or Oscar which does e-commerce. All those things are not in the form of WordPress/Prestashop/etc. They are developer-oriented toolkit so you can match your client's needs while leveraging pre-existing building blocks.
Basically, everything is simple and works well. That's why I like it.
Well that sounds exactly like Laravel. Perhaps you should give it a try.
I'll admit that Laravel looks like a nice piece of framework. It has a lot of good things and certainly is not too nerve-wrecking to work with.
However, it sounds a lot like Django of 2010. Just to pin one single issue down, the migrations system doesn't play well with branching. That's a serious no-goer.
sandor11 - Why do people constantly compare a framework (django) to raw php and feel that is a fair comparison? I see "x-framework vs php" statements 50x more often than I see "x-framework vs php-framework" statements.
Rowan Collins asked for people to "share their favourite alternatives" to PHP. Rémy replied with a framework once again and compared features of the framework like ORM to raw PHP! WTF? There are many PHP frameworks with ORM's and also standalone ORM libraries! Guess what Rémy. I don't use php frameworks but "I rarely need to write SQL anymore" also. And then Rémy goes on to list more libraries and frameworks as reasons why python+django+lots-of-frameworks is better than raw php by itself. That makes no sense.
Specifically saying Laravel's migration features are inferior to Django's is the only fair and sensible thing Rémy has said.
I totally agree. Me neither can barely see a decent use case for PHP. It was a very good and fresh alternative to ASP ans CGI back then, but today is not, even for beginners or learning. I’ve read the whole thread of comments, and someone asked for some alternatives to be mentioned. Here’s a partial list, just to name the ones I know better:
Python (2003-2007, maybe I’ll come back to it. 2 prod apps): perfect language to begin with, even for kids. It is born with a design and a philosophy in mind and it evolved during the decades. Perfect tooling, and easy to jump into other fields such as AI.
Ruby (2007-, countless prod apps): I’ve used it for the last 10 (ten) years. Easy to use, but not that easy to learn well. It’s like a magic wand: you can do anything with it, but you need discipline to avoid big mistakes. I just mention Rails without further explanations, everyone knows it ;-)
Go (2012-, 2 prod apps): perfect for performance and concurrency. Very easy to learn and use, however it’s not the first choice for everything, especially web development (maybe excluding APIs in some cases). Sometimes it might be boring and require some more time and attention to get things done. I’d use it for CPU intensive tasks (image processing, number crunching)
Elixir/Erlang (2015-, 4 prod apps): my actual love! Relatively easy to learn (even if it’s totally different syntax/approach/reasoning), crazy fast, concurrent, distribuited (sort of builtin microservices), but not suitable for CPU intensive tasks (hello Python/Go/C!)
All the mentioned languages are pretty easy to learn, with awesome communities and fantastic ecosystems. Plus, a thing that is not so often considered: even a junior/average programmer in those languages has way more opportunities (in quantity and quality) for well paid jobs than a senior PHP one. Have a look at joab boards to get an idea.
Then there’s PHP, I’ve used it from 2001 up to 2008, I’ve built dozens of production apps (custom CMS engines, booking systems and marketing tools) mostly from scratch, then I promised to myself to never touch a PHP code again. Yes, it evolved in the last 10 years, good frameworks and libraries arised (inspired by Python Django and Ruby On Rails) but it’s still PHP (from a 360 degrees perspective) and their quality/productivity can’t be compared to the ones I mentioned.
Good developers tend to learn new languages, technologies, tools and patterns to get better at their jobs. They also tend to avoid PHP as much as possible 😉
It's funny because as I've been doing JS in some form since the early 2000s, I'd say that what I used to do and anything ES6 forward is DRAMATICALLY different and better.
I think the biggest confusion comes both from stuff like promises and the other functional aspects that can be confusing to newer devs (then again, Lisp confused the f**k out of almost everyone in college, so there you go), and separating the basics of the language from the various frameworks -- there's so many ways to do things.
And I've found your last paragraph applies to literally every technology I've dealt with. They all seem great when I first learn them, because it's new and usually for the purpose the tech is meant for. When when I have to solve problems they weren't meant to solve or maintain anything, it's boring because that's life. I wouldn't put that solely on PHP.
Oh, sorry, I'd love to finish my thought but I've got to get back to work, NPM just finished downloading the required 4 billion packages for a small change I'm working on :'(
This is what I don't understand. Not that many years ago everyone hated JS and PHP equally.
Thanks for sharing, I enjoy hearing stories like your’s. Building an app that helps people save time is the ultimate goal, not picking the most perfect programming language.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.