Tech Off Post

Single Post Permalink

View Thread: Ruby on Rails vs. ASP.NET Deathmatch!!!
  • User profile image
    Eirik

    My big, wet dream right now is to have the Ruby language on .NET - that would make me extremely productive!

    While C# is a lot better in that respect than Java, it still is a lot of typing in at least two senses of the word. Ruby is simply elegant - as the exception in the post above proves Wink.

    While the shorthand is fine, the code may be written like this:

    def bfs(e)
        q = Array.new()
        e.mark()
        yield( e )
        q.push( e )
        while not q.empty?()
            u = q.shift()
            u.edge_iterator do |v|
            if not v.marked?()
                v.mark()
                yield( v )
                q.push( v )
            end   
        end
    end

    bfs(e) { |v| puts( v ) }



    ...which makes it a little easier to distinguish methods and arguments - but its really just a sprinkle of sugar. If methods and variables had been given meaningful names it would be even easier.