DI, IoC => windsor Wins

After a long time a chance came around to use Windsor in one of the projects. While refactoring the code I realized we had coupled few components way too tightly. Thus their upgrade, pluggability were getting hindered. At that time we had very less time and no luxury of evaluating the frameworks.  Now in some down time, I realized Windsor  is a perfect lazy programmer’s helper. Do minmum independent work in one class and keep the dependency in form of behavior (interfaces).  Keep the implementation of interface at a distance and use a framework to resolve the relationship.

No I am not using it becuase it makes the testing easy. I have the pluggability as main concern. Use of factory/service locator etc was not going to give this kind of ease.  One of the days when I have time, I will trim the code and dump it here for before and after image.

A day of work with windsor convinced me about its elegant design and use. It is pretty powerful in its services/Dependency Solver/Facilities and related extensibility model.

Related important documentation – configuration (.chm file is not so good for explaining the items), it gets complex at times if you have lot of items you want to decouple. It would be wiser to use include files or Boo-DSL-Binsor.  That is the only downside of the these frameworks (spring.Net) as they make debuggability – hard. One needs to look at 2 different places for the information. 

Tip – type is fully qualified type information. When directly using kernel you may not encounter any errors as was in my case but one would be insulted when using the configuration method. So always remember this when providing information, (same applies to service information)


Good tutorial – BitterCode.

Download location – Castle.  They also have the MonoRail which started the push for asp.net mvc framework in many ways.

Alternatives are ninject, spring.net, pico/nano. On java side the one which is more exciting is guice. The video of guice is little better intro compared to msdn articles. But don’t worry it is just factory pattern/strategey.

Common things

- injection of constructor, setter etc, interceptors (method )

- lifetime, security + AOP concerns

- use of config files(ninject has different attribute based approach) to provide default information to decouple.

Nothing new for folks who have seen the early remoting days and evolution of wcf in its container avatarand folks who use the terms like strategey/factory pattern. Just a big time saver. It should be used carefully depending on how much time you want other people to learn a framework vs your container approach.

I wished CLR team extended the Binderand friends in elegant way for general usage, Objectbuilder(/Unity) does not inspire confidence. 

Activator.Createinstance !

Anyway – another good thing for last 2 weeks was xunit. So xunit+waitn should cover most of the scenarios for us. Compared to nUnit/MBUnit – it was dead easy( I am hoping I am not betting on always in beta work though). Battle is still on between Moq and RhinoMocks. I am still refactoring like crazy to enable most of the essential control.  Waiting for spec# to have some official lifeline.

Dish one, Jhaalmuri

Tick 1 – Jhalmuri with kolkata spunkiness done !

I longed for the spicy, zany taste of Jhalmuri and almost got there this evening. The guidance came from Masalamagic. I did not use the potatoes because boiling them takes time :). For non Bengalis/Oriyans Jhalmuri is spicier version of Bhel with very apt use of mustard oil. It also lacks the tamarind/jaggery taste thus making it truly unique and addictive.  There are versions of it which use Haldiram mixture/peanuts , but the best taste is taking fresh ingredients and using home roasted peanuts.

Only tip – Add the finely cucumber only at the time of serving.  I was not sure of the coconut getting added to it but in hindsight it should be good idea.

Notice how muri is same as churmure in marathi, mur mure in Hindi?

Is it my life?

The idea of control of time and way of death has baffelled many over long time. Well meaning governments have made sucide/euthanasia a crime. Death is made morbid and unfashionable in the ad-pushed-get-quick-riches-cure world as many other old fashioned things. But when I am old and crippled with disabilities not allowing me to talk/respond, why continue with artificial means of “keeping the body alive”?  who makes that decision?

Mr. Russelll makes  poignant point   about his life.  Just as life is welcomed, death should be too.

Kolhapuri misal at Prarthana

“कोल्हापुरी मिसळ – Misal” was introduced to me near kolhapur Bus stand as dish which sort of represents Kolhapur. In those days I was not amicable to other fav of Kolhapur – tambda/pandhra rassa.  I enjoyed misal back again from Kedarling(Jotiba).

Over years across Pune/Mumbai I have tried to find the right Misal taste, Prarthana is the closest to the ideal. Contrary to expectations, it is not hot(chilly) but is made of generous helping of usal(sprouted beans), kat, farsan, kanda, kothimbir, lal tavang.  Hotstove has a great recipe.

In Pune side, they also add pohe, some people have added potato chips/churmure etc. Anyway talking about this presentation from prarthana in Kolhapur. It comes with two while slices fresh of white bread(nope no options of brown bread) . A pot of kat(sort of sambhar) and misal. It has the addition of nicely cut onions, kothimbir etc and lemon. The dish costs only 18 odd rs and leaves you with lingering taste.

Language, culture, Religion

Control of the language also is tied to the religion in many ways and thus one see the pointless fights in India where religion is nearly the same but the culture, language traditions are very different across the region. It is offcourse sad to see the movies released with little or no regard for the languages and using the lowest common denominator and most of the time making fun of local tradtions. How many time one sees the use of proper Hindi (forget sanskrit) by comedian(again mostly having no regards for the local language) for creating laugh viz vs use of urdu for songs or even other stuff (becuase screenplays were written by non hindi/local language folks). It is simply made unfashionable and laughable (compare this to the spelling bee contest or use of proper language in other parts of the world). Me Fanatical – no no yet – just annoyed – see even now I have apologetic tone. why that need should be? )

Have time ?

Read a great piece of writing by Arun Shourie. The attempts of missionaries to dump everybody else as animalistic and need to be “saved”. If the paths are different – let them be. But don’t come in to “tout” the horn and save others. They will be saved, who are you to save anyone?

Mosques of India (Hindustan ki masjiden) (via Maulana Hakim Sayed Abdul Hai ‘s translation) , guess what were they built on or using what materials were they built? Yeah apologist secularists of the infamous kind will come around to talk about fratericide and duels between Chalukyas and others or native rulers. Point is most of them rebuilt grander temples but not replaced it with another foreign religion icon. Puhlease leave to your favourite middle east destination or the evangelical land now to get salvation or freedom you crave for. Sad thing to see was that this was all known and documented but susbstituted in English edition of the book.

For all the apologetic secularists and hideous communists this comment from AS should suffice

“Or M.F. Husain. He is a kindly man, and a prodigiously productive artist. There is no warrant at all for disrupting all his exhibitions. I am on the point of sensibilities. His depictions of Hindu goddesses have been in the news: he has painted them in less than skimpy attire. I particularly remember one in which Sita is riding Hanuman’s stiffened tail — of course, she is scarcely clad, but that is the least of it: you need no imagination at all to see what she is rubbing up against that stiffened tail. Well, in the case of an artist, that is just inspiration, say the secularists. OK. The question that arises then is: How come in the seventy-five years Husain has been painting, he has not once felt inspired, not once, to paint the face of the Prophet? It doesn’t have to be in the style in which he has painted the Hindu goddesses. Why not the most beautiful, the most radiant and luminous face that he can imagine? How come he has never felt inspired to paint women revered in Islam, or in his own family, in the same style as the one that propelled his inspiration in regard to Hindu goddesses?”

Offcourse the few european  countries allow the expression of freedom where Gods(of either kind) were painted on the undergarments or burnt or dealt in any other way so as to destabilize, shock the majority of believers. Rememeber the head gear controversy, use of madonna, Ganesha or other gods on undergarments/toilet seats etc.  The challenge is in the world where the faith is part of everything in place like India. Europe still does not like “its” religious icons destabilized or the latest controversy about the dutch film on Islam. But this will continue…