Understanding IoC : What exactly is the code written in ruby doing?

by Vivek_Shukla   Last Updated August 13, 2019 20:05 PM

I was trying to read the difference between a library and a Framework. And from one of the post, it became clear that the biggest difference is the inversion of control, i.e. where Framework calls your code.

Martin Fowler's article about IoC seems pretty good except It is in Ruby Language which I don't know, what exactly is the following code doing?

  require 'tk'
  root = TkRoot.new()
  name_label = TkLabel.new() {text "What is Your Name?"}
  name = TkEntry.new(root).pack
  name.bind("FocusOut") {process_name(name)}
  quest_label = TkLabel.new() {text "What is Your Quest?"}
  quest = TkEntry.new(root).pack
  quest.bind("FocusOut") {process_quest(quest)}

My Understanding is that when code flow is more event-driven or generally speaking whenever any .Net features like Anonymous Types, Extension Methods, Lambda Expressions etc. are used then Inversion of Control can be percieved

Related Questions

Updated November 29, 2016 08:02 AM

Updated February 18, 2018 13:05 PM

Updated June 18, 2016 08:02 AM

Updated May 28, 2015 09:02 AM