Live data from Hacker News

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

kukuruku.co

91–100 of 144 posts

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

#91
When I first read that I saw the nice girl with the red T-Shirt and thought, wow, the simplest way of writing Hello World in PHP is literally

    Hello World
(no Of course this would be broken HTML but first it displays, and second you could configure the web server to send

    Content-Type: text/plain
without charset parameter because YAGNI.

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

#93
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.

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?

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

#94
post #78

Earlier quoted context omitted.

What is good for developers is bad for the industry. How else would they justify creating frameworks in different languages if all people are doing anyway is writing text to (F)CGI stdout? It is much better for the companies/groups involved to make people believe that there is something wrong with this and that they should really be using a "proper" framework.

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.

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

#95
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?

I know at least three reasons why makefiles are not working well for common use cases. Many people seem unaware of these cases, even though they seem to come up quite often.

• make(1) has a hard time rebuilding target files when source files have changed. The problem is that users have to declare the dependencies of a target before the build, but due to file search paths, it can be that dependencies are only known after building a target. To know about all dependencies, make(1) would have to build any target at least twice.

• make(1) by default does not rebuild a target when its build rules change. While this seems really weird to me, it seems to be a consequence of having a single makefile. When a build rule is changed, the makefile changes. So should all targets depend on the makefile implicitly? One could argue that they should – but then each change in a makefile would rebuild all targets.

• make(1) can not handle non-existence dependencies. Imagine a file foo.h being searched for by a compiler in directories bar and baz (in that order). If the header file baz/foo.h is found, then bar/foo.h should be considered a non-existence dependency: If at any future point in time it exists, the target should be rebuilt.

These problems are all solved by DJB's redo approach, which I implemented in a few hundred lines of Bourne shell (/bin/sh): http://news.dieweltistgarnichtso.net/bin/redo-sh.html

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

#96
post #93

Earlier quoted context omitted.

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?

I know at least three reasons why makefiles are not working well for common use cases. Many people seem unaware of these cases, even though they seem to come up quite often. • make(1) has a hard time rebuilding target files when source files have changed. The problem is that users have to declare the dependencies of a target before the build, but due to file search paths, it can be that dependencies are only known af…

Those don't seem limitations of make itself, but rather the compiler and linker you use with it...

The compiler may know paths, the linker may know paths, the shell might, make might, or you can supply them.

I've seen and used nested Makefiles before.

These things aren't really make things. If I use tcc, Haskell or Go in my Makefile, then they mightn't apply.

If you can write it in Bash, you can integrate it into your Makefile.

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

#97
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."

Might explain why I don't get many recruiters attempting to contact me. Back when AngularJS was the big thing, I'd get bombarded on LinkedIn. Now, having only non-commercial experience with React and refusing to list it on my resume, I'm mostly ignored. Now are recruiters to blame or the companies that hire them?

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

#98

While reading i was thinking "..but that all makes sense for any project that's larger than a few hundred lines.." and thought the author was just ignorant and needlessly cynical. But at the end of the article, he makes a good point: Disputes like “Why do I need PHP if there’s Java?” have become more frequent nowadays. I don’t know who’s in the right, Holly Wars are tricky. But each dispute has an argument in favor o…

I like to argue that you can start off using PHP as a scripting language with a single index.php file, then maybe learn to use some of the simple frameworks like Slim (though even that has become more complicated recently), then move from that to Symfony or the like. This is a point the original author misses. If you introduce beginners in PHP to Symfony and SPAs from the start obviously they're going to have a bad time.

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

#99
post #64

Earlier quoted context omitted.

Then again take a step back and look at what's being achieved. You are delivering, nearly instantly, a sophisticated and responsive fat client application to the user without any installation process. This fat client is running in a nearly universal and quite safe sandbox that is provided by several vendors across different os's, form factors, and architectures. With a good amount of backwards compatibility. Backed b…

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 a requirement.

Worse yet, I'm often disappointed by the number of web developers I've worked along side recently that haven't understood how data is serialised in HTTP response and request headers (so they inappropriately use GET and POST methods), don't know even the basic few HTTP status codes, don't understand browser caching, etc and I end up having to handhold them through the basics while they're advocating complex frontend frameworks because "it does the logic for you" (or similar arguments).

This isn't a dig at all web developers by any means. I'm talking about a minority here. But it's a trend I've observed growing and I do think there is a correlation between the rise in popularity of bloated abstractions and the number of inexperienced developers using them as a crutch for their lack of understanding about the core principles of the web. The problem is the moment something misbehaves they're completely incapable of effectively problem solving it. And in the era of everything being a web browser, we have more low end devices than ever that we need to support - which often gets neglected when you have developers constantly opting for their shiny new toys resulting in cumulative page sizes of megabytes just to display "Hello World!".

So going back to my original point; yes I do think it can be simple to set up the kind of cross platform support you describe. I think it's often us who choose to make it complicated for ourselves. Often far more complicated than it ever needs to be.

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

#100

Ahahaha I legitimately cannot tell if this is a sarcastic blog post. To me it just sounds like such a joke. It's quite confusing. I hope it's a joke...

I think this is a realistic reflection on the state of this area in our industry. It is both sarcastic/a joke and not a joke at all.

I think this is a realistic reflection of one side of the industry. There are still some that I know who don't use 70% of what's mentioned but still run a profitable business in website development. Sometimes I think they're the more productive ones that don't comment on HN posts :)
Post reply on HN