Live data from Hacker News

Moving from Go to PHP Again

dannyvankooten.com

171–180 of 371 posts

Re: Moving from Go to PHP Again

#171

Any idea why PHP has such a bad reputation compared to other interpreted and dynamically-typed languages such as Python?

This may sound trivial but I dislike the aesthetics and ergonomics of typing PHP. In most dynamic languages user.name is 9 keystrokes, but in PHP $user->name is 13 keystrokes.

Re: Moving from Go to PHP Again

#172

He's comparing a language (w/ extensive standard library) with a web application framework.

It's hard not to.

Comparing Go ans PHP a few years ago would mean to compare Go and PHP/Apache or PHP/Nginx, because PHP could not run its own server.

It's like comparing Git and Subversion, where you have to explain concepts like staging.

Or IntelliJ and Eclipse, where you have to explain workspaces.

Re: Moving from Go to PHP Again

#173

Earlier quoted context omitted.

>Amazon lambda may have more in common with PHP in terms of discreet deployable units of functionality. What's old is new again. This doesn’t seem to be a language choice problem, it seems to be a monolith problem, where PHP simply managed to avoid some of the traditional monolith issues by design. Your CD pipelines in any micro service architecture should solve these problems, whether it’s using FaaS or containers,…

>> PHP simply managed to avoid some of the traditional monolith issues by design No - it didn't. PHP up to this day is a spaghetti mess it had always been.

I really don't see what makes php a spaghetti mess. Spaghetti code is a skill issue, not a language issue

Re: Moving from Go to PHP Again

#174

Why do so many companies keep moving to go? I tried to like it, but it was just so painful to write.

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…

I talked with a few people who wrote Go servers and while they loved almost everything about the language and ecosystem, they hates the missing generics so much, they still switched to other languages later.

Writing code-generators for everything wasn't fun.

Re: Moving from Go to PHP Again

#175
post #73
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…

> Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. Except in reality once you want to use non /whatever/file.php as urls - you're back to implementing a router > PHP files can be deployed independently, swapped out or updated live. Intuitive, simple, powerful. Can be as easy as editing a php file in notepad and dropping it on a ftp server. Deployed. Except in reality, you…

Regarding (4) Lambda and friends are not actually stateless between requests; the process is initialized once and then potentially reused many times for hours, so you can cache between requests, both in memory or in the filesystem (AWS Lambda provides 512MB in /tmp).

Re: Moving from Go to PHP Again

#176
post #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 ta…

> but that just isn't practical in modern web development

People always use this modern term as if it implies something significantly different or more "advanced". The web hasn't changed much. It's still data over tcp sockets to a contained runtime -- a web browser.

> People like ORMs

People in my experience are starting to dislike ORMs. If you have done this for long enough, you realize they are great for getting off the ground, but they inevitably get in your way, and start generating some really bad queries which you have to start one by one replacing with raw SQL statements, at which point you might have well started with raw SQL.

Having come from Rails, and PHP frameworks like Symphony and Laravel at my company, using Go I feel almost like I am more intimate with my code. I understand it better, the dependency chain only ever goes one or at most two levels deep. I will admit the the templating and routing is more "batteries included" in these frameworks, but the other parts that I have control of that I consider much more important (such as how my data actually gets stored and other network calls I have to make), I would much rather do those in Go than in PHP

Re: Moving from Go to PHP Again

#177
post #156

Earlier quoted context omitted.

Hmm, I'm sorry... I'm having trouble understanding your point, and specifically how it relates to my comment.

I parsed it wrong. I thought you essentially said "the things I build are definitely worse then relying on a collection of random internet dudes code through npm." But yes, GNU make, emacs, yacc, lex, bison, ar, nm, there's lots of great tools. It's 4am, I should sleep.

Oh, haha no worries - sleep well :)

Re: Moving from Go to PHP Again

#178

Earlier quoted context omitted.

You can absolutely do this in Java if you want to. I mean, it's insane and you shouldn't, but it's eminently possible.

I'm not saying it's not possible I'm saying it really isn't convenient .

But the reason why it isn't convenient is because the consensus amongst Java programmers is that it's a bad idea. It wouldn't be difficult to build tooling around if one wished to - I think in this case, the fact that almost every language has migrated away from CGI-style routing is probably telling.

Re: Moving from Go to PHP Again

#180
post #64

Earlier quoted context omitted.

> Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. Which becomes a security issue due to accidental endpoints or uploads becoming endpoints. Or becomes a mess of imports. Either way, PHP frameworks often end up with a central router anyway. > PHP files can be deployed independently, swapped out or updated live. Which means some people try to do that the naive way and end…

You can create a mess of code, open security holes, and/or be hit with ‘gotchas’ in any web framework. PHP is much less complex than most.

no, seriously, the old dynamic script as program requiring a web server needed to be configured properly to avoid leaks of a thousand faces .. thanks but no thanks

I'll be flask-ing

Post reply on HN