Live data from Hacker News

Moving from Go to PHP Again

dannyvankooten.com

91–100 of 371 posts

Re: Moving from Go to PHP Again

#91

Earlier quoted context omitted.

These are things very specific to PHP. Yes, there are language-specific gotchas in many environments. But I'm criticising specific things that do exist and that I've seen causing issues in real deployments. Things that make PHP accessible make it also an excellent footgun.

So.. what you're trying to highlight is that a language is supposed to make up for the incompetence of the person using it?

Yes.

Humans are fallible. That is an immutable truth.

There’s no great wisdom in relying on human discipline alone to produce reliable software.

Re: Moving from Go to PHP Again

#92
post #68

I agree with the author. Symfony 4 is the best PHP framework at the moment. Trying both Laravel and Symfony I think there is no need for Laravel (anymore). Laravel just has too much magic that will bite you later on. The only thing you should skip in both frameworks are 'annotations'. But this is easy to do.

About annotations, a new proposal has been submitted a few days ago. It's not the first time so I don't want to be too optimistic, but it looks great.

https://wiki.php.net/rfc/annotations_v2

Re: Moving from Go to PHP Again

#93
post #46

Earlier quoted context omitted.

PHP: a fractal of bad design: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ This rant is almost seven years old now, but I imagine that some things still hold true. Python in particular is indisputably more versatile than PHP.

Oof. I haven't read that classic in awhile. Yeah, most of the things in there can't really be fixed without pulling a Python 3 and intentionally breaking backwards compatibility. And the scary thing is people just brush some of these horrifying things off as non-issues. PHP was one of my first languages, and it took a long time to break some bad habits it taught. I still can't get over the existence of PHP's "arrays.…

In the context of what you're doing with PHP, that one-fits-all data structure is all you need. I sincerely doubt you had hurdles in your career because of PHP's array :)

However, let's prove once more that languages evolve: http://php.net/manual/en/book.ds.php

The "classic" you're referring to is far from something objective. There will always be problems with languages. That's why we have the human factor who is supposed to be intelligent and work around the apparent issues and make the computer do useful work despite apparent tool glitches.

Sadly, we're just creating better idiots who are only getting better at whining.

Re: Moving from Go to PHP Again

#94

Earlier quoted context omitted.

These are things very specific to PHP. Yes, there are language-specific gotchas in many environments. But I'm criticising specific things that do exist and that I've seen causing issues in real deployments. Things that make PHP accessible make it also an excellent footgun.

So.. what you're trying to highlight is that a language is supposed to make up for the incompetence of the person using it?

Of course. That's the only reason to invent languages: to take care of stuff people are not good taking care of, and move the work to the computer, allowing us to work on the level that we're good at taking care of.

Else we'd all be using assembly.

There's absolutely no pride or glory in doing things nicely and securely that the computer could have automated in the first place.

Anything the language allows that it could refuse while allowing devs to express the same features, and that results in bugs is a mistake in the language (e.g. the sorry state of strings in C).

Re: Moving from Go to PHP Again

#95

Earlier quoted context omitted.

I'm curious, what is painful about it? I came to Go from mainly C++, Java, and Python background, and I feel like it's the best of all 3 (to me). It's compiled and really fast (like C++), it has a great set of libraries and community interaction/support (like Java), and it has simple syntax that is clear and quick to understand (like Python). It's not a perfect language (nothing can ever be), but it's become my favor…

Personally I found it too easy to accidentally forget to check an error, or to shadow a named error return, or to create a nil error that doesn't compare equal to nil. Also to write a method that appears to mutate the receiver but which in fact copies it.

use an IDE

Re: Moving from Go to PHP Again

#96
post #13

Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. PHP files can be deployed independently, swapped out or updated live. No building/compiling of the php files needed. A single layer as opposed to 'modern architecture' where there's client side back/front end layers, api layer, logic, validator, data access, and ORM layers. Can extend itself as it runs. For example Wordpres…

-> What other web platforms can do this? Kinda all Java Webstuff is capable of doing this (Eg. installing Plugins in Atlassian products)

Re: Moving from Go to PHP Again

#97
post #27

Earlier quoted context omitted.

Buffalo?

The Buffalo Web Framework for Golang: https://github.com/gobuffalo/buffalo

Seems useful, but it’s yet another of those frameworks that introduce spurious CLI tools for „initializing“ the project by generating dozens of files that one either doesn’t need at all or has to replace anyway. I don’t need a tool to generate CSS boilerplate, I can just copy it from somewhere myself if I decide to use external CSS.

One of the reasons PHP was appealing initially was that all this boilerplate and extra files were unnecessary, you just wrote something in the .php file (in Apache’s hierarchy) and could load the web page. As problematic as that was, it let you focus on getting stuff done instead of overwhelming you with ad hoc conventions and dozens of files with no immediate use.

Go is a language with sane defaults and little boilerplate. It would benefit from a web framework with similar principles.

Re: Moving from Go to PHP Again

#98
I love Go, for many situations, but definitely not for a typical user facing website.

The community seems bent on the whole "all you need is net/http", but that just isn't practical in modern web development. People like ORMs, easy to handle html forms, security as a default, easy session/cookie handling etc. In the end, web developers want ease of life.

Go is a great language for many things, but if it's going to take on the web at large (outside of HTTP APIs), the community needs to grow out of this "net/http or nothing" approach.

There is some hope, some frameworks like https://gobuffalo.io/en are showing up, but the Go ecosystem is dying for a Rails/Django solution.

Re: Moving from Go to PHP Again

#100
post #54

Earlier quoted context omitted.

That chown looks super suspect. Usually you wouldn't want the webserver to have write access to the web application it is executing; that's how you get backdoored.

The chmod is pretty suspect as well.

its really not... cache is the equivalent to /tmp

check permissions there sometimes.

Post reply on HN