3 ms·
I knew I was going to get some code golf responses. Simple and short are two different things. I value PHP over Ruby here because it's much clearer to the laym
by lukeschlather 14y ago
I knew I was going to get some code golf responses.
Simple and short are two different things. I value PHP over Ruby here because it's much clearer to the layman what's going on. To explain the PHP, all I have to explain is functions, variables, and the echo statement.
To explain the Ruby, I have to explain functions, variables, Objects (everything is an object), Libraries, I/O, and method invocations.
Also, in classic code golf form, your code eliminates a couple things that will make it do exactly the same thing as the PHP - you're missing your #! line, and you're not actually writing a CGI script, which is a second library you need to include and explain to your hapless newbie. And honestly, it's not just a newbie thing. I've written Ruby similar to that (with good error handling, etc.) Ruby only makes sense if you're going to do the job properly and put in error handling, etc.
- gbhn 14y agoAnd to Jeff Atwood's original point, you cannot copy-paste the file onto basically any http webhost on earth and have it run out of the box. I don't think that's appreciated in the threads thus far, is that web hosting companies have really done a lot of work for you for PHP and Perl that you have to do yourself with other web programming platforms. They might be better, but they aren't as universally available and supported. (For some value of "supported" which is usually "enough")