1

Well I know pretty well php and its frameworks that this powerful language offers to users.now I would put my attention to ruby and its best web framework Ruby on Rails.what I would understand is the features ruby has respect to php.what could be the advantages for a programmers using ruby and its framework as Rails instead of using php?rails is more powerful than every php frameworks?is it really convenient getting involving to ruby programming?I would have a idea if it is convenient to start programming in ruby

eng_mazzy
  • 1,049
  • 4
  • 23
  • 39

4 Answers4

5

How many other programming languages have you learned? Do you know anything other than PHP? If not, I would suggest you learn any other language. The more languages you learn, the better of a programmer you'll be. Different languages have different design strategies and different reasons for being, problems they are trying to solve, functional approach versus procedural vs objects, etc. So learn, Ruby, C#, java, clojure, C, Basic, javascript, anything. Then learn another one. Also, don't just focus on learning technology and languages. Learn methodology, best practices, OOP and design patterns.

Ok, all of that out of the way, here are the advantages to ruby. I've done both PHP and Ruby and I can tell you IMHO, Ruby is more of a professional programmer's language. PHP was created as a hobbyist language, and although as you mentioned, it has become very powerful and very much proliferated on the web, it also has a lot of warts. Language design is hard, and PHP was not so much designed as it was evolved and added to. Ruby is much more elegant (again, my opinion, don't flame me PHP folks) has a lot more thought in the design, and as such is much more consistent. Ruby was designed to be both an object-oriented and functional language from day one. PHP got objects later as an after-thought, and only because the community screamed about it. Everything in Ruby is an object, and almost all methods are within a class or module. Ruby sticks to its own conventions very well in ways PHP does not.

All that being said, there are difficulties in ruby. Its a bit more "ivory tower." Since you mentioned not just ruby, but also Ruby on Rails, let me give you some information on that. Rails isn't a language. Ruby is the language, and rails is a framework built upon that language. Rails is not created for simple web pages or structured around pages. It uses an MVC pattern. This pattern is more complex and has a larger learning curve, but it also makes more complex web applications easier to understand and maintain. Some people don't like having a design pattern or structure shoved down there throat. However, MVC is a well-known and useful pattern so many people like this being in rails by default. Rails also uses an O/R Mapper, which also requires a bit of study. Again, some developers don't like this, but others find it useful to have everything in one toolbox. Rails has validation, o/r mapping, the mvc pattern, sending templated emails, a RESTful architecture, internationalization, database migrations, form helpers, routing, unit testing, command line tools (rake) and more. Of course, you can learn other web frameworks and use other tools with Ruby, but Rails happens to be the most popular. You can also do all these things in PHP and other languages and frameworks but rails just gives you it all in one framework in a very slick language.

So in summary, let me state what i see as the crucial the differences between these two languages. PHP was designed for web pages and web sites. Ruby on Rails was designed for web applications. PHP was designed (initially) for simpler problems, like just getting data on to a web page. Rails was designed for more complex problems, like building larger applications with a lot of logic and complexity. Of course, people build complex web applications in PHP and simple websites in Ruby on Rails. I'm just telling you the philosophy behind the languages.

So yes, please learn ruby and rails. You'll see a lot of design patterns and its a great community. There are a lot of great open source projects in the ruby ecosystem to learn from as well. Then learn Clojure, or C#, or Java, Sql, or Objective-c. Keep learning.

fregas
  • 3,192
  • 3
  • 25
  • 41
  • as sarnold mentioned, you might want to look at other ruby frameworks eventually as well. I dont think its necessary to learn them deeply, but just see what the differences are. Take a look at sinatra instead of rails mvc, or data mapper instead of rails activerecord. I know a lot of programmers that are "one trick ponies." Knowing the different approaches means you're not trying looking at every problem as a "nail" because all you have is a "hammer." – fregas Mar 05 '12 at 16:22
1

First you should learn Ruby language basics, I can recommend you this interactive course After that you can look at interactive Rails for Zombies course.

Another interesting resource is phptoruby blog

After learning basics you can use official RoR website, and check working librabries/solutions from Ruby Toolbox

Slawek
  • 583
  • 3
  • 9
0

You could take a look at the edgecase ruby koans

Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
0

You might want to checkout this screen cast by Ryan Bates about "Getting Started with Rails": http://railscasts.com/episodes/310-getting-started-with-rails

By the way: Ryans railscasts.com is one of the coolest things in the Rails community to learn both principles (like Test Driven Development, clean code, security) and Rails plugins ("gems", there are tons of them out there for almost everything, from authentication over payment to search functionality) as well as to stay up to date with the current Rails versions.

spaudanjo
  • 764
  • 7
  • 13