this post was submitted on 16 Jun 2023
10 points (100.0% liked)
Programming
13376 readers
1 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It's not just that it's interpreted. I code a lot of Python and I've never just read in another Python file as configuration and executed it. Reading a yaml or json file is like 2-3 lines of code. But I'll bet it's not that simple in PHP.
It is that easy in php:
Well in that case, it's just bad coding.
I guess there's a tendency for interpreted languages to attract more bad coders because trial & error is easier and you can get started in fewer steps. Also, fewer confusing compiler errors to deal with.
To be honest, the "configuration is an executed .php file" system does make some amount of sense in the context of PHP. When your app has to re-run everything to serve a web request, having to re-load the config (especially if it's YAML, though JSON is less bad) is expensive. Re-running the PHP code, on the other hand, can be cached way better, in theory.
Of course, this is still all PHP's fault in the end: the core problem here is that you need to re-run everything to serve a web request, without ability to pre-load state like configuration.