25 ms·
I still love PHP and JavaScript
- fergie 4y agoI hardly ever use php, but when I do, I’m always surprised by how good it is. Its the only mainstream progamming language that is specifically designed to make backend web applications, and it really shows.
- bacan 4y agoPHP has its uses. Want a simple web app. Great. But speed is inversely proportional to the linecount. At some point it is better to use a compiled language like Go.
- artificialLimbs 4y ago2 years in, but same. Made especially beginner friendly with modern tooling [autocomplete, hover:documentation, Copilot]. Any advice/recommendations/resources for people in that weird transitory stage between ‘getting it’ but not quite Senior Enterprise Software Architect?
- larve 4y agoI think I learned it through a couple of venues. I am still thinking this one out, and definitely plan to write a post about it. 1. designing "big" enterprise software from scratch, on paper, and then building a toy implementation. I would say 95% of the actual work that goes into a big enterprise codebase are error handling, logging, changing requirements, covering the 80000 different user cases, while the architecture itself (a message bus, a pub sub pattern, a cache) can actually be written out in a few hundred lines of code. This toy implementation can then be used to run multiple experiments: what happens if the message bus gets choked out? what happens if messages get reordered? how do you change a message schema? These are rare and intense efforts in real life, but you can cosplay them with a few docker containers. 2. reading big existing enterprise codebases. This is a skill that is not often taught, and people starting to read big codebases from "main.go" are usually doomed to fail, as they will hit the "big wall of enterprise indirection". Instead, try to get the codebase to compile, skim all the files at random until you think you recognize something, set a breakpoint in your debugger and run some part of the test suite or the real thing if you are adventurous. Then, try to mess with it some. Once you found your marks, try to understand where all the big blobby nebulous enterprise nonsense comes from, and why it is there. Often, it helps to look at the source control history to see when it was introduced, and if design documents relevant to the change can be found. I try to "read" a big unfamiliar codebase every couple of months. It could be kubernetes, or nginx, or webpack, or typescript, or react. You learn a lot about real world production code. The amount and quality of opensource projects out there is nothing short of incredible these days. When I was coming of age in the early 2000s, it was linux, GNU, apache and a few other autotools driven monstrosities, with a CVS repository and a crusty mailing list. 3. learn to write RFCs I started practicing writing relatively late (in fact, my blog just got started a few weeks ago), but learning to communicate clearly about design is vital. I have always done a tremendous amount of whiteboarding, and do most of my development on paper with boxes and arrows. I think this also develops a sense of "architecture" vs "code".
- reactspa 4y agoAny idea how one would get [autocomplete, hover:documentation] on Notepad++ ??
- CharlesW 4y agoRelated Twitter thread: https://twitter.com/chris__sev/status/1554515237981679616 https://twitter.com/chris__sev/status/1554515237981679616 "3 months later w/ Laravel, I have a full SaaS that does [list of batteries-included SaaS app functionality]. No other stack is this productive"
- mwint 4y agoRails is right up there. I work daily in projects in both Rails and Laravel, and while Rails has the upper hand in many places, Laravel does win in a few categories. Which amazes me, I thought I’d never find something that can compete with Rails.
- svnpenn 4y agoI love PHP, it fits that niche of having a fast startup like Perl, while having a big standard library like Python. However after using Go and Rust, I don't like the idea of the package manager being this separate thing (Composer). I think the package manager should be part of the PHP distribution itself, not some other thing that people have to find and install separately. I am fine if people want to implement other/better package managers, but I think the PHP distribution should include something, if only a rudimentary tool.
- CharlesW 4y agoWhat do you think the advantages would be over a de-facto standard?
- svnpenn 4y agoThink about it like this. How would you feel about Go, Rust or Node, removing their package managers from all new versions? Then they make a blog post saying, "we are going to let the rich community handle any future work of developing and distributing a package manager".
- ipaddr 4y agoPHP is a community project where Go and Rust are corporate sponsored projects. It makes sense for php where it would seem foreign to those projects.
- muglug 4y agoComposer is the de facto package manager for PHP. I’ve never seen anyone try to compete with it. I also don’t believe a bundled package manager is necessary — NPM isn’t bundled with JavaScript, and it seems to be doing ok.
- svnpenn 4y ago> NPM isn’t bundled with JavaScript, and it seems to be doing ok I'm not sure what point you're trying to make here. If you install the Node runtime, it comes with NPM. So it seems you're not correct about this, unless you are referring to some other runtime. And even if you are, why would some other runtime include NPM?
- tiffanyh 4y agoPHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply so we can have a healthy dialogue. EDIT2: I also think there is something unique about PHP documentation. It has plenty of real life examples, and the ability for users to leave comments allows you to hear directly from others "gotchas" that people have experienced. I feel like PHP documentation is very undervalued.
- candiodari 4y agoI really like the serverless aspect. I still think nothing has the deployment story that PHP applications have. Just upload some source and your website is up.
- themodelplumber 4y agoPixar should make a film called "Deployment Story" in which PHP is basically Woody (maybe it's even just the PHP stuffed elephant?), and Woody ends up in the box on the street, and then Woody's dev pal doesn't realize what they've really lost until some reflection is done. I'd watch that.
- thomaslangston 4y agoThis reads better when reflection is used in both meanings.
- koolba 4y agoThere has to be a Debian angle to this plot as well.
- quickthrower2 4y agoIt is also JSX before JSX was invented too :-)
- eatonphil 4y agoI've spent a decent amount of time programming in Python, Go, JavaScript, TypeScript, Scheme and Standard ML. JavaScript is still my favorite/default language to program in.
- cjdoc29 4y agoBack in my college days, I was exposed to web application development because of PHP. Angular was still in its infancy and I was not aware of AJAX at the time. PHP frameworks, specifically Laravel and Code Igniter, made it very easy for me to put my computer science education to practical use. And I was dropping files off into our student workbenches via FTP! There was very little overhead for me to get anything online.
- WaffleIronMaker 4y ago> I love legacy codebases. > A legacy codebase means that the product is performing well. It means that I can often make immediate and impactful improvements. Wow. This person must have worked on very different legacy codebases than me. Legacy Javascript code, to me, is something that I do not want to touch with a 10 foot pole, because every little piece of it can be intertwined with and used by many other hidden places. Plus, I've never found a legacy JS codebase that has a robust test suite, so any refactoring I do can be hard to test and verify. From a practicality perspective, I get that the best programming language is the one you can use to build your product, but I tend to long for languages like C# or even Go when I'm trying to deliver a product on a team with 10+ people. Static typing really helps when you're interfacing with someone elses code, and Typescript only aids this point. Maybe if your target audience is genuinely 10 year olds learning to code, fine. But also if you're building a serious product for a company, please don't choose a "Janky programming language" because I really don't want to have to debug it after you left before really thinking about sanitizing user input. I feel like, in the hands of a really talented programmer, they can be super productive in PHP or Javascript or really anything. But I've just had a lot of bad experiences with quickly written, undocumented code.
- nicoburns 4y agoThey said impactful champagnes, and that the product is performing well. Nothing in your comment contradicts that.
- slater 4y agochampagne, ey? :D
- larve 4y agoAuthor here, thank you for reading the article and taking the time to comment. Every legacy codebase I have worked with was actually a successful business. That probably plays a big role in why I enjoy working with them. The job is not easy, and in one case (800kLOC of PHP without a single function), I had to rewrite everything from scratch. Legacy JS with its strata upon strata of framework du jour and jquery and porous language are indeed notoriously annoying. To be fair, I just isolate the legacy JS to its own little DOM sections, and then introduce a new framework in parallel until I can nuke the old code out. Revamping a legacy JS codebase often comes with a design revamp as well, so it often becomes a matter of strangling [1] out the old API. I do really enjoy how typescript allows me to gradually introduce typing and leverage static analysis for more adventurous refactoring. I use golang, rust and typescript as my daily drivers lately, but I must admit that my most horrendous legacy codebase experience was a tiny 20kLOC go program that was just a mess of concurrency nonsense. PHP codebases have a certain "flatten it out and don't be clever" style to them that make for easy strangling [1]. Highly abstracted codebases where the abstraction doesn't fit the use case anymore, or the abstraction was thoroughly eroded by generations of misinformed developers are much trickier. What language I would use to greenfield a new application would depend highly on the experience of the team, but my usual approach is "whatever we are already using". [1]: https://www.redhat.com/architect/pros-and-cons-strangler-architecture-pattern#:~:text=The%20Strangler%20pattern%20is%20one,system%20pass%20through%20the%20facade https://www.redhat.com/architect/pros-and-cons-strangler-arc....
- calvinmorrison 4y agoI spent the afternoon with Laravel, the first real framework I have touched in a decade besides Magento's Behemoth of a MVVCnotreally. It was quite sane, I had a very nice time. My application works as expected and it took me a few hours to complete, while learning the sort of get-up-and-go bits from the documentation. So overall, I think it's nice.
- kayson 4y agoThis really speaks to my heart. I learned programming as a young kid when my uncle taught my pascal. But I just couldn't see the point of console programs and never really got into it. Eventually I picked up late 90s HTML (hello geocities!) and php was a natural next step. I still remember going to the library to borrow the book PHP and MySQL web development. It was so empowering. I could make any kind of application I wanted and see the result in my browser, GUI and all (Win32 API was way beyond me at that age). I made my own forums, ebay clone, and a few web apps for an old Korean MMO. Fast forward a few decades, and things look very different. Tons of web app backends being written in go, nodeJS/TS, and I recently learned people write them in rust+webasm. It's just crazy to me. I've worked on FOSS projects that are massively over-complicated because of their platform/language choice, when they would've been very straightforward php choices. But php still has this weird stigma about it despite most of the old concerns having been addressed. I do have to say, though, that front end web development is way better than before with the advent of React and co, webpack, css libraries etc. Doing all that html/js/css by hand was always painful.
- ilteris 4y agoSurprised you didn't try actionscript for building UIs
- robertwt7 4y agoPHP was my first backend language when I deployed my first project on the web. So easy to deploy and easy to enter. I still love laravel until now, would choose it again sometimes just to have fun with it. However it's just never used in big companies so I always end up with python or java (not even c# around here except MSFT lol)
- mountainriver 4y agoYou know what I like is jquery
- 95 4y agoi like jqueryui, it is so dang cute
- larve 4y agoI assume this is meant in snark, but jquery was such a breath of fresh air when it came out. I have been doing some SPA stuff with raw DOM, later on mootools and yahoo ui around 2003-2004, and that was really the wild west.
- mountainriver 4y agoOh no, I'm totally serious, I love jquery to this day, and yeah it was incredible when it came out
- somishere 4y agoI used to appreciate PHP, I just don't have a use for it anymore.
- kennywinker 4y agoYou can write good code without compile time type checking, but it requires so much more developer focus to avoid writing bugs than a language with type checking. Everything else, php’s “jankyness”, javascript’s mystifying truthyness tables, those are easily overcome problems. Handing a string to a function expecting a number, and not finding out about it until that code actually runs? That’s the real problem, imo
- larve 4y agothanks for reading and commenting. I am incredibly bullish on static typing and static analysis in general. There are quite a few tools that bring these to PHP and JS (I am not entirely happy with PHPStan / Psalm, I am very pleased by Typescript). Before that, I have been using Jetbrains analysis tools. In web development, I find that there is a certain freedom that comes with dynamic typing that I wouldn't tolerate in other systems software (my other specialization is embedded software), as easy templating and logging are givens. The fact that so much in web can also be "caught" at runtime (monitoring, logging, tracing) changes the game quite a bit as well, giving dynamic typing a bit more breathing room.
- sgc 4y agoI think it's the fact there are no compile times (those runtime tools you are talking about are at your fingertips) that people historically have not worried as much about types in PHP and JS. In many cases it does just feel like verbose boilerplate rather than a useful tool. Type checking is just one of the many things you can test by hitting ctrl+R, and you will be doing that anyways to test everything else. (Obviously, the bigger the project, the less that is true, but that argument is well-known). Personally, I spend exponentially more time correcting my typos than my types, and auto-completion of previous used variables and functions is worth a lot more than a type system to me in my day to day. I will never argue against types, but unless I am working with somebody else, I don't need them.
- zanethomas 4y agoI'd like PHP more were it not for the army of amateur programmers hacking wordpress.
- bdcravens 4y agoHow does that impact the code you can write?
- zanethomas 4y agoI often get called in to fix things which are horribly broken.
- eggsmediumrare 4y agoThat's a funny way of spelling job security
- zanethomas 4y agoHahaha I'm freelance (aka ronin) and so the job security is actually a bit spotty. :)
- xupybd 4y agoOuch that is the worst. Called in to a great big mess. I hope by the time you get called in they realize they need to invest in some clean up time.
- zanethomas 4y ago"They" have usually been very grateful to have the disaster mopped up.
- redml 4y agojob security in software development isn't a problem especially since the pandemic started, if you're working on crappy code its because you're choosing to at this point
- martin_drapeau 4y agoMy favorite PHP feature: NO COMPILATION! Simply drop your new files and voilà - your SaaS is up to date and serving new code!
- avl999 4y agoThis also results in easily breaking production.
- sgc 4y agoBut that leads us to another feature of PHP - It is fun!
- kgeist 4y agoOn the other hand, if your production is already broken, it's much easier and quicker to apply a hotfix in PHP (just edit a file on the server directly) without waiting for the whole CI/CD to finish.
- mejutoco 4y agoThis leads in turn to testing/developing in prod. I do not personally miss it. If you have CI/CD you should not be able to skip it. Maybe putting it under a feature flag would be a safer alternative.
- kgeist 4y agoI was talking about a situation when prod is already down and something is better than nothing. For example, once we forgot to add timeouts to calls to a third-party service, everything worked great for a year, then suddenly the third-party server started hanging for no reason which made all our PHP processes hang, too, and those processes were holding DB connections so we went out of DB connections as well and the whole production went down. We quickly found the root cause and applied a hot fix (setting the timeout) by editing a PHP script on the prod server without waiting for the usual cycle "pull request -> code review -> deploy to stage -> testing -> release" which can take an hour.
- ed25519FUUU 4y agoI enjoyed PHP and Perl (and Python for that matter, which I still use daily) But now I prefer typed and compiled languages for the compile-time checks. So many bugs found this way.
- tpoacher 4y agoYour definition of "legacy code" seems to be the exact opposite of what it is generally understood by the term (in the Michael Feathers sense).
- larve 4y agothanks for reading! I use legacy code as in "code that was written yesterday or earlier", or in a less jokey fashion as "code that noone really feels ownership for", usually a codebase that shows the sign of many developers, repeated cycles of outside pressure. What I mean by "product performing well" is that the legacy codebase is still alive for a reason: it is doing its job and the job has value. Otherwise it can just be cut and deleted (a very pleasant refactoring technique, I must admit).
- tpoacher 4y agoYes, I got that. I didn't feel that the "alternative definition" was offered disingenuously, but it's still a problem when you want to have a discussion and you use certain commonly accepted terms, but with a different definition in mind. Imagine if I talked about "democracy" and in my mind I meant "The Athenian model that only allowed men over the age of 30 to vote", when everybody else was talking about, well, democracy. In case you're not familiar with the book (i.e. "M. Feathers, 2004. Working effectively with legacy code."), it is a classic and widely regarded as "The" book on how to approach legacy codebases (even if a bit dated by now). A highly recommended read. It was also very enjoyable to read, which is remarkable for an otherwise technically-oriented book. Here is the relevant except from the introduction, defining what legacy code is and why it's a problem: > In a strict sense, Legacy code is simply code you've gotten from someone else. However, clean, easy to work-with code is rarely referred to as 'legacy' code; the term usually implies a tangled, unintelligible structure, difficult-to-change code that is difficult to really understand. Therefore, a more pertinent description is: > > Legacy code is where any of the following questions fail to apply: > > - Is your code easy to change? > - Can you get nearly instantaneous feedback when you do change it? > - Do you understand it? > > If the answer to any of these questions is no, you have legacy code, and it is draining time and money away from your development efforts. Further down, he offers this simpler, provocative definition, which introduces the main theme of the book: > Legacy code is code without tests: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse. In a more modern setting, presumably 'tests' would be extended to include other good software engineering practices, like version control, CI, etc. But the book's theme still applies in the more general since, so it's still relevant today. If you've not read it, then pick a copy up, you're in for a treat :)
- avl999 4y agoIn 2022 there is no reason to prefer these dynamically typed languages over statically typed ones for production code. When languages like PHP, Ruby, JS blew up the knock against statically typed languages was the verbosity of the resulting code, slow development cycle and general cruft, these languages solved a real problem at that time. That is no longer true today- TypeScript, Go, C# code feels as fluid as a dynamic language and even Java has come a long way with type-inference that Java no longer feels as unwieldy as it used to. I legitimately can't imagine willingly not using a statically typed language for anything that matters that's gonna have more than just me working on it.
- throwaway_4ever 4y ago"No reason", at all? Have you seen how much standardized legwork is done with a backend framework like Rails and Django? How much easier that is to work with other developers because everyone is following known conventions? With Django, there's also the huge benefit of millions of data libraries an import away. When I search for client libraries to do something, anything under the sun has a Python client. Much much less so with Go, C#, and Java.
- koyote 4y ago> Have you seen how much standardized legwork is done with a backend framework like Rails and Django? How much easier that is to work with other developers because everyone is following known conventions? How is Django different from, say, ASP.Net Core in that respect?
- jrsj 4y agoIt's not imo but ASP.NET MVC is uniquely good among frameworks for statically typed languages. Java, Go, etc don't have anything comparable.
- seabrookmx 4y agoYou lost me at Java. Web development was popular in Java well before it took off for Python, and it's been one of the most popular programming languages period since it's inception. There's been multiple supported clients for anything I've ever wanted to connect to.
- lkrubner 4y agoPHP was my main language from 2000 to 2011. I liked PHP 4 very much. "Pass by value" was the default, so it accidentally introduced me to the Functional paradigm, even though it didn't have the memory management to allow for real functional programming. (It did not internally share memory between old and new versions of an object.) I dislike the direction that PHP has taken since the introduction of PHP 5. For the last 18 years or so, the language has been trying to become something like Java, but without the speed benefits we might get from it being compiled, and without the strictness benefits we might get from being strictly typed. Nowadays it has most of the heavy rituals of Java, but without any of the benefits. The single greatest thing about PHP, circa 2000, was the abstraction it calls an "array" which combines what other languages would call a vector (or a list) and a hashmap (or dict in Python). That array construct was very flexible and allowed me to get away with a great deal. Later on I discovered the "seq" abstraction in Clojure, which is even more incredible, and has the added benefit of being done correctly, in an academic sense. After 2011, I increasingly relied on Clojure, for any task where dynamic programming was reasonable. Clojure puts me on the JVM and allows me to drop into something like Java, and strict typing, in the rare cases where that seems necessary. PHP in 2000 was extremely lightweight but nowadays it demonstrates of envy of heavier object oriented languages, but again, it still lacks the speed benefits of being compiled or the correctness checks offered by strict typing. The article lists these benefits of PHP: * speed * ease of deployment I don't think anyone would pick PHP purely on the basis of speed, again, there are many languages that are faster. In terms of easy of deployment, any deployment of PHP (or Python, or Ruby) tends to mean deploying tens of thousands of files. By contrast, when I work in Clojure, I typically uberjar the code, and then I only have to deploy one file, which makes deployment ridiculously easy.
- datalopers 4y ago> I don't think anyone would pick PHP purely on the basis of speed, again, there are many languages that are faster. When it comes to interpreted languages (perl, python, ruby, js), PHP is hands down the fastest.
- piperswe 4y agoYou mention JS - I would be interested in seeing any benchmarks where the PHP interpreter beats V8.
- peanut_worm 4y agoI have grown to love JavaScript, especially in its modern form. PHP I hate more and more each day I use it.
- paulryanrogers 4y agoCan you share some pain points?
- AzzieElbab 4y agoI kinda like js but hate php with passion. Having said that php has one really very big thing going for it - people who use it are simply addicted to getting things done.
- jetbalsa 4y agoThis! I use it as a mix of web applications and back end code, like you would with python. More and more my scripts I'm writing in PHP never see a web browser but the power of PHP Data processing has allowed me to really glue APIs together that have no official support in anything. I really do love it for being able to bash out a program in a afternoon and have it do amazing things.
- redml 4y ago> Having said that php has one really very big thing going for it - people who use it are simply addicted to getting things done. does that mean every other language the people don't get anything done?
- AzzieElbab 4y agoNot at all. Just seems like PHP people are laser focus on getting things done maybe because the language and it’s runtime is so primitive there aren’t any distractions
- omnimus 4y agoIts more like they dont care (or know) much about software development and their priority is getting stuff out of the door.
- xupybd 4y agoDefining good software is hard. Every definition seems to miss something. Including the definition in this article. It misses that Good Software is cheap to maintain and can easily have features added. This goal is hard to meet and there are lots of ways to get there. You can get there with PHP and JavaScript but both languages allow developers to create a mess. Don't get me wrong all languages allow developers to create a mess but these are on the end of the spectrum that requires more tooling to avoid a mess. I'm a huge fan of strict typing. Because I make lots of stupid errors. Spelling mistakes in variables, that sort of thing. My brain seems to function well at the high level of problem solving but no so well at the details (you might be able to tell from my grammar). Strong typing helps me immensely. Many people don't have this struggle so would rather work with a language that doesn't require the same hoops to jump through. They can do it in manually, and it frustrates them to have to setup types that offer them no value. But for me, to build good software that is easy to maintain, I'll lean on the type system. It will help prevent my mistakes. So I try to avoid JavaScript. It's more difficult for me to maintain than a strongly typed language. I love Typescript as it fills that gap for me. PHP is not as bad as it's reputation but old poorly written PHP is. I once witnessed a developer come in an update a legacy code base such that it could be tested. I didn't understand why he spent months working on it. I didn't think it would pay off when there were so many important features to get out. His work completely turned that horrible mess into something maintainable. I guess my point is that new languages are desirable as they can bring down the cost of maintenance. Some of my favorites are TypeScript and F#. TypeScript is a mainstream way to put the training wheels back on JavaScript and F# is like a dream to use. With Fable, FableRemoting and the Elmish architecture I love it for frontend. It's a hard sell because it's so niche but it's great. Edit: After reading my comment I felt it was more negative than I'd intended. I liked the article and think the author makes good points, I was just adding my two cents.
- larve 4y agoThanks for the thoughtful comment. I indeed haven't fully articulated what is driving me to write this piece (besides a desire to give PHP a bit of love as it is so harshly criticized for reasons I don't entirely understand). I find "problematic PHP" much easier to untangle than say, "problematic node.js" or "problematic python". Because PHP is often older codebases that have survived the test of time, this is actually a big feature of the language. The world and web development has much progressed since PHP3/4/5, and pretty much all of that progress can be leveraged with PHP as well. If I were to green field a new project, get to pick every developer on my team and a budget to match, I would probably not chose PHP. But, if the problem were "we want to try out an ecommerce SEO idea and don't want to sell our soul to shopify if it is successful", wordpress/woocommerce + a few janky plugins and templates + a custom plugin with 1k LOC is totally something I would consider. And I absolutely loathe wordpress database legacy sludge. If I have a team of experienced PHP and wordpress developers, a set of internal plugins that can be repurposed, and I can pay a freelancer to build custom react CMS components, using PHP and even wordpress for a new project is a no brainer.
- pkrumins 4y agoI will hire everyone who agrees with this blog post and loves getting shit done using PHP and JavaScript!
- yottabyte47 4y agoI’m interested.
- seydor 4y agoThank you for hating php. I wouldn't want the culture of endless overengineering to ruin it
- angst_ridden 4y agoI'm on a team that maintains two projects with over 500k PHP LOC apiece. They're built using a decent framework (Yii 1.x). One of them has a module that's about 25kLOC of AngularJS. They've each been running over a decade, and while there are some frustrations, it's not so bad. The biggest issue is lack of compatibility to migrate to later versions of the frameworks involved. They perform adequately for their purposes. These are business applications that are not designed to scale to huge audiences, although one does aggregate ludicrous amounts of sensor data. Both codebases interact with a lot of external systems via APIs and/or batched data transfers. When it comes time to integrate with a new/different backend system, it's not difficult. Could it all be implemented more elegantly in some other language? Sure. But in long-lived business tools, there's always an evolutionary process going on, and your pristine design from year two won't be useful with the changes they want in year seven. The ability to make fast changes is important. Lastly, none of this would be possible without functional and unit tests. Those are probably more important than the languages used. They're a pain in the ass to maintain as the business uses and functionality evolves, but it allows the refactors that keep the codebases sane.
- jamesfinlayson 4y ago> They're built using a decent framework (Yii 1.x) Agreed - I've used Yii in the past and it was just great.
- GrumpyNl 4y agoJust dont use the active record.
- jamesfinlayson 4y agoHow come? I found it fine, and it was a high traffic application. It had some overhead but it wasn't enough to make us not use it.
- forgotmypw17 4y agoMany comments about static typing in here. I agree that it is a great and helpful feature, and it's also not the only feature. For many other reasons, my languages of choice are mostly PHP, Perl, and JavaScript. And I have experienced the types of bugs that static typing (and also immutability) can help with. What I have found extremely helpful is to write as if variables are immutable, not allowing myself to change them. And to do sanity checks in the beginning of every function which expects a certain type of value. Perl's taint and strict are of great help, but I haven't thought of an easy way to port them to JS and PHP. So whenever I can, I do the heavy lifting in Perl, and then use PHP and JS as glue. The main reasons I have chosen these three languages is their ubiquity and their committment to backwards compatibility. With all three, I can carefully write something reasonable 20 years ago and have it still run today. Sadly, I recently came across a GNU/Linux distribution without Perl, but it is rare. PHP is widely available anywhere with a web server, Perl is ubiquitous in modern (post-2000) *nix, and JavaScript can still be written in ways which work in Netscape 3.x and up. I think if you want to write software which continues working without too much fuss, it's helpful to exploit the Lindy Effect to your advantage.
- peaky_blinder 4y agoYou can configure TypeScript to give you the output for older versions of ECMAScript. No need to limit yourself and you get many benefits (not just strict typing but also some constructs like interfaces and enums to easily scale your codebase).
- Joel_Mckay 4y agoI would say PHP takes effort to make maintainable projects, and allowed some of the most heinous code I have ever seen in production. It was likely the years of spiral development that made it so problematic.. and pear finished the job. The good parts were a small memory footprint, fast soap/xml parser, and stateless finite execution. Unlike the 200MiB+ "hello world!" async nodejs standard popular today... one can run small php cms/wiki sites on budget servers.
- oxff 4y agoPeople positing either of the languages as "good for most use cases" have a Stockholm syndrome.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- trixie_ 4y agoEach PHP file is a magic hot swappable component. Not some bulky binary you have to full compile/deploy on every tiny change. What other web technology compares?
- langsoul-com 4y agoBiggest flaw of php to me is getting paid well and the number of jobs. From the stack overflow dev survey, php devs get paid much less than others. Laravel and php is a beast, super easy to use. All that annoying shit is setup for you. But, how many ppl hire Laravel devs? Job boards are stacked with react, vue etc. Personal use is great though.
- Gigachad 4y agoCommunity sentiment means almost as much as technical facts. PHP might be just as capable as Ruby, but the vast majority of devs, especially experienced ones, do not like it, will not suggest it, and will not apply for companies which use it. So all that’s left is low end wordpress jobs.
- weatherlite 4y ago> especially experienced ones, do not like it, will not suggest it, and will not apply for companies which use it. That's a bit of a reach, I would work for a company like Slack or Wikipedia of course even though they use PHP and so would many other devs. In fact the further I am into my career the less the tech stack matters to me; I've come to realize the bosses and the company's culture and leadership and how they generally treat employees is WAAYYY more important than whether the stack is Rails or Node or PHP. To me. They are all web stacks that do more or less the exact same thing and the work you do is really quite similar on all of them. I was sure being a Rubyist is what makes me happy because I like Ruby...well guess what, you can be miserable in a Ruby shop...that's the lesson I've learned. If I ever become super choosy about tech it's only because I really wanna switch directions - e.g do low level development or something like that which is dominated by C. But all the high level web languages ...are all the same to me (my preferences aside).
- bigtunacan 4y agoHonestly, this is the biggest reason to not use PHP. PHP Developers are significantly underpaid compared to pretty much all other devs.
- zmxz 4y ago
- zeroonetwothree 4y agoI learned PHP as a kid in the 90s. It always seemed too easy to use it, almost as if it was a toy language, and I thought there's no way that professional programmers actually work this way. But here I am, having spent ~50% of my career in PHP off and on.
- soruly 4y agoI like the way adminer packages everything into a single php file. It makes it super easy to deploy and update https://www.adminer.org/ https://www.adminer.org/
- jbboehr 4y agoPhar[0] is used for some command line tools (for example composer), I wonder why it's not used more in web applications? [0]: https://www.php.net/phar https://www.php.net/phar
- whalesalad 4y agoif you are getting shit done then that is all that matters - but it is hard to find a compelling reason to start with PHP these days unless 1. you are constrained to commodity godaddy-esque cpanel hosting or 2. you have an entire team of PHP devs.
- omnimus 4y agoThere is one main reason devs get into PHP. Content management systems. People here forget how many developers create content websites not products. PHP is pretty massive leader in CMSes. And i dont mean legacy stuff like Worpress. Most modern ones are essentialy light MVC framework with admin panel. Many are even based on Laravel. So by doing CMS dev you end up with pretty good skills with php+MVC. Why not use it for webapps?
- azeirah 4y agoI find Laravel a very compelling reason to start with PHP. If you start with Laravel today, you're most likely in a position to start with php 8.1 which has nearly none of the issues plaguing the earlier ones. Rails of course is a great alternative. Depending on your requirements, experience and preference etc you might choose that over Laravel given that from what I heard they're similar in productivity and features.
- racl101 4y agoI love other devs shitting on PHP in my area. The more PHP work they forgo, the better for me. Less guys doing it, always in demand. Making good bank and am quite good at using it.
- redml 4y agothere's still thousands of low quality entry level devs that will always be there to drag down the salary range for you, don't you worry that
- 8n4vidtmkvmk 4y agosucks on the hiring end too. I'm willing to pay but don't know how to weed out the cruft. building something with a full ux mock and prd anyone can do. actually figuring out the requirements and then so building that... seems harder to find
- wenbert 4y agoIMO you cannot even compare PHP and the ecosystem what it was a couple years ago to what it is now. It has come a long way.
- jmconfuzeus 4y agoWhat I like about PHP is how you don't have to use crap like Jinja2 or Twig to build complex logic while rendering HTML. Of course, some people will cry "spaghetti code" but sometimes you just want to get work done.
- omnimus 4y agoYeah spaghetti code people then love react/jsx/vue… in vue single file components include html/js/css (structure/logic/presentation) in one file and everybody loves it. In PHP you structure it same way (even without css) and its WRONG.
- hirebackenddev 4y agothat's great! Because of its benefits, it's always been one's favourite. Hire Backend Developer(www.hirebackenddeveloper.com) for your PHP and Java based project requirements.
- pkdpic 4y agoLoved everything about this. Excellent read. Anyone have a suggestion on a good resource for making my first PHP backend? Search results have felt a little messy / all over the place in the past...
- waspight 4y agoI think that php has some weird disk usage behaviour that makes running Wordpress in a docker environment slow. I don’t know exactly what it is but I would say it is a weird behaviour of php anyway.
- omnimus 4y agoWordpress is just bad. PHP is leader in CMSes but the old ones Wordpress, Drupal have to support so much legacy stuff. Including wierd patterns hand hacks from the past. Modern CMSes like Craft, Kirby, Twill, Bolt, October… it is very different story.
- nfhshy68 4y agoWordPress is great, they maintain backwards compat forever. Same reason I like PHP and can't stand working with NPM. I'm sure the other CMS are fine but I want my site to auto update itself and all its plugins for the next 20 years with me hardly touching it.
- omnimus 4y agoAnd will your database, webserver, php and linux auto update itself next 20 years? Reality of that is that most people will use some plugins or their theme wont update or your code will have breaking change. The auto update is nightmare. Because so many people are trying to hack WP you gotta do it and every other update becomes stresfull event. Good luck updating someone elses plugin. Much higher chance of website working 20 years is - take simple preferably file based system. Make manual update every 5 years. If its good system then the migration will be well documented and painless probably taking 5 minutes.
- sdze 4y agoWordpress is elegant with its hook system. It is easily customisable. Virtually in each and every step you can modify the wordpress software via plugins.
- nfhshy68 4y ago
- deleted 4y ago[deleted]
- pjmlp 4y agoI don't love PHP, but it gets the job done on my ISP, I upgrade it when I need, occasionally get to learn a couple of new features. JavaScript, if we are talking about VanilaJS and script tags, great, everything else I can happily ignore.
- luismedel 4y agoTBH I don't like PHP but I admire how easyly deployable and ubiquous that it is. It's so omnipresent that that Spolsky used a sort of translator from ASP to PHP to be able to run Fogbugz un Unix systems[0], which I think is a neat idea (at least for a source lang subset and with tons of problems to be solved, but a neat idea nonetheless). [0] https://www.joelonsoftware.com/2005/03/30/the-road-to-fogbugz-40-part-iii/ https://www.joelonsoftware.com/2005/03/30/the-road-to-fogbug...
- SuperSandro2000 4y agoI love to hate PHP. From a design perspective it is pure garbage. It allows you to do so many basic and stupid mistakes which better language design could have prevented.
- oznog 4y agoGarbage can be written in any language.
- 5350-uiop-1130 4y ago> They are used by people who get shit done. pretty much says it all. let me finish building this shitty app by deadline, while you guys continue argue about which static type checking system is better.
- zelphirkalt 4y agoAnd then run off for the next job after a year or two and leave the rest of the dev team with your badly written code, so that they have to clean up the mess behind you?
- rr888 4y agoI think that is more of a symptom of leading edge technologies. Old school platforms the churn rate for employees is much lower.
- 5350-uiop-1130 4y agoalways give the dev the benefit of the doubt and assume they were working under difficult circumstance with jackass stakeholders/pm's.
- orange8 4y agoRun of to the next job? Honestly, that sounds much more like a dev who is always chasing the new shiny, rather than a dev competent in a boring, stable old tech like php
- timvdalen 4y agoI unapologetically find PHP8 to be a great language to actually do work in, especially when coupled with modern tools like the Laravel ecosystem.
- heurisko 4y agoPHP's strength is its architecture: stateless, interpreted, and its rich ecosystem. The language isn't as good as Java, but is familiar, and has made lots of improvements, including around types.
- BurningPenguin 4y agoI like PHP for its simple deployment. Symfony has some interesting concepts with the adoption of Stimulus via their UX packages. But their ORM and Queue handlers are a bit annoying. Or maybe i'm just too dumb for that, because i'm just a hobbyist.
- GrumpyNl 4y agoDont forget the simplicity to setup a local platform, no kubernets, no docker, just run xampp and youre ready to go.
- ehnto 4y agoSo do thousands of people, because they're pragmatic and useful. They're the Honda Civic of the working software world. For people doing real work, you have a whole host of great languages available, and there's no sense in pretending that one of them isn't PHP just because you think you're still doing comp sci at uni. There's definitely better languages than PHP, no doubt. But we're in the trenches now, getting stuff done, and people have been getting great things done in PHP for years.
- gaptoothclan 4y agoI have used PHP extensively and moved to node then finally settled on using golang. I think PHP does have a place as a current programming language but much more small scale operations. It is just more complicated, to run a PHP site you need to have knowledge of PHP, PHP config, server config, the tooling is poor, there is always something else you need to bolt on to get a similar experience to a modern development language, there are so many ways you can write bad code or write code in a different style to others around you sharing this in a team is hard. At my company we still run PHP apps and everything we want to do as an organisation is relatively simple in Go, but hard with PHP. I imagine the issues and problems we have with it are why it is not well used in large organisations
- Gentil 4y agoI feel like Emberjs is the PHP of JavaScript frameworks. People looove to BS about it with no apparent reason. I mean, everyone knows tech is moving fast. Especially the JS ecosystem. So now why are you talking sh*t based on your experience like 3 or 5 years ago? At least just go around and read more before you comment.