What Are the Things You Would Like Improved in the Ruby Language

Top 3 improvements that Ruby offers?

Well, you cut out a few of the things that make Ruby really fun, so I think any remaining list is going to be somewhat arbitrary. Here's why I think Ruby is nicer to work with than PHP:

  1. Consistency: In Ruby, everything is an object -- even numbers. You call a method on an object the same way -- there aren't really any "special cases". Moreover, the standard library (and most 3rd-party libraries) have consistent naming schemes and styles. The PHP library has grown...organically, and as such, the names, use of underscores, etc., is chaotic.
  2. Functional-style programming: Ruby borrows a lot of constructs from functional languages like Lisp. This is a pretty arbitrary reason, but I like functional programming, so having easy access to functions like the map and fold* methods from Lisp and Haskell is a plus for me. It also makes heavy use of blocks (aka "closures") which not only open up some very nice programming styles, but also allows you to write some very general code that can be used in a very specific manner, depending on your needs.
  3. True OOP: Ruby's OO model is borrowed heavily from Smalltalk, and uses the message-passing style rather than the method-calling style. This lets you do pretty cool things like implement your own handlers for missing methods. Ruby is also dynamic in nature, and thus lets you define methods -- and even entire classes -- on the fly, at runtime. You can also "open" classes up and provide your own methods, which can save yourself the hassle of, e.g., extending the String class just to add a rot13 method.
  4. RubyGems: RubyGems is a package manager for Ruby gems (third-party Ruby modules). It makes installing, managing, and removing third-party modules (and their dependencies) a breeze. (I threw this one in as a bonus reason.)

What are the most important things to know about Ruby?

Everything (except false and nil) evaluates to true in a boolean context.

This is different from other languages where empty constructs or 0 frequently evaluate as false.

if 0
puts "0 evaluates to true"
end

Ruby strength and usage

Ruby is a scripting language so no it's probably not suitable for "hardware level" code. It's a higher level language than c/c++ and probably the only languages it makes sense to compare it to are perl, python and php.

Of those three I would say it's biggest strength against them is the ruby community. A consensus always forms behind good projects and competing projects either disappear or merge. It's no surprise that ruby is the number 2 language on github (let's face it, everybody has to use javascript at some point.) If you compare a common library like nokogiri to python's offerings you get a community that's split in half between beautiful soup and lxml. For php it's even more drastic. Maybe 8 competing libraries vie for the same space (and every php programmer a cowboy who thinks he can do it better).

what Ruby knowledge should I have?

This is sort of from the top of my head; I'm sure I am missing a lot. Besides the things mentioned here, understanding programming and object-oriented programming in particular is a must, of course.

A few important language features:

  • Realise that in Ruby, everything is an expression, and be able to apply that principle, even if you think it makes your code unreadable.
  • Closures are mentioned; I would also expect Rubyists to know the differences between blocks and procs (and lambdas) and know how to convert between them. Closure mastery is important to being able to write beautiful Ruby, in my opinion.
  • Operator overloading: know what happens when you define methods named [], []=, ==, +, <<, etc. on an object.
  • Be proficient with most instance methods of Array, Enumerable and Hash (even if you don't know the exact definition by heart). Your Ruby code will be so much more verbose if you don't use methods like collect, inject, join, zip, etc. where appropriate.
  • Thoroughly understand what Symbols are, and when you should use / avoid them.
  • Understand what metaclasses are, know the difference between class variables and class instance variables.
  • Know how object attributes work in Ruby, how you can define them with attr_accessor and friends, and how you can define them yourself.
  • Be able to use modules, both as mix-ins and as namespacing tool. You should also understand how to mix-in instance methods and class methods (or be able to figure out how you could do it).
  • Know the difference between raise/rescue and throw/catch, and be able to use both correctly.
  • Understand how metaprogramming works, and at least have a basic idea of all the methods that allow you to do metaprogramming (mostly hidden in the classes Module and Object).
  • Be able to use a Hash method argument as a substitute for named arguments (even if it's just because it's a common pattern).
  • Know how concurrency does and doesn't work in Ruby.
  • Continuations, even if they're rarely used.

Some vital tools:

  • Know and understand Ruby gems
  • and rake
  • and RDoc.
  • and YAML.

Some framework knowledge:

  • Basic knowledge of Rails would be useful. Even if it's only because the outside world sometimes doesn't seem to know the difference between Rails and Ruby.
  • Know there are other web frameworks than Rails: Merb, Sinatra, Camping, ...

Ultimately, keep in mind that the above is "just knowledge", and not skills. It's probably easy to pick up most of this if you're not familiar with it.

What are the main advantages Ruby on Rails has over other web programming languages?

It's not a "web programming language" (whatever that means); it's a web application framework written in Ruby (a programming language, though certainly not just for the web!).

I'd say the primary advantages of Ruby on Rails (RoR) are:

  • the productivity of the Ruby programming language in general
  • the "Convention over Configuration" paradigm that decreases how much the developer must write to see a webapp running in their browser
  • stronger adherence to "Don't Repeat Yourself" (DRY) principles than PHP or ASP.NET (though you can still repeat yourself all you like if you try hard enough !)

What will change if i learn Ruby? (I know ASP.NET)

  • Easy to learn
    Ruby programming language is damn easy to learn. You will start building apps in days. If you enjoy programming, I think you will love programming in Ruby.

  • Web Apps?
    I have not used Rails for serious web apps. Even though I stick with ASP.NET for my web project, Rails is quite nifty and I strongly recommend it.

  • Comparisons I dont think ASP.NET is a "programming language". I cant compare it to Ruby. However people tell me Ruby on Rails is a good alternative to ASP.NET in some cases (could somebody here please help me by citing a real life scenario)

  • Philosophy Ruby is one of the languages which strongly believes that programming is not about spoon feeding the compiler. See the interview with the creator, Matz.

  • Resources There are plenty of nice resources to learn Ruby.

    1. Basics of Ruby Video
    2. Envy Casts' Advanced Ruby Topics and Ruby 1.9 Coverage
    3. Lot of Free Books on Ruby

I strongly urge you to learn Ruby. I learned a lot of new concepts in programming in general and had loads of fun coding in it.

python and ruby - for what to use it?

They are good for mostly for rapid prototyping, quick development, dynamic programs, web applications and scripts. They're general purpose languages, so you can use them for pretty much everything you want. You'll have smaller development times (compared to, say, Java or C++), but worse performance and less static error-checking.

You can also develop desktop apps on them, but there may be some minor complications on shipping (since you'll usually have to ship the interpreter too).

You shouldn't do critical code or heavy computations on them - if you need these things, make them on a faster language (like C) and make a binding for the code. I believe Python is better for this than Ruby, but I could be wrong. (OTOH, Ruby has a stronger metaprogramming)

Learn Go Or Improve My Python/Ruby Knowledge

If you're just looking to have fun and expand your horizons, then I'd learn Go, since you already know some Python.

If you're looking to improve as a developer, I'd personally recommend working on an actual project (using Python, as it's the language you have the most experience with):

  • This will take your (Python and general) programming skills to a whole new level
  • If you choose an interesting project, for example a semi-popular open source project, you'll even have some concrete result to show for your extra work. This will help your resume, help you meet other people interested in programming, etc.

I personally believe that spending the time you would have spent learning a new language by coding actual things you can use, is usually a net win (unless of course, like I said, you're just doing it for some fun recreation or relaxation).

how to prepare for a Ruby interview in just one weekend

You have no time. If you flop around reading potentially outdated blog posts you're just going to get confused and make no real progress. The Pickaxe book is too broad to really push your knowledge in a short time.

If you only have a couple of days, I'd suggest reading the first five chapters of Metaprogramming Ruby. It's not as intimidating as it sounds, and it will get you up to speed on the things that make Ruby very different from languages you may have used before. The first five chapters would be enough to give you a solid base. You can cover them in a weekend.

If you have time after doing that I'd suggest reading up on RSpec or whatever testing setup your potential employer uses. The RSpec book is a good resource to learn how a Ruby/Rails shop is likely to work.

Others have suggested Agile Web Development with Rails. I wouldn't bother "reading" it at this point. Run through the tutorial if you have time to get an understanding of the Rails vocabulary. Wait to digest the book fully until later.



Related Topics



Leave a reply



Submit