Chris Donnan : Programming - Brooklyn Style
software, trading, family, fun
Posted programming on Friday, August 10th, 2007.
Continuing thoughts from yesterdays Thoughts from Maine - user experience, ruby, python and more . . .
Another bit from Coopers writing is that idioms are more powerful than metaphors when it comes to user experience. Metaphors usually go too far - and wind up being too much a stretch. They are also inflexible inasmuch as you can never add something totally novel to that metaphor in software if the real thing does not behave that way.
A big part of rails, and I would even say the rubyist community feel is the idiom theme - (ala rails convention over configuration). Just look at what Google has to say on Ruby Idioms.
My insight here is simply that ruby is good user experience for programmers. Based on several “Cooper-isms” - idioms over metaphors, little excise to get in your way, things like metaprogramming seem to be goal oriented inasmuch as they are about doing what a programmer needs to do - and taking away the grunt work…
But what about my real projects!!!
I will say that I do not seem to be the primary persona they developed ruby for… I LOVE the language and think it is empowering. I am aslo a tester - I believe in and practice TDD - so the dynamic language thing works for me. That being said - there is literally no way for me to build trader desktop applications with ruby, real time messaging, true multi-threading, GUI polish - high speed grid views etc… Perhaps someday…
JRubyÂ
I am thinking about a few JRuby things I could do that would be valueable - replacing spring configs with ruby - it will be shorter. Replacing other XML based stuff with ruby seems the easiest win and place to start. When people see that programming in ruby is better than XML - it will be easy to convert them…
Dependency Injection in Ruby (and other dynamic languages)
… This is totally not related - except inasmuch as I care about ruby and DI….
There is an interesting meme going around the web… Jim Weirich issued a challenge to describe dependency injection in once sentence. Here are some good ones:
How about: “Dependency Injection” seemed an amazing insight to people who had finally learned what constructor arguments were for. JimWeirich Â
Dependency Injection enables a vitally important but nevertheless weak, limited, syntactically confounding, and dauntingly complex form of one of the kinds of meta-programming that should exist in the language. (from here)
Dependency injection is a palliative for environments that unnecessarily couple creation, lookup, and interaction between collaborators. (from here)
[DI isn't needed] primarily because the entire Ruby object space is one big DI container, and you inject dependencies by taking advantage of it. from here
Read this when you can - Dependency Injection: Vitally Important or Totally Irrelevant? - I will sum it up - great topic and thoughts here. The gist is that in ruby - you usually do not need DI -but in a statically typed language (java, C#) - you must use it. It goes on to conclude that most ruby projects are still small - and that the larger your projects get - the more they would benefit from DI - yes -even ruby needs DI when the projects get bigger and bigger. In ruby - you can really replace dependencies, mock out methods, etc much easier - and this is much of why you need DI in java/ C#. Also - since ruby is duck typed - you do not need to bind to any concretion - if the class passed in has the methods you need - then it is good enough. In a statically typed language - you need lotsa extra code for the separate interfaces/ implementations, etc.
More good reading here. The basic idea is that in ruby - you usually do not need DI - but in statically typed languages - you do. So - until I can use ruby to build an enterprise class trading application - I will be in DI land. I will STILL be trying to find places I can use ruby because I think it can add business value since I will be able to work with less code…
Comment on this post below
You must be logged in to post a comment.
You can leave a response, or trackback from your own site.















