Comparing the Ruby and .NET ecosystems
November 26, 2009
Posted by on
I mentioned in my previous post that I believed much of the backlash against TDD is more technical in nature than many in the .NET developer community have realized. This post is to expand on that thought a bit further.
Many of the issues that .NET Developers have around doing TDD in C# is the requirement of using a large number of Interfaces around dependencies to make classes more testable. Writing your code this way requires practice, discipline, and most importantly, the appropriate tools.
I’ve long since reached the conclusion that the out of the box developer tools provided by Microsoft are wholly inadequate to using a Test First methodology. MSTest has always been a weaker alternative than NUnit, despite having nearly 5 years to catch up. Visual Studio still does not provide enough refactoring support, code navigation, or targeted code generation without an add-in like Resharper or CodeRush. Truly understanding TDD requires a mastery of these tools and others like Rhino Mocks and StructureMap.
Recently I’ve taken it upon myself to relearn Ruby on Rails after a long hiatus. Juxtaposing the Ruby ecosystem against the .NET ecosystem has been eye opening. For one thing, as a dynamic language, many of the technical barriers of doing TDD don’t exist in Ruby. Mocking and Dependency Injection have little to no value in Ruby as neither one is required to unit test your code. On the flip side, common compile time errors in a static language like C# can become runtime errors in a dynamic language like Ruby. The frequency and potential for these kinds of errors makes unit testing no longer optional when coding in Ruby.
Also, the Ruby community uses surprisingly few developer tools. Most Ruby developers use the most basic of text editors like VIM and TextMate to write their code. They do use a lot of libraries (or gems as they call them), but most of these are free and open source. Not having a corporate leader like Sun or Microsoft has forced the community to be far more self sufficient and create their own ecosystem. It is also evident that all of the thought leaders have also made significant open source contributions.
The .NET community has made strides in the same direction, as many of the new leaders at Microsoft like Phil Haack and Scott Hanselman came from the developer community and have made significant open source contributions. However, I believe the core technical issues that surround a statically typed language will only continue to hurt the platform’s growth. Ruby and Python will only continue to make gains in performance and productivity. Eventually Microsoft will have to respond with a suitable dynamic language. This may be coming sooner than expected based on John Lam’s departure from IronRuby to form a new team that is working on a new secret project.