11 ms·
Php was my first language I learned 15 years ago. On that way I really started to hate it because of all it's quirks. Many of those have been fixed and nowadays
by laszlokorte 6y ago
Php was my first language I learned 15 years ago. On that way I really started to hate it because of all it's quirks. Many of those have been fixed and nowadays I really enjoy it again and it's my goto language for any web project.
It really hits a pragmatic sweetspot. It's really easy to deploy and frameworks like symfony give you all the power like rails but without the magic.
- bavell 6y agoSame here, started off with PHP around a decade ago and couldn't wait to move to another server-side language. Nowadays it's much nicer to work with (as long as you avoid the warts) and PHP 8 looks to deliver another slew of welcome upgrades. Only downside is that there does seem to be quite a lot of (non-trivial) deprecations which is understandable but I wonder how long it'll take for 8 to percolate into production...
- nolok 6y agoEvery single deprecation is a wart being removed, none of them are a python 2->3 kind of issue (it worked just fine but now I need to work to move it to the new stuff !), and it's all easily fixable in your code with minimal effort (but decent amount of time ... if you've not bothered to clean up warnings for the past decades). The cases that are not replacable easily are things that should never have been written ever.
- erikpukinskis 6y agoWhat do you mean without the magic?
- laszlokorte 6y agoRuby is extreme flexible in terms of metaprogramming in rails uses that very much. And ruby is not statically typed. So if in rails you declare an active record model with belongs_to etc it's hard to keep track of what is really happening under the hood. In php you have almost no runtime metaprogramming so the things that could happen if you read a piece of code are reduced to a smaller set of options that are easier to understand. well you have reflections but at least they are used in a more static way.
- tyingq 6y agoRuby also raises an exception for a string coercion to an int when the string isn't an obvious int.
- laszlokorte 6y agoThat's a local effect that can be avoided once you know the sematincs of the language. The issue with abused metaprogramming and monkey patching is that it results in global effects that are hard to track. I would prefer to review a messy 50kloc php project over a messy 50kloc ruby project.
- tyingq 6y agoI was citing it as a good thing versus PHP's (and Perl's) "foo" == 0;// true behavior. I believe that still to be the right thing despite other issues Ruby has.
- laszlokorte 6y agoThen I agree of course!
- acomjean 6y agoI think they mean stuff in Laravel framework and Ruby on Rails. Like database access where you can just use it as an object without worrying about queries and such. This is great, gets projects up fast.... until you need to do something different. It generally comes at the expense of flexibility.
- nicoburns 6y agoMost ORMs allow you drop down into RAW for all or part of the query, so you haven't really lost any flexibility.
- farresito 6y agoI must be very picky, because to this day I still don't like it at all. It sucks less than it used to maybe, but if I compare it to other languages, I still would rather use anything else.
- tyingq 6y agoCurious if that's a general aversion to dynamic typing, or specifically PHP.
- arp242 6y agoThe problems with PHP aren't really with the concept of dynamic typing as such, but rather with the somewhat curious semantics and really awkward standard library. These are relics from the past that are, unfortunately, very hard to fix without a "Python 3000 moment", and all the problems that brings. Although PHP 8 does fix a bit of it (various comparisons and operators are a bit better now) there's still a lot of it remaining, especially in the standard library IMHO.
- tyingq 6y agoThat's what I was trying to make sure I understood. There are people that just don't like dynamically typed languages.
- arp242 6y agoPHP offers some type checking (and has for a long time, albeit very limited) which is getting expanded all the time, including in this release.
- ehnto 6y agoThey're a bit overblown now I feel, and I wouldn't throw out the language and ecosystem just because a comparator got fussy. You probably won't win any "Code is Art" contests, and if you want to do computer science work then why even waste the time hating PHP, it was never for that. PHP is a web application workhorse, and it's really exceedingly good at that task.
- k__ 6y agoSame here, I started at the same time also with PHP. But I never found back to PHP after switching to JavaScript in 2011. If something new comes out it usually runs JS.
- laszlokorte 6y agoOne nice thing about php compared to Js is that you are not allowed to write async code. (except you use some extensions) So everything is simpler by design.
- k__ 6y agoTrue. On the other hand, most systems I worked with were async, so they fit really well into the JS model of programming.
- alvis 6y agoSame as many web languages, PHP's heyday has a reason as many toolkits at that time were far less powerful and complicated for even simple things. Perl+CGI + all the server setup for a simple dynamic page? It's just unimaginable to many today's developer. I started off with PHP3 and have a very great and hated time with it till v5. PHP for sure is difficult to maintain and very painful to debug, but it's not my reason leaving it. It's because JS began to pick up and started to do many tasks that requires no server rendering. The server sides started to become just API server, which no longer generate html on the fly. It's much scalable and easy to maintain. Time flies, now I see the release of PHP 8 and I realise I have ditched it for a decade. Do I miss you? No.
- ForHackernews 6y ago> Perl+CGI + all the server setup for a simple dynamic page? It's just unimaginable to many today's developer. TBH, I'm still not aware of any truly simple/easy way to get a dynamic HTML page. Recently, I had to make a dumb utility app to render some dynamic data, and I wound up writing a Golang server with the HTML specified as a Go Template. But making it accessible on the publc internet still required spinning up a server, installing nginx, configuring SSL with Let's Encrypt (at least it was free) and futzing around with nginx `proxypass` directives for several hours. It works, and I guess it's conceptually simple, but it was still an all-day ordeal to get it up and running from scratch.
- benbristow 6y agoAzure Static Web Apps and then a bit of AJAX to pull in the data from a function (all deployed automatically in one go) https://azure.microsoft.com/en-us/services/app-service/static/#features https://azure.microsoft.com/en-us/services/app-service/stati... Not a dynamic HTML page per-se but a page with dynamic data. I deployed one of my old hackathon apps with it, works well - https://memorylane.benbristow.co.uk/ https://memorylane.benbristow.co.uk/
- lmns 6y agoHave you tried Caddy as your reverse proxy? It's much simpler compared to nginx and it has very robust, integrated LE support. It's also packaged for Debian and CentOS now. Write a systemd unit file for your golang service, put Caddy in front of it and you are good to go. It's not a PaaS, but it's simple and shouldn't be too difficult to maintain.