Category: Ruby


While reading one of Daniel Hoelbling‘s great posts I noticed a strong warning he makes saying: The GAC is your enemy!

I fully understand his point, that its a PITA at the least to have to hunt down dependencies that others have installed in their GAC. But I also can’t help thinking that installing something to the GAC is very much like adding a Gem in Ruby.

So why is this lavish disregard for what other team members may (or may not) have installed on their machines acceptable in Ruby world?

In Ruby if I have a missing Gem reference then all I need to is pop open a command line and type “Gem install xxxx” and hey presto I have the dependency installed. Couple this with the fact that Rails brings some Rake tasks to the table to allow all a projects missing Gems to be installed at once by executing “rake gems:install”.

Now don’g get me wrong, I’m fully aware that there are many other reasons not to install to the GAC, but I don’t see why Ruby manages to side step a lot of these issues. This is generally a question to anyone reading this post, what does the Gem framework do to counter versioning issues and updates to shared libraries?

HornGet: Apt-Get for .NET

A quick search on the web leads me to HornGet a great project that allows “apt-get” type scenario for .NET applications via a command like “horn -install:rhino“. Horn will not do any GAC installation, instead it will build the latest versions of your libs and add them to a specified location (defaults to user profile directory).

This is a great project as far as I am concerned, as just trying to hunt down the latest versions of common 3rd party libraries can be painful. I think that .Less is defiantly going to be added to horn.

Advertisements

Playing with PEGs

Im now part way through the Less CSS port and i am getting close to porting the core libary for programatically building the Less nodes that are evauated to create CSS. This now seems like a good time to look at the parsing element of the project.  Less originally uses a TreeTop as its parser libary, which I gather is a really powerful PEG/PackRat parser.  Now it should be said at this point that I know even less about parsing theory than I do about Ruby (why did I start this!).

My first steps here are to find out what the darn tootin’ a PEG parser is and see what C# had to offer. After a few hours hunting the bad news is that the .NET world has very little to compete with TreeTop although I did find a very detailed article about PEG parsers with a little implementation of one.  After downloading the code I can see that this is more than a “little implementation”, there has been a hell of a lot of work done on this project and it looks promising for a TT alternitive.

One day in the not too distant past I took on the unwise decision to attempt port a Ruby application to C#. The decision was unwise primarily due to the fact that I have probably wrote less than 20 lines of Ruby code in my life! But I wasn’t about to let a little thing like not understanding a programming language stop me, after all code is code!!

Now, I’m still currently about 3 weeks into this port (minus the time to fix hard drive failure) and I have to say I’m still quite a way from completing it. The application in question is Less, which is a great little parser that allows CSS type syntax with niceties such as variables, mixins and nested rules.

The source for Less is open source and freely avaliable from github, so there should be no problem porting it right? Well that’s what I thought too, but the interesting thing about Ruby is that it is a very free and dynamic language that allows the definition of what an object “is” to be determined at build and runtime. It does this through a variety of techniques the most impressive one is the use of mixins.

Mixins are a clever way to inject code from a module into a class without having to bring multiple inheritance to the table. This type of thing can only be achieved in C# with clever use of proxy classes, possibly using Castle Windsors IoC continer. Fortunately the structure of Less was such that I haven’t thus far had to go down this route, but it sure didn’t make it too much fun to understand what was going on intially.