Live data from Hacker News

Moving from Go to PHP Again

dannyvankooten.com

211–220 of 371 posts

Re: Moving from Go to PHP Again

#211
post #32
post #9

> Honestly, Go is great. Its simplicity is refreshing and its performance unmatched. I would still pick it if we need a small API or something that requires high throughput. I wonder which part is performance unmatched? My opinion would be Crystal language for its simplicity and higher throughput but unmatched performance is behind Rust and C.

Not sure about the OP, but for many Go is the only compiled language they ever used, so they get to attribute features to Go that aren't that unique of it.

> for many Go is the only compiled language they ever used

That, or it can be read as "in the family of web-friendly languages". The only other "fast" language widely used for the web is Java.

Re: Moving from Go to PHP Again

#212

It's interesting that he names Symfony 4 as one of the main reasons he uses PHP again after he already used PHP with Laravel. I have a lot of discussions with friends in the startup scene about the topic of Laravel vs Symfony. So far it's a head to head race. I have yet to find a good 'Laravel vs Symfony' comparison page. Yes, there are tons of 'SEO optimized articles' with this title. But I find them all rather unin…

Those SEO pages are horrible. I had the same problem.

But there are multiple reasons I choose Symfony 4 over Laravel.

And if you want a code comparison then this small example:

Laravel:

  class User
  {
  }
Symfony:

  class User
  {
    private $id;
    private $name;

    public function getId():?int
    {
       return $this->id;
    }

    public function setName(string $name): self
    {
      $this->name = $name;

      return $this;
    }

    public function getName():?string
    {
       return $this->name;
    }   
  }
Laravel looks a lot easier and quicker. And it is. But good luck next month when you can't remember what properties User has. Your IDE can't autocomplete it. And also good luck working with a team. Your team members have to look up the database model for the User to see what properties are available.

And this is happening in Laravel all the time. Very quick, very easy, a lot of magic but it will bite you in the end.

Re: Moving from Go to PHP Again

#213

Earlier quoted context omitted.

Flask is a good alternative to Django for building web apps with python on the backend. If I'm using react or vue with a JSON API, I don't need the form support in symfony or django.

However, deploying a Flask/Django/Rails app still is usually less fun than deploying a PHP app of the same spec written w/ Symfony or Laravel. Configuring a service to monitor gunicorn, which itself took a bit to configure, before I begin configuring NGINX or Apache... it's really a pain in the butt. LAMP/LEMP stacks just... are

So ease-of-install beats code quality, code readability, security, future maintenance and better tooling. Dang.

LEPP (nginx, PostgreSQL, Python) stack seems to me an all-around better stack for most of the deployments people use LAMP for.

Re: Moving from Go to PHP Again

#214
post #151
post #71

Earlier quoted context omitted.

Use for numbers and strcmp for strings. A strict type > would be very weird because besides returning TRUE and FALSE it'd need to throw a TypeError, I guess?

>A strict type > would be very weird because besides returning TRUE and FALSE it'd need to throw a TypeError, I guess? Yes, which would make it behave exactly like probably every language with strong runtime typechecks. Very weird indeed. It's obviously much more preferable that the code sometimes does the wrong thing without warning. And of course with static typing, it would be extremely weird since the code wouldn…

I don't think the snark in this response is super helpful; a simple "Yes, throw a TypeError when the types are incorrect" would have sufficed.

Re: Moving from Go to PHP Again

#216
post #210
post #65

Earlier quoted context omitted.

As a developer use ProcessWire instead of all the others. Imho the best CMS for PHP.

Thats the problem when you view with the eyes of a developer and not with the eyes of a user.

I don't understand. My customers are super happy with ProcessWire.

Have you ever tried it?

Re: Moving from Go to PHP Again

#217
post #94

Earlier quoted context omitted.

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 co…

Incompetent people will create incompetent things regardless of the tool. Simpler tools lead to simpler messes while complicated tools lead to complicated messes. I've seen an attitude that people think they can inoculate themselves from inept programming by using obtuse frameworks as if martin-fowler-speak acts as a drill sergeant making disciplined coders out of the herd. But after 20 years of bouncing around start…

Well let's not pretend software is an engineering discipline.

It's art, fashion and politics.

Re: Moving from Go to PHP Again

#218
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…

You conveniently leave out all the security mess of that design, especially WordPress. The plugin system is pretty much the cause of all the security issues in WordPress.

Perhaps end-users should not have the capacity to so easily add third party PHP code, even if it’s “simple.”

Re: Moving from Go to PHP Again

#220
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…

> Can extend itself as it runs. For example Wordpress, running off of php files can download plugins to its own server (which are just more php files) to instantly extend itself. Without restarting or redeployment. (What other web platforms can do this?)

Java: Use a classloader to load a JAR and instantiate one of its classes: https://stackoverflow.com/questions/60764/how-should-i-load-...

.Net - use an AppDomain (or other methods): https://stackoverflow.com/questions/1137781/correct-way-to-l...

Post reply on HN