3 ms·
I don't use frameworks. I've had to extract customers from their over-commitment to frameworks when they inevitably hit a limitation, had to change the framewor
by gregjor 2y ago
I don't use frameworks. I've had to extract customers from their over-commitment to frameworks when they inevitably hit a limitation, had to change the framework core, then got stuck at that version forever.
Ironically PHP works fine as a web framework -- I have never understood the point of adding another layer over it. I guess programmers who don't understand SQL injection or XSS -- basic web dev security stuff -- create some demand for the training wheels. With Rails I understood the need, because Ruby doesn't come out of the box with the web app orientation of PHP, but then why choose Ruby in the first place?
Now I see frameworks promoted for Go, which by design includes everything needed for a full web app. Habits die hard, and some of those habits I can only attribute to either lack of skills or laziness. We now have a world where a significant percentage of so-called web developers can't write HTML, CSS, or Javascript.
- lloeki 2y ago> Ruby doesn't come out of the box with the web app orientation of PHP, but then why choose Ruby in the first place? It was and is absolutely possible OOTB to do PHP-style webdev with Ruby quite trivially with the Ruby-included CGI and ERB (a.k.a eRuby; which has an `erb` command). The set up is hardly any different from any other CGI setup be it with Perl or PHP. Here's a `foo.rhtml`†: % cgi = CGI.new <%= cgi.http_header("status" => "OK", "type" => "text/html") %> <html><body> <ul> <% [1, 2, 3].each do |a| %> <li> Hello <%= a %> </li> <% end %> </ul> <%= cgi.params.inspect %> <%= cgi.path_info %> <%= cgi.script_name %> <%= cgi.request_method %> </body><html> You'd configure the HTTP server with calling `erb -r cgi <script>` for `*.rhtml` and... that's it. So we mimic a CGI server call: env REQUEST_METHOD=GET PATH_INFO=/foo SCRIPT_NAME=foo.rb QUERY_STRING='foo=1&bar=2' HTTP_HOST=foo.com erb -r cgi foo.rhtml There was even an Apache `mod_ruby` for a time. It just didn't make sense very quickly as soon as Rack came to be a thing††, and then you're one step away from Sinatra†††. Even then you can easily still use pure Rack (or even Sinatra) and ERB in extremely PHP-esque ways. † `.rhtml` is the conventional extension for ERB files that generate HTML, while `.erb` is the generic one. †† Bonus is that you don't even have to setup a whole Apache/NGiNX server on your machine; you just spin up the Ruby-included WEBrick so it's even more beginner friendly. ††† Which contrary to Rails is hardly prescribing about anything.