Since Rails is Â the most popular framework based on the Ruby language today, I appreciate what the Rails developer site has to say about “source style”:
- Two spaces, no tabs
- Don’t use “and” and “or” for boolean tests, instead always use “&&” and “| |”
- MyClass.my_method(my_arg) — not my_method( my_arg ) or my_method my_arg
- Follow the conventions you see used in the source already
Tabs in code areÂ cancerous to me (e.g. display versus printing fidelity woes), but I prefer three or four spaces to two, depending on the prevailing code base–three spaces if setting precedent (e.g. start of indented line following conditional such as “if (” lines up with the condition itself).
Digging a little deeper, I found the following pages worthwhile:
What do you use on your Ruby-related projects?
One of the concerns I had approaching Ruby was the apparent lack of an IDE. I see that Tim Bray expects there to be an IDE, too–among other things.
There appear to be several takes on the state of Ruby development environments. For example:
- Languages like Java and C# have a class of developers that depend on their tools such as IDEs (e.g. Bruce Tates’ assessment in From Java to Ruby: “C# programmers tend to lean on their tools a little harder than others”). Could it be that said developers depend on their tools to make themselves more productive? Answers from this camp tend to argue that the question is moot since Ruby is inherently more productive–why tax the developer’s mind with IDE semantics? (Tim Bray offers several excellent counter-points above to such a response.)
- Ruby as a dynamic language poses challenges for IDEs that prefer a static typing foundation (e.g. read the comments here)–again, this IDE thing is so over-rated.
- If you’re willing to marry Ruby with a JVM (JRuby) or marry Ruby with a CLR (e.g. this article references RubyCLR, Ruby.NET, IronRuby), then you may find your Java IDE or Visual Studio more palatable.
- Text editors like TextMate (MacOS) and Notepad++ (Windows) are good enough for Rubyists, especially when combined with tools like Rake. There is also ActiveState Komodo, or you can give RadRails a spin.
When I develop in C#, I leverage Microsoft Visual Studio. This is the IDE I’m most productive using currently probably due to the fact that I’ve used a version of Visual Studio more than any other IDE in my career thus far.
Since I’m embarking on this Ruby learning first on Windows, I will see how far I can get with Notepad++ initially. On my G5, I’ll probably leverage TextMate for starters.
Update: Later today I stumbled across the Simple Syntax Highlighting plugin for IntelliJ via Jay Fields’ blog and Daniel Lukic’s (plugin author) blog. I’m going to give this plugin a spin first since I have IntelliJ for both Windows and MacOS (i.e. leverage one familiar environment than two new ones).
As a software architect for EMC, I’m concerned with the global reach of what I build–employed technologies must supportÂ internationalization and subsequent localization in multi-byte locales (i.e. just supporting single-byte strings or Latin-1 locales is unacceptable). Per “How To Use Unicode Strings in Rails“: Rails currently defers its Unicode support to Ruby, which currently only supports single-byte strings.
So why even dip a toe into the Ruby/Rails pool?
First, Rails-based applications exist that support UTF-8. That isn’t to say that native support in Rails or Ruby is where it needs to be–it is not, yet–but rather to counter some of the hype you’ll find on the Web (i.e. there is none whatsoever). I appreciate Obie Fernandez’s InfoQ article on this important concern. As long as Unicode support isn’t robust and native, I have to give Ruby et al a ding in the non-essential complexity column. C# and Java fully support Unicode; Ruby needs to as well–the sooner the better.
Second, my focus on Ruby et al is to improve my software “thinking” in general. By complementing my C# and Java knowledge with Ruby, I hope to improve how I approach architecture, how I implement design, etc. Certainly this cuts both ways–C# and Java have things that Ruby could potentially benefit from adopting–but I believe that Ruby has concepts to offer me uniquely at present.
I’m reminded of Ajax as I approach Ruby, too. When I posted on “scrubbing bubbles,” I pointed out a set of concerns to combat Ajax-as-panacea hype. Some of those concerns have been or are being properly addressed by the community, while others still remain. I’m optimistic that Ruby’s issues like proper I18N support will be addressed by its community, too.
When I wrote my previous post, I had the following picture in mind:
Let’s say that the horizonal axis, x, represents the potential solution breadth provided byÂ a computer languages and its frameworks overall. Let’s say that the vertical axis, y, represents the essential complexity of said language/framework.
What I seek to better understand as I dive into Ruby, Rails, etc. is how its’ “x and y” compare to, for, example, .NET, ASP.NET, etc. Does it offer similar functional breadth in a less complex manner? Does it offer lesser solution capability with similar complexity? Does it offer a similar functionality:complexity ratio, just more or less of a good (or bad) thing?
If you have any thoughts to share along these lines, I’m all ears.