4 ms·
Your observation on abstraction is interesting. I've always considered PHP to be quite the opposite. e.g. Going from PHP to NodeJS, NodeJS is a lot more direct
by lucideer 11y ago
Your observation on abstraction is interesting. I've always considered PHP to be quite the opposite.
e.g. Going from PHP to NodeJS, NodeJS is a lot more direct and less abstracted (handling the request directly, reading the request data incrementally and handling reader state, setting headers and then explicitly writing to the buffer, handling connection state, etc.) - note I do mean NodeJS here, not something like Express
another e.g. PSR-7 I find is, counterintuitively, actually much less abstracted than raw PHP built-ins as it goes out if it's way to map the interfaces to the stack as intended, rather than completely arbitrary weird abstractions. Like the retrieval of query parameters being entirely separate and unrelated to retrieval of the body payload, whereas PHP tends to sort of conflate these things in $_GET/$_POST/$_REQUEST and then doesn't really have obvious intuitive handling of non-x-form-url-encoded payloads. And don't get me started on query string array handling.
I do completely agree with the article though, and I still use PHP a lot. Voluntarily.
But I just found your specific observation surprising.
- captn3m0 11y agoAgreed, nodejs lets you build servers from the ground up using streams. However, I am yet to see anyone build their first node project without something like Express and just use http.createServer. The PHP abstractions are not always clear as you rightly point out (REQUEST = GET+POST+COOKIE...), but they are vastly different "magic" that you see in the Ruby land, for eg where you would rarely be ever thinking about cookies at all.