Categories

Funny side benefit :-)

22nd August 2010

There I was, minding my own business, trying to solve problems in graph theory and I accidentally made a Sudoku puzzle solver! Isn’t it funny how life turns out sometimes? But that’s just how awesome LINQ is.

Eric Lippert on LINQ

Tags:

Intuitive behaviour

18th May 2009

Today I was looking at exception stack trace. One of suspicious places was ‘…\reports_controller.rb:129″. Okay, navigating to this location using RubyMine is a piece of cake. Ctrl+Shift+N to get to reports_controller.rb, then Ctrl+G to position caret at specified line. But hey, that’s two actions. I hit Ctrl+Shift+N, put ‘reports_controller.rb:129′ in and voila! It worked just as I expected!
RubyMine: +1 to intuitivity, +1 to overall impression.

Tags: ,

Advanced default parameters

09th March 2009

Today I was quite amazed by one of Ruby features. It is about default values of method parameters. For example you can do something like this:

def get_current_actions(project_id, status_id = params[:status_id] || DEFAULT_STATUS_ID)
    # implementation goes here
end

The code is saying basically this: “if status_id is not passed explicitly, try to take its value from params array. If it doesn’t contain specified key, then fall back to a constant”. This feature (as almost all the rest of Ruby magic) made avaiable by Ruby’s nature: it is interpreted language. This type of code is totally unusual to guys like me, who come from the world of static typing and compiled languages. But I think I’m gonna get used to it :-)

Iterations are good

04th March 2009

Iterations in software development. Tried to implement proper solution on the first try? I bet you failed. It’s like in Google Earth zooming in your house from the planet view. To achieve your goal, you’ve got to advance a little bit, adjust your position, advance further… Iterate until done.

Tags: