Ruby Nation 2009 - Second Day

The previous day of the conference provided precious ruby stones of knowledge, wisdom and possible new friendships. I am now looking forward to hear the rest of the presentations.

Be Careful, Your Java is Showing

I tried to make Ruby more natural, not simple, in a way that mirrors life.
Yukihiro “Matz” Matsumoto

An analogy can be made between cultural immersion and learning a programming language. While learning it, study Ruby’s culture, style and techniques of writing code. Check out some of the most prominent Rubyists on github, immerse yourself in their work and strive to understand their ways. Some of the habits to learn include:

  • Breathe intelligence into your code by passing instructions to methods using blocs. For example, in a.collect {|e| e*e}, the collect method receives instructions on how to generate the elements of the new array. In contrast, an old fashioned loop will reveal the ugliness of code that intertwines data structures and algorithms:

    b = []
    for i in 0..a.length
    b << a[i]*a[i]
    end
  • Follow Ruby formatting conventions (underscore method names, spaces instead of tabs), method punctuations (?=boolean, !=dangerous), language features (unless instead of if !).
  • Use meta programming (belongs_to, etc.) to increase the expressiveness of your code by a whole order of magniture

Also check out:

Distributed Computing with Ruby and TupleSpaces

Some of the options for parallel computing in Ruby include:

  • Green threads in Ruby 1.8
  • Native threads are available in 1.9, but the Global Interpreter Lock makes concurrency a pipe dream
  • Fibers allow a lightweight threading model with cooperative scheduling, which provides some relief for multi-core programming
  • JRuby has native threads through the JVM
  • Hybrid model with M kernel threads for N user threads (like erlang)

Presenter’s recommendation: threads are hard, use processes. With no shared memory, programming is easier but more expensive. Also, inter-process communication is needed. You can choose any from the following:

  • DRB
  • Sockets
  • Queues
  • Key-Value Databases

Rinda Tuplespaces is an interesting implementation of concurrent repository to enable inter-process communication. It is a built-in library in Ruby. However, it has limitations such as single point of failure and not being platform-independent.

Luc implemented the Blackboard tuplespace on top of Redis (key-value database). It shows promise, but has currently scalability issues. An Erlang-based implementation is planned for the future.

Building Native Mobile Apps in Ruby

Rhodes targets five most popular mobile platforms: iPhone, Windows Mobile, RIM, Symbian and Android. It allows building applications in Ruby and it provides interfaces for GPS, PIM and the camera. A sync service is also available to keep some data on the device. The framework borrows heavily from Ruby on Rails, but is more restrictive. However, the restrictions make it easier to be compliant with app stores. In addition, a hosted development service is available. Developers can choose to use the GPL for their apps with no royalty fees, or choose a commercial license. Check it out on twitter @rhomobile.

From Rails to Rack: Making Rails 3 a Better Ruby Citizen

The Rails project is merging with Merbs. Rails 3.0 will make building and extending frameworks easier by being more modular and layered. The improvements will be in:

  • How libraries are used by Rails
  • How Rails is working with Libraries (middleware)
  • Ease of building libraries on top of Rails

Lightning Talks

  • Jack Dempsey - Beet: project generator that runs a recipe to go beyond than what rails do out of the box.
  • Tim Morton - TDD: Machinist replaces Fixtures, Shoulda is better than Test:Unit
  • Jeff Schoolcraft - RailsBridge: community projects at http://railsbridge.org/.
  • Michael Harrison - Clojure: LISP like language on JVM. Copy operations are more efficient with Software Transactional Memory and data is immutable.

Requires SEO; acts_up

By default, Rails is not search engine-friendly. Simple changes, such as making links human-readable, can make a huge difference. Other techniques, such as faceted navigation and redirection to eliminate duplicate pages will improve both user experience and bot navigation.

Use Google Webmaster tools and documentation to your advantage. It contains almost everything you need to know. Avoid the snake oil salesmen for SEO.

Herding Tigers - Software Development and the Art of War

Great presentation that describes how to take agile development to the next level. Remember, Agile is not a methodology, it is a mindset. There are many methodologies to choose from, but without the agile mindset, failure will be waiting around the corner. The key to success is speed of execution. Speed mitigates risk by triggering failures earlier in the project. Deliver quickly, deliver often, deliver a lot.

Comments are closed.