[I wonder if this is a personal watershed for Hacker News?] These languages are essentially the same thing. I often write code in at least 3 of these languages most days, and I simply translate the minor differences between them in my head. "Hyperpolyglot" -- excess in many tongues -- I don't think so. Learn at least some static languages, assembler and some functional languages, and then post something interesting o…
Comparing PHP, Perl, Python and Ruby
31–40 of 92 posts
Re: Comparing PHP, Perl, Python and Ruby
#32Earlier quoted context omitted.
not true at all. Maybe if you're looking at old sites, but PHP5's been out for a long time now, and most of the code in circulation is made for 5.2 or higher. No serious MVC framework, for instance, will run on anything less than 5.2.
Serious MVC frameworks are not the backbone of Wordpress, phpBB or dozens of other hairy monsters that make up the majority of CPU time spent on PHP execution. I mean Wordpress flat out resisted PHP 5.0 for years. Years . Everything had to be done in PHP4.
I presume that's because of the size of Wordpress' install base. The number of people who run their software on $9/month shared hosting environments is staggering. Many of those are late to upgrade PHP versions.
Wordpress gets a lot of crap for being poorly written but the truth is that it's an example of software that works really well given some really unique circumstances. If the WP devs decided that their software didn't need to support the 99% of web servers out there then it wouldn't be nearly as ubiquitous as it is today.
Re: Comparing PHP, Perl, Python and Ruby
#33This is a wonderful recap of the different ways of expressing the same idea in different languages. It is a fine Rosetta Stone. That being said, it would also be useful to characterize features that are completely unique to a given language. For example, Python has 1) a unique and powerful version of super() for working with multiple inheritance; 2) it has generators (the yield statement) that allows state to be susp…
Re: Comparing PHP, Perl, Python and Ruby
#34Earlier quoted context omitted.
Serious MVC frameworks are not the backbone of Wordpress, phpBB or dozens of other hairy monsters that make up the majority of CPU time spent on PHP execution. I mean Wordpress flat out resisted PHP 5.0 for years. Years . Everything had to be done in PHP4.
> I mean Wordpress flat out resisted PHP 5.0 for years. Years. Everything had to be done in PHP4. I presume that's because of the size of Wordpress' install base. The number of people who run their software on $9/month shared hosting environments is staggering. Many of those are late to upgrade PHP versions. Wordpress gets a lot of crap for being poorly written but the truth is that it's an example of software that w…
Yes, they deal with lots of different configurations. This is not unique in the history of software development. It's called "portability" and many organisations seem to be able to achieve it without compromising quality.
My searing, eye-boiling hatred for Wordpress comes from administering it for what is now nearly a decade. Every time I dive into the code I am frequently repulsed by it.
The total absence of tests is my favourite "feature". I've seen multiple bugs closed with WORKSFORME that I was directly grappling with.
Re: Comparing PHP, Perl, Python and Ruby
#35Note that anywhere you see array() in that list for PHP 5.4 you can replace it with [ ]'s. So the example that has: $a = array(1,2,array(3,4)); becomes: $a = [1,2,[3,4]]; Also 0b101010 works in 5.4.
True, but PHP 5.4 doesn't even have a stable release yet & many people haven't even adopted 5.3.
Re: Comparing PHP, Perl, Python and Ruby
#36Re: Comparing PHP, Perl, Python and Ruby
#37sed begat awk. awk begat perl. perl begat python and ruby. python will get you a job at google. ruby will get you a job at twitter. php will get you a job at facebook.
Re: Comparing PHP, Perl, Python and Ruby
#38He never even uses Perl's foreach in equivalency examples!! WTF.
Re: Comparing PHP, Perl, Python and Ruby
#39Earlier quoted context omitted.
That being said, it would also be useful to characterize features that are completely unique to a given language. Perl has all these features. 1) a unique and powerful version of super() for working with multiple inheritance Perl (with Moose) has before, after, around, override, and augment in addition to super. And, it has "Roles" so you don't have to resort to hacks like multiple inheritance to implement mixins or…
It also means you have to stumble upon Moose to start using objects in a reasonably sane way. The average new Perl programmer is not going to go looking for a library that does object-oriented behavior until it's too late. They'll probably have some crazy idea that the language should be doing OO for them. If you were to navigate a largish Perl codebase today, you'd encounter the old-school bless, Moose trickiness, a…
But ignoring that; someone who is new to programming is not going to understand the value of any of these concepts anyway, so it doesn't matter that they don't discover them immediately. At about the same time people figure out how to do OO cleanly, they will start hearing about libraries too.
If you were to navigate a largish Perl codebase today, you'd encounter the old-school bless, Moose trickiness, and all kinds of variants on these themes. Extremely clever stuff that Damian Conway would give you a gold star for.
I've worked on a number of post-Moose codebases, and most people did the conversion cleanly and all at once. (I can't explain it, I'm just reporting the facts. I was surprised too.) The biggest Moose-hacking pain point I've seen was someone trying to subclass DateTime with Moose. It just doesn't work very well; DateTime is werid and Moose is weird. (Of course, the solution is delegation rather than subclassing. Even in languages with real OO, you often want a "does X interface by delegating to Y class" rather than "isa Y".)
Re: Comparing PHP, Perl, Python and Ruby
#40Note that anywhere you see array() in that list for PHP 5.4 you can replace it with [ ]'s. So the example that has: $a = array(1,2,array(3,4)); becomes: $a = [1,2,[3,4]]; Also 0b101010 works in 5.4.
True, but PHP 5.4 doesn't even have a stable release yet & many people haven't even adopted 5.3.