The Web Development Series is supported by Rackspace, the better way to do hosting. Learn more about Rackspace’s hosting solutions here.

We’ve teased you in the past with promises of code snippets from bona fide Ruby experts — for all you advanced Rubyists, here’s the code, ready for your dissection and possible implementation.

We’ve also got some more general insights from our panel of seven Ruby experts on the strengths and limitations of the Ruby programming language and their favorite Ruby apps and tools.

If you’re just starting out as a new Ruby dev, check out our tips for Ruby novices, which includes introductory-level advice from the same group of experts. And if you’re an intermediate developer looking to improve your skills, also check out tools and advice for mid-level Ruby programmers.


Jacques Crocker: Core Library Substitutes


Jacques Crocker is a Rails Jedi based out of Seattle who loves working on early-stage startup ideas and launching new products. He’s helped launch almost a dozen Rails apps this year including HeroScale.com (automatically scale your Heroku workers and dynos) and WordSquared.com (a massively multiplayer online word game). Next year, he’s planning on using Rails to launch 24 new web apps.

He says the tools in place for sharing code are one of his favorite things about the Ruby ecosystem. “GitHub and especially RubyGems.org make releasing a library to the world trivial. You’ll be able to find an existing gem for just about every API or interface you can imagine.”

When it comes to Ruby’s limitations, Crocker says, “Some of the core libraries have stagnated. Luckily, almost every crusty old Ruby standard library has a decent third-party gem alternative that usually fixes things up… Solid replacements for Ruby’s standard library are coming out every week, and it sounds like there’s some talk about Ruby 2.0 allowing an easier approach for swapping out standard libraries.”

For example, he cites using Typhoeus rather than HTTP, Nokogiri for XML, RSpec instead of Test:Unit, and Psych for YAML.

Crocker also recommends therubyracer, a library that wraps Google V8 with Ruby bindings (“I use this currently to execute CoffeeScript natively within Ruby using the coffee-script gem”), and MacRuby, which re-implements the Ruby language in an Objective-C environment for native access to Cocoa objects when building Mac apps in Ruby.


Yehuda Katz: Refactoring Code


Yehuda Katz is a member of the Ruby on Rails core team, and lead developer of the Merb project. He is a member of the jQuery Core Team and a core contributor to DataMapper. He contributes to many open source projects, like Rubinius and Johnson, and works on some he created himself, like Thor.

He says, “Even though most of the Ruby development community is focused around the Rails framework, there are standalone libraries for just about everything, like virtually every new NoSQL database and connectivity with services like Twitter and Facebook.”

Another thing Katz loves about Ruby is “the ability to refactor code from any context (including class bodies) into a method without changes to that code. The two features that make Ruby shine in this respect are executable class bodies and Ruby’s block semantics.”

Here are Katz’s examples:

If we found that we were using that attr_accessor logic repeatedly, we could extract it out into a method that we could use in multiple classes.

“This is a relatively simple example,” said Katz, “but it demonstrates the refactoring power of Ruby’s single-context approach.”

He continued that blocks have similar power.

“Consider the classic case of synchronization locks, which many languages implement as language features:”

“Ideally,” Katz says, “we’d be able to abstract the mutex lock and unlock into a synchronize method. In Java, that is impossible, because closures do not exist at all, so synchronize is a language keyword. Even in languages like JavaScript, which do have closures, it is not trivial to make this modification. Let’s take a look
at an attempt to extract the mutex lock into a separate function in JavaScript:

“The problem here is that the return in the function passed to synchronize is returning from the inner function. Moving the unsychronized code into a synchronize block does not work reliably.

“In contrast, Ruby’s blocks can handle this problem:”

“In short,” Katz concludes, “Ruby is designed around making it easy to refactor code into methods, and the single-context principle (class bodies work the same as method bodies), and Ruby’s block semantics deliver on this promise.”


Obie Fernandez: RailsForZombies and the Non-Commercial Aspect


Obie Fernandez is the founder and CEO of Hashrocket, a Florida-based web consultancy and product shop. He’s a well-regarded blogger and speaker, and he’s also a series editor and book author for higher-education publishers Addison-Wesley.

For Ruby development and deployment, he says Heroku is “amazing,” and he also recommends RailsForZombies.org, which has a web-based, interactive Rails sandbox environment. “It gives people a no-setup, no-excuses way to get started on Rails and is based on some pretty cool underlying use of the technology,” he says.

While Fernandez says he loves making money from the “competitive advantages” of the Ruby programming language, he also says one of Ruby’s strengths is its corporate independence.

“There is no big commercial vendor getting all capitalistic on us and causing problems like you see with Oracle and Microsoft and their developer communities. Almost everything that gets done in our space, 99% is done for open-source love and passion and because it is useful to the person doing it. We don’t have any big, ivory-tower producers that I’m aware of.”


Ryan Bates: Blocks and Better Memory Handling


Ryan Bates is the producer and host of Railscasts, a site full of free Ruby on Rails screencasts.

Bates says, “One thing I miss most when using another language is Ruby’s block syntax. It makes simple, everyday tasks, such as remapping an array, convenient and beautiful.”

However, he cites Ruby’s “poor support for concurrency” as one of the language’s flaws. “Being a Rails developer,” he says, “I usually do not run into this problem because it is easy to spin up multiple instances of an app. In that case, memory can be a problem. I would love to see better memory handling and management in Ruby.”

As far as clever hacks go, Bates says, “This little trick for exposing any Ruby object over the web is pretty ingenious (and madly insecure):”


Desi McAdam: Ruby’s Bad Rap for Slowness


Desi McAdam is a Ruby developer at Hashrocket. She also co-founded and regularly contributes to the technical blogging group DevChix.

McAdam says, “I am constantly surprised by the expressiveness of the language. I enjoy coding in Ruby because it allows me to write beautiful code very easily.”

When it comes to Ruby’s downsides, McAdam’s statements lean more toward the language’s reputation than its actual flaws. “I don’t know how many times someone has given me the excuse of ‘Ruby is too slow’ as a reason not to use the language. There are of course some situations where this might be true; but in most cases, it’s just not important and can be handled through other mean.”

Cool Ruby-built apps she recommends checking out are MercuryApp, which lets you track how you feel about certain things over time; DesksNear.Me, a co-working app and Rails Rumble winner; and Commendable Kids, a positive feedback system for reinforcing good behavior in kids.


Raquel Hernández: IRB, RVM, Sinatra and Homebrew


Raquel Hernández is an experienced hacker/mathematician with a background that includes many programming languages and many work environments, from freelance and contract work to startups and larger companies. However, she’s made a particular focus of Ruby and Rails.

While Hernández praises the strength of the ever-growing Ruby community, she says its biggest limitations are “speed and scalability, which are a problem today — but improvements are happening at all times to prevent this. I don’t think this would be a problem in the near future.”

She also says, “I couldn’t survive a single day without IRB. It’s one of Ruby’s most popular features.” She also recommends reading this list of tips and tricks for IRB. She likes RVM for giving her the ability to work with multiple Ruby environments, Sinatra for quickly pushing out Ruby apps, and Homebrew for OSX package management.


José Valim: Objects, Inheritance, and the builder Library


José Valim is the founder of Plataforma Tec, a web development shop and consultancy. He’s also an open source developer and a Rails Core Team Member.

Valim also sings the praises of the Ruby community, saying, “We have a community that values software craftsmanship: well-developed, tested and documented code.”

He also shares some code samples that exemplify “what makes Ruby so pleasant to work with.”

“This one shows two Ruby features: everything in Ruby is an object (including numbers!) and classes in Ruby are open for modification. This means we can extend integers in Ruby (that are Fixnum objects) with new methods.

“The example above was extracted and simplified from the Rails framework and allows you to write: 3.days.ago or 5.minutes.from_now as valid Ruby expressions. Working with time intervals is common in web applications, and such modifications make pleasant and easy to manipulate them.”

“This second example shows inheritance, Ruby blocks (pieces of code that can be passed around and invoked on demand) an
d method contracts. Most languages implement switch/case statements (which in Ruby is called case/when) internally. Ruby, on the other hand, specifies that, in order to pass an object to a when statement, you just need to implement a method named ===. While the example above is simple and could be implemented using if/else statements, it shows the flexibility you can achieve with the Ruby language as everything is an object and as the language relies heavily in method contracts.”

“The last example uses a third-party library called builder that makes XML creation simple. It relies on a feature from Ruby called method_missing. Every time you invoke a method in a Ruby object and this method is not defined in it, Ruby invokes a method called method_missing that should handle the scenario accordingly. In this case, the builder library implements this method in a way that makes XML creation a breeze.”


Specific Questions or Tips?


If you’re a crack Ruby developer and you have a question, feel free to drop it in the comments! Our panelists are likely to stop by with more feedback.

Likewise, if you you feel like answering questions or passing on some great advice of your own, please leave a comment and school us all.


Series supported by Rackspace


rackspace

The Web Development Series is supported by Rackspace, the better way to do hosting. No more worrying about web hosting uptime. No more spending your time, energy and resources trying to stay on top of things like patching, updating, monitoring, backing up data and the like. Learn why.


More Dev & Design Resources from Mashable:


The Top 8 Web Development Highlights of 2010
HOW TO: Get More Out of Your Fonts
4 Predictions for Web Design in 2011
HOW TO: Make the Most of TextMate
5 Free Annotation and Collaboration Tools for Web Projects

Image of José Valim courtesy of Flickr, levycarneiro.

More About: advanced, advice, developers, hacks, rails, ruby, ruby tips series, tips, web development series

For more Dev & Design coverage:

The Web Development Series is supported by Rackspace, the better way to do hosting. Learn more about Rackspace’s hosting solutions here.

If you’ve been hacking away in Ruby for a while and are looking to take your skills to the next level, our panel of seven Ruby experts has a few words of advice for you.

Below are some helpful hints, personal growth-inducing exercises, and tools recommended by some of the best Ruby devs out there. And of course, we welcome any tips or advice you have to give in the comments.

If you’re looking for advanced-level code snippets, stay tuned for the next installment in this three-part series on Ruby. And if you’re just starting out as a new Ruby dev, check out our tips for Ruby novices, which includes introductory-level advice from the same group of experts.


Jacques Crocker: Create a Library of Snippets


Jacques Crocker is a Rails Jedi based out of Seattle who loves working on early-stage startup ideas and launching new products. He’s helped launch almost a dozen Rails apps this year including HeroScale.com (automatically scale your Heroku workers and dynos) and WordSquared.com (a massively multiplayer online word game).

His advice for intermediate Ruby devs is to “build an executable snippet library.” He explained:

“Every time I write some code that I think could have potential for reuse in another project in the future, I copy and paste it into a unit test within a private ‘snippets’ project. This allows me to go back and pull out snippets of functioning example code whenever I confront the same problem again. The most important thing is that this code is executable, and has associated tests.

“Use this as a replacement for IRB [the Interactive Ruby Shell]. Instead of loading up an IRB instance to verify that some code works, I open up my snippets project in TextMate and start writing some unit tests to get the code working. Running these snippets within TextMate is even easier than IRB (cmd+r).”


Yehuda Katz: Get to Know the Ruby Object Model


Yehuda Katz is a member of the Ruby on Rails core team, and lead developer of the Merb project. He is a member of the jQuery Core Team and a core contributor to DataMapper. He contributes to many open source projects, like Rubinius and Johnson, and works on some he created himself, like Thor.

He tells intermediate Ruby coders to “spend some time to properly understand the Ruby object model. Specifically, understand what singleton classes are and how they are used.

“It’s possible to muddle along for a long time in Ruby without understanding it, but it will add a lot of complexity to your mental model, because you’ll be creating many imperfect abstractions in your mind when the reality is much, much simpler.”


Obie Fernandez: Go Easy on Metaprogramming


Obie Fernandez is the founder and CEO of Hashrocket, a Florida-based web consultancy and product shop. He’s a well-regarded blogger and speaker, and he’s also a series editor and book author for higher-education publishers Addison-Wesley.

For mid-level Rubyists, he advises them to not “go crazy” when it comes to metaprogramming.

“There is definitely a curve in your adoption of Ruby when you start getting comfortable with the core language features and start exploring some of the wilder possibilities. For me it was a little over a year in when I started doing a lot of DSL (Domain-Specific Language) stuff in Ruby.

“When you get into heavy usage of instance_eval, friends, your code starts getting more and more difficult to understand and maintain. Yes, Ruby has incredibly powerful metaprogramming powers, but if you’re using them in your day-to-day application programming, I’m going to bet you’re doing it wrong.”


Ryan Bates: Use the Source, Luke


Ryan Bates is the producer and host of Railscasts, a site full of free Ruby on Rails screencasts.

“Don’t be afraid of diving into the source code when you don’t understand something,” is Bates’s advice to intermediate Ruby programmers.

“Ruby libraries are often lacking in the
documentation department, but the code is generally readable. If there are tests, those can also help show you how the code is intended to be used.

“Reading other code is one of the best ways to improve your code as well.”


Desi McAdam: Dive Into IRB and Code Katas


Desi McAdam is a Ruby developer at Hashrocket. She also co-founded and regularly contributes to the technical blogging group DevChix.

McAdam says that for her personal growth as a Ruby developer, “Playing around in IRB is something that has helped me. One example of this is opening up classes, extending them, including them, etc., to see how the method calls happen in one way versus another. It really helped me understand when to use extends versus when to use includes.”

She also said that code katas, études for programmers, have been extremely useful in helping her improve her Ruby skills. “There are a bunch out on the web, and it’s a really good way to beef up your Ruby knowledge because the exercises prod you into certain aspects of the language you might not otherwise hit in your everyday Ruby coding.”


Raquel Hernández: Follow Others’ Code and Conversations


Raquel Hernández is an experienced hacker/mathematician with a background that includes many programming languages and many work environments, from freelance and contract work to startups and larger companies. However, she’s made a particular focus of Ruby and Rails.

She said that reading and researching other developers’ code is the best way for an intermediate Rubyist to improve his or her skills. “Don’t just install a gem; look at how things work internally.

“I also try to follow other Rubyists on Twitter; the same for code projects on GitHub, conversations on mailing lists, newsletters, etc. — everything that helps me keep up-to-date.

“Recently I started following Ruby Best Practices — Practicing Ruby, The Newsletter. It’s pretty good for intermediate or advanced Ruby devs.”


José Valim: Code Open Source Projects


José Valim is the founder of Plataforma Tec, a web development shop and consultancy. He’s also an open source developer and a Rails Core team member.

In addition to reading source code from other developers and other projects, Valim recommends that intermediate Ruby devs get involved with open source projects, themselves. “You can learn a lot by doing these activities… Ruby’s community is responsible for several open source projects, conferences, tutorials and blogs that improve and bring new ideas into the Ruby ecosystem every day.”

As an open source developer, he also encourages more women specifically to get involved in open source Ruby coding.


Specific Questions or Tips?


If you’re an intermediate Ruby dev and you have a question, feel free to drop it in the comments! Our panelists are likely to stop by with more feedback.

Likewise, if you’re a more experienced Ruby dev and you feel like answering questions or passing on some great advice of your own, please leave a comment and school us all.


Series supported by Rackspace


rackspace

The Web Development Series is supported by Rackspace, the better way to do hosting. No more worrying about web hosting uptime. No more spending your time, energy and resources trying to stay on top of things like patching, updating, monitoring, backing up data and the like. Learn why.


More Dev & Design Resources from Mashable:


The Top 8 Web Development Highlights of 2010
HOW TO: Get More Out of Your Fonts
4 Predictions for Web Design in 2011
HOW TO: Make the Most of TextMate
5 Free Annotation and Collaboration Tools for Web Projects

Image of José Valim courtesy of Flickr, levycarneiro.

More About: advice, developers, expert, intermediate, rails, ruby, ruby tips series, tips, web development series

For more Dev & Design coverage:

The Web Development Series is supported by Rackspace, the better way to do hosting. Learn more about Rackspace’s hosting solutions here.

The Ruby community and the language itself are a fast-growing phenomenon that plays an ever-increasing role in the ecosystem of web apps we all know and use.

If you’re a beginning Ruby dev, this post is for you. We have polled seven experts in the Ruby community — developers who have come highly recommended and respected by their peers.

This is the advice they give specifically to new Ruby developers. We hope you find it useful, encouraging and enjoyable.

If you’re a seasoned pro or an intermediate Rubyist, stay tuned. We’ve got lots more where this came from, and our seven experts have got tips, tricks and code snippets for you, too.


Jacques Crocker: Learn As You Build


Jacques Crocker is a Rails Jedi based out of Seattle who loves working on early-stage startup ideas and launching new products. He’s helped launch almost a dozen Rails apps this year including HeroScale.com (automatically scale your Heroku workers and dynos) and WordSquared.com (a massively multiplayer online word game). Next year, he’s planning on using Rails to launch 24 new web apps.

In an e-mail exchange, he told us new Ruby devs should “start building something and get it released to GitHub as soon as possible.

“You don’t have to have a new or exciting idea to implement. When you are learning, just build stuff that has been done before. Build a scaled down version of Twitter. Or reimplement a blog.”

Crocker says he once ported a PHP-built job board to Rails — a thoroughly educational experience.

He continued, “I’d recommend finding a project that looks interesting on OpenSourceRails.com and getting up and running locally (and the tests functional). Then try adding a few new features to it. And get it upgraded to the latest Rails version while fixing the dependencies.

“Jumping straight into development work without experience will definitely be difficult and frustrating. However the amount of learning you’ll receive will be enormous… Making yourself suffer through the pain of a new environment will help you learn faster than you ever thought possible.”


Yehuda Katz: Dive Into the Ruby Community


Yehuda Katz is a member of the Ruby on Rails core team, and lead developer of the Merb project. He is a member of the jQuery Core Team and a core contributor to DataMapper. He contributes to many open source projects, like Rubinius and Johnson, and works on some he created himself, like Thor.

He advises newer Ruby developers, “Don’t be intimidated. Take advantage of the very many robust community resources that exist, and make connections with community members through open source. The Ruby ecosystem is hungry for new developers, and if you make your mark, you won’t go jobless for very long.”

In fact, Katz says the community itself is one of the strongest points of the Ruby language. “Even though most of the web development community is focused around the Rails framework, there are standalone libraries for just about everything, like virtually every new NoSQL database and connectivity with services like Twitter and Facebook.

“There’s a spirit of experimentation in the Ruby community that makes it extremely strong.”


Obie Fernandez: Start With a Clean Slate


Obie Fernandez is the founder and CEO of Hashrocket, a Florida-based web consultancy and product shop. He’s a well-regarded blogger and speaker, and he’s also a series editor and book author for higher-education publishers Addison-Wesley.

He said, “Don’t try to bring over your old idioms and patterns, because they’ll just weigh you down.

“When I came over to Ruby from Java, my first instinct was to try recreating a bunch of concepts and architectural patterns that I already knew, such as dependency injection, instead of learning new ones more appropriate to Ruby. If you’re coming from a statically typed language like I did, you might have some trouble letting go of the perceived security of type constraints.

“There’s like this whole Zen aspect of working with Ruby where you have to let go of trying to exercise control over every possible interface for your objects.”

He also echoes Katz’s statements about the Ruby community. “We’ve got this amazing, creative and hard-working global community of people working to make Ruby the most enjoyable environment. There is no big commercial vendor getting all capitalistic on us and causing problems like you see with Oracl
e and Microsoft and their developer communities. Almost everything that gets done in our space, 99% is done for open-source love and passion and because it is useful to the person doing it.”


Ryan Bates: Ask — and Answer — Questions


Ryan Bates is the producer and host of Railscasts, a site full of free Ruby on Rails screencasts.

For beginning Ruby devs, Bates recommended, “You can learn a lot by asking questions, and you can learn even more by contributing, yourself.

“With every problem you run into, there are many others who will likely run into the same thing. When you find a solution, write about it to help others and to get feedback on better solutions. We’re all learning.”

Bates takes his own advice, as well, by contributing to sites like Rails Forum.

Disclosure: Mashable‘s features editor, Josh Catone, is the co-founder of Rails Forum.


Desi McAdam: Learn From the Masters


Desi McAdam is a Ruby developer at Hashrocket. She also co-founded and regularly contributes to the technical blogging group DevChix.

She said the thing that helped her most in her study and use of the Ruby programming language was “pairing with other masters of the language.” Since not everyone who wants to learn Ruby has one-on-one access to the masters, however, she has a few suggestions for beginning devs.

“I would also suggest reading books like The Ruby Way by Hal Fulton and Programming Ruby, a.k.a. The Pickaxe Book, by Dave Thomas, Chad Fowler and Andy Hunt.

“If Ruby happens to be the first language you are ever learning I would suggest Learn To Program by Chris Pine. My sister is a nurse who has never done any programming whatsoever and she was able to use this book to learn the fundamentals of programming and she did so at a remarkably fast pace.”


Raquel Hernández: Three Steps With Four Tools


Raquel Hernández is an experienced hacker/mathematician with a background that includes many programming languages and many work environments, from freelance and contract work to startups and larger companies. However, she’s made a particular focus of Ruby and Rails.

She came to us with a list of specific steps and tools for new developers.

“I would suggest reading Programming Ruby 1.9: The Pragmatic Programmer’s Guide (The Pickaxe Book) in order to get familiar with Ruby.

“For Rails-specific stuff, I’d highly recommend Railscasts as starting point. Pick a fun project; complete the Getting Started with Rails tutorial; and deploy it to Heroku.

“After completing these three steps, you’re going to be having so much fun and getting lots of things done that there won’t be coming back.”


José Valim: Focus on Best Practices and Testing


José Valim is the founder of Plataforma Tec, a web development shop and consultancy. He’s also an open source developer and a Rails Core team member.

For beginners, he writes, “Ruby is a very powerful language… it is natural that when you start your first project, you get carried away by the productivity the language gives you and don’t worry about Ruby’s best practices.

“My advice is to control a little this initial amazement and read up on Ruby best practices. Ruby is an object-oriented programming language, so the knowledge of features like encapsulation and inheritance and principles like single responsibility are extremely important to have.

Valim also advises new Ruby devs to not leave testing out of the picture. “Ruby ships with a built-in test framework, and there are several others available as open source, all with plenty of documentation and books. It will reduce your productivity at the beginning, but it definitely pays off withs well-tested, organized and readable code.”


Specific Questions or Tips?


If you’re new to Ruby and you have a question, feel free to drop it in the comments! Our panelists are likely to stop by with more feedback.

Likewise, if you’re a more experienced Ruby dev and you feel like answering questions or passing on some great advice of your own, please leave a comment and school us all.


Series supported by Rackspace


rackspace

The Web Development Series is supported by Rackspace, the better way to do hosting. No more worrying about web hosting uptime. No more spending your time, energy and resources trying to stay on top of things like patching, updating, monitoring, backing up data and the like. Learn why.


More Dev & Design Resources from Mashable:


The Top 8 Web Development Highlights of 2010
HOW TO: Get More Out of Your Fonts
4 Predictions for Web Design in 2011
HOW TO: Make the Most of TextMate
5 Free Annotation and Collaboration Tools for Web Projects

Image of José Valim courtesy of Flickr, levycarneiro.

More About: beginner, developers, programming, rails, ruby, ruby tips series, Web Development, web development series

For more Dev & Design coverage: