Live data from Hacker News

“Hello, (real) world” in PHP in 2017

kukuruku.co

111–120 of 144 posts

Re: “Hello, (real) world” in PHP in 2017

#111
post #9

Maybe I am old fashioned and outdated. I don't know about anyone else, but it makes me pretty sad that the "modern" way as presented in this article is no longer simple and straightforward and has some severe dependency hell. Not that I'm saying the structure of modern web applications isn't needed and that we haven't advanced. Just that the overhead and knowledge required to set up a modern web application is crazy.…

It's usually not advisable, but I genuinely think classical CGI is beautiful mechanism for dynamically generated pages. It's a natural extension of Unix scripting: shebang'd scripts in any language, environment variables, stdout. Job's a good'un.

Funny aside, it took me many months as a teenager who did not know the ways of *nix to "get" CGI. It was very enlightening to eventually realize that it was so simple that it had eluded my understanding. My mind, coming from messing with Win32 in Visual Basic 5, refused to believe that you just make a program that writes plaintext out to the console, and that text is what gets sent to the browser, and that just works.

If you work on web apps, you absolutely owe it to yourself to understand HTTP and CGI. The one page I'd recommend to quickly grok CGI is http://www.oreilly.com/openbook/cgi/ch01_04.html . Also learn how to use cURL and understand everything that is happening inside the Network tab of Chrome or Firefox dev tools (they're very similar these days). Set up MITMProxy between your proxy server and your apache2/nginx, put it into reverse proxy mode and point the proxy at it, then it at httpd, and understand what you're seeing.

I don't have a good link for HTTP but I promise it'll help a ton with debugging things and generally having a sense of what's going on at every level.

Re: “Hello, (real) world” in PHP in 2017

#112
post #94
post #78

Earlier quoted context omitted.

Who do you think is making money off open source frameworks?

Consultants that wrote those frameworks in first place and offer their services for help, or go to conferences giving talks about them.

Yep, in many cases the frameworks arise from patterns someone solved while working for BigCo, then decided that the pattern they used was cool enough to share with and be useful for others. Open source is hugely thankless and tons of work, but it can be very rewarding in ways you can't buy, including meeting with interesting / awesome people.

Re: “Hello, (real) world” in PHP in 2017

#113
post #93

Earlier quoted context omitted.

> Why can't we just use apt-get and Makefiles for everything? Because Makefiles are quite limiting. > Why can't npm be turned into ppa:nodejs and pip be turned into ppa:python? Because that would be OS specific.

Makefiles are limiting? They have their own macros, and support M4 as well (macros with recursion), not to mention the DSL is Turing complete. Make runs on Windows, OS X, Linux and Android. How is a Makefile quite limited?

C already does what PHP does. Why do you need PHP?

COBOL already did what C does, why do you need C?

Assembler is Turing complete.

How is assembler quite limited compared to PHP (or C or COBOL)?

Re: “Hello, (real) world” in PHP in 2017

#114

I get that this article is satire, but I think the deepest (perhaps) unintentional insight presented by the author's veiled criticism is that the justification for using these tools is presented as "it's 2017" and not as a solution to any particular problem. The issue isn't the 2017 ecosystem, the issue is the 2017 programmer's deference to vanity instead of engineering. All these individual tools exist for a reason,…

How is the article satirical? I didn't get that at all.

Re: “Hello, (real) world” in PHP in 2017

#115
post #69

Earlier quoted context omitted.

On a similar note, I always find it ridiculous when I have to do things like apt-get install npm && npm install bower && bower install ... Why can't we just use apt-get and Makefiles for everything? Why can't npm be turned into ppa:nodejs and pip be turned into ppa:python?

> Why can't we just use apt-get and Makefiles for everything? Because Makefiles are quite limiting. > Why can't npm be turned into ppa:nodejs and pip be turned into ppa:python? Because that would be OS specific.

Also, both npm and pip support version-controlled per-project dependency configuration, something that apt needs containerisation to achieve.

Re: “Hello, (real) world” in PHP in 2017

#116
post #99

Earlier quoted context omitted.

And to just pile on with this comment, "run everywhere" means much more than it ever did. This isn't just the big 3 desktop OS's, but laptops, tablets, phones, TV's, game consoles, car navigation units, hell my goddamn watch can run websites now! X86, ARM, SPARC, PPC, it doesn't matter. And on most of those platforms, you have more than one choice of browser. It's a level of cross-platform that really only simple C p…

Except it is simple: Hello World Hello World It's responsive, works on every HTML-compatible platform and is even backwards compatible to a degree that none of the other aforementioned solutions even comes close. We make it more complicated for ourselves because we choose to make it more complicated. I'm not against modern frameworks but quite often I see people justifying them rather than using them when they become…

+1 on developers not knowing how HTTP works. I'd add to that with server-side devs (the ones writing the APIs that the single-page apps talk to) not knowing how CGI works. You can literally learn both in an afternoon if you have reasonable networking and OS-level knowledge that I'd expect anyone with a CS major to have down cold. Sadly, well, you know.

In my experience, devs knowing how it really works are the small minority. Most of them seem to know "I put /foo in my Rails router, run `rails s`, hit 127.0.0.1:3000/foo in my browser, and it does the good stuff", which is consequently enough to get by in many development positions at many places.

Re: “Hello, (real) world” in PHP in 2017

#117
post #50
post #38

Earlier quoted context omitted.

Having had to find and fix a bug in a very long page like that recently I can definitively say I don't. Horrible. Granted the person who wrote it obviously didn't care but that setup was awful for anything of any size.

You can write bad code(not modular) with every language... If you use some include() in php, you can avoid long php/html pages... What I really miss is that was very fast "GET SHIT DONE" with PHP.

Is non-modular code always necessarily bad?

Re: “Hello, (real) world” in PHP in 2017

#118
post #69

I get that this article is satire, but I think the deepest (perhaps) unintentional insight presented by the author's veiled criticism is that the justification for using these tools is presented as "it's 2017" and not as a solution to any particular problem. The issue isn't the 2017 ecosystem, the issue is the 2017 programmer's deference to vanity instead of engineering. All these individual tools exist for a reason,…

On a similar note, I always find it ridiculous when I have to do things like apt-get install npm && npm install bower && bower install ... Why can't we just use apt-get and Makefiles for everything? Why can't npm be turned into ppa:nodejs and pip be turned into ppa:python?

>> apt-get install npm && npm install bower && bower install ...

Turtles all the way down!

Re: “Hello, (real) world” in PHP in 2017

#119

I get that this article is satire, but I think the deepest (perhaps) unintentional insight presented by the author's veiled criticism is that the justification for using these tools is presented as "it's 2017" and not as a solution to any particular problem. The issue isn't the 2017 ecosystem, the issue is the 2017 programmer's deference to vanity instead of engineering. All these individual tools exist for a reason,…

The article is fallacious in that writing "hello world" (and then working your way up to printing the numbers from one to 10, then asking for your name and printing "Hello, $NAME", then checking the time and printing good morning/evening etc) isn't about building a fully-featured modern web application. You could argue that the example is criminally irresponsible because it neither considers the need for HTTPS and 2FA! And finally, you need to compare apples to apples. Setting up a similarly fully featured application in any language takes significant effort, and may well be easier than in PHP, but Hello World is still easier in PHP.

Re: “Hello, (real) world” in PHP in 2017

#120
post #53

I get that this article is satire, but I think the deepest (perhaps) unintentional insight presented by the author's veiled criticism is that the justification for using these tools is presented as "it's 2017" and not as a solution to any particular problem. The issue isn't the 2017 ecosystem, the issue is the 2017 programmer's deference to vanity instead of engineering. All these individual tools exist for a reason,…

It's called "résumé-driven development."

Exactly. In big companies there are architectural review boards to stop unstable platform usage. I agree those can go too far and sometimes slow things down. However, i've see too many startups use the platform du jour w/o any consideration to stability. Worse, some will fork a good platform, make slight changes, and market their fork as the next best thing. Since experience does not matter as much to keyword-driven recruiters, is it any surprise this all happens?
Post reply on HN