Uncle Bob on How to Build a Great Software Development Team

(Source: youtube.com)

sgeorgi:

I’ve been busy using Chef, Puppet and various other ways to automate provisioning of Unix servers in the past years. But instead of writing and orchestrating another set of chef recipes, I just wanted to pragmatically deploy a Rails application to the smallest DigitalOcean droplet that’s…

Ruby hash vs. RubyTree

I had to figure out what will perform better. A simple hash or a tree using RubyTree

I choose to implement JEGII’s example. Once using the simple ‘Hash’ and once using ‘RubyTree’.

The example

Input is a list of “Outline-Tags” which represents the structure of tree.

    001
    001.001
    001.002
    001.002.001
    001.003
    002
    ....


Output should be a HTML UL

<ul>
  <li>001
    <ul>
       <li>001.001
       <li>001.002
         .....
    </ul>
  </li>
</ul>


Solution one – simple Hash

File render_list_hash will create a Hash like:

{ "001" => { "001" => { "001" => {}, "002" => {} ... }}


and then renders this hash into a HTML-UL-tree.

Solution two - using RubyTree

File render_list_tree will create a ‘Tree::TreeNode’ with children, like so:

                        001
                 001         002
              001   002


and then renders the root-node recursively into a HTML-UL-tree.

Benchmark

You can run benchmark.rb to compare the two solutions. And it turns out that a simple Hash performs a lot better.

The reason maybe is, that the hash-solution creates one single hash and fills it with entries, where the Tree-solution creates a ton of Ruby-objects.

Anyways, the Tree-Object can do a lot more than a simple Hash. So it’s not fair to compare this way. My intention was to figure out how big the expected performance-costs will be. And it turns out, it’s to much.

Ruby hash vs. RubyTree

I had to figure out what will perform better. A simple hash or a tree using RubyTree

I choose to implement JEGII’s example. Once using the simple ‘Hash’ and once using ‘RubyTree’.

The example

Input is a list of “Outline-Tags” which represents the structure of tree.

    001
    001.001
    001.002
    001.002.001
    001.003
    002
    ....

Output should be a HTML UL

<ul>
  <li>001
    <ul>
       <li>001.001
       <li>001.002
         .....
    </ul>
  </li>
</ul>

Solution one – simple Hash

File render_list_hash will create a Hash like:

{ "001" => { "001" => { "001" => {}, "002" => {} ... }}

and then renders this hash into a HTML-UL-tree.

Solution two - using RubyTree

File render_list_tree will create a ‘Tree::TreeNode’ with children, like so:

                        001
                 001         002
              001   002

and then renders the root-node recursively into a HTML-UL-tree.

Benchmark

You can run benchmark.rb to compare the two solutions. And it turns out that a simple Hash performs a lot better.

The reason maybe is, that the hash-solution creates one single hash and fills it with entries, where the Tree-solution creates a ton of Ruby-objects.

Anyways, the Tree-Object can do a lot more than a simple Hash. So it’s not fair to compare this way. My intention was to figure out how big the expected performance-costs will be. And it turns out, it’s to much.

Tags: ruby

Is TDD dead? – I hope not

At least in the OpenSource world, where not every contributor can be a 100% professional, I see no argument –and no way– that we can leave the path of TDD.

If not for you, do it for your collaborators. Please!

And BTW, @DHH didn’t say we should not test!

After all the drama since DHH’s RailsConf-keynote, this Hangout with DHH, Kent Beck, and Martin Fowler may answer some questions.

Video: http://www.youtube.com/watch?v=z9quxZsLcfo

Tags: TDD

run rspec in vim

Latest OS X update did some harm to my environment and some gems stopped working. hapricot and vim-rspec was affected and I decide to implement the three commands I really need from vim-rspec myself.

Run rspec for current line in current rspec-file Run rspec for the entire current rspec-file Run complete rspec-suite

Find the gist on: https://gist.github.com/iboard/11134399

Run ruby code from vim

See https://gist.github.com/iboard/11140216

Tags: vim rspec

CanCoffee

Just published an example of a test-driven coffeescript-application. Using Jasmine and HTML5-Canvas.

Franky, I’m not a friend of Javascript at all tho. With Coffeescript and jasmine it’s fun to write test-driven, object-oriented apps even for JS ;-)

See it live

Don’t ask me. I can do it.

coffeemine is a template to start with your Jasmine-driven Coffeescript application.