Advantages and disadvantages of PHP/Ruby [closed]

I’ve been a front-end developer for about two years now, and I’m attempting to break into the server side of things. Ideally I’d like to work for a startup social network on the back-end side so I want to try and be as marketable as possible.

In my quest to learn a new scripting language I’ve dug myself into the PHP vs Ruby hole. What are the main advantages and disadvantages of the two? I would really appreciate words from experience with the two, but will settle for any experience.

Cheers.

1

I’ve been a PHP developer for about five years, and in the last year I started looking into the Ruby (on Rails) world. I’m never going to go back. Here’s why.

Inconsistency

I was displeased with PHP mostly because of its inconsistency: PHP was originally intended as a tool for amateurs, and it couldn’t cope with the exponential growth it has seen over the years. In PHP you have random function names, random parameter order, random return values, random error handling and lots of other randomness.

Object-orientation

I was looking for a language that was truly object-oriented (i.e. a language where everything’s an object) and that had a beautiful syntax. Ruby seemed to be the most appropriate option. Sure, it has its problems like every other technology (I don’t really like this monkey-patching stuff, and Rails in particular seems to be quite slow compared to other frameworks).

Syntax

This is a subjective matter, but I’ll put it anyway. I wanted my code to be expressive, concise, and beautiful. To me, PHP code has always been an ugly mess.

Here’s an example: suppose that you have an array of objects and that you want to call a method on those objects and sum the returned values. Here’s the PHP code for it:

array_sum(array_map(function($object) {
    $object->foo();
}, $objects));

Not so bad, is it? Here’s the same with Ruby:

objects.collect(&:foo).sum

Now, this might seem a small improvement, but when you’re writing lots of code I can assure you that it does make a difference.

Community

With the birth of modern web frameworks like Symfony (God bless the authors!) and Laravel this situation has slightly improved, but this point is still partially true.

The PHP community is terrible: most of them have no interest in improving the tools they’re working with, and just care about getting stuff done as quickly as possible with as little effort as possible. The amount of wrong/outdated information about PHP out there is impressive.

That’s why I’ve decided to maintain the Italian translation of PHP: The Right Way, even though I don’t use PHP anymore. I know that PHP isn’t going anywhere, at least for the next decade, and I’d like to improve all the terrible spaghetti code that I’ve read over the years.

What is PHP good for?

As I’ve said, PHP is a language designed for amateurs. All web hostings out there support it, and you can just upload your script through an FTP client and let it run. This works well for small applications that don’t require a lot of design or maintenance.

All the other technologies, on the other hand, require a bit of setup and tweaking to work well, but it pays off in the long run.

Further reading

There are many rants out there about PHP. The best are:

  • PHP: a fractal of bad design
  • The PHP Singularity

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật