Software development industry analysis by Larry O'Brien, the former editor of Software Development and Computer Language
Monday, January 29, 2007

In order to provide Intellisense for Ruby, a language that does not have explicit typing, Ruby In Steel turns to type inference. The built-in inferencing can be aided by adding type assertions to a function, for instance:

#:return: => nil
#:arg: c => String
def Bar(c)
@field = c
   puts @field
end

The type assertion block can be automatically added by typing "##" in the line above the function/method declaration (it fills in the type with "Object" to start). I'm a proponent of explicit typing in non-trivial projects so this is potentially a big deal to me. What I need, though (consider this a feature request, SapphireSteel) is some form of FxCop-like reporting / enforcement of type assertion "coverage."

That is, I would like to enforce a business rule "Ruby programs longer than 500 lines must have type assertions on all functions." To me, this would be a win-win: you can develop as fast-and-loose as you want, but if you want to check code into a team project, you have to add type information (which, in my mind, is extremely important to the dominant task of understanding code).

To be sure, in my experience the "DocComments" facility in VS/C# (typing "///" triggers a documentation block for the parameters) is widely ignored and FxCop enforcement is resented, but I think documenting parameters in a strongly typed language often seems gratuitous ("string firstName: a string representing the first name" and so forth), while I think everyone admits that type information is helpful for comprehension.

Monday, January 29, 2007 10:36:37 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | #
Search
About Larry...
Flickr photostream
Subscribe: RSS 2.0 Atom 1.0
Popular Articles
Programming Sabre with Java, C#, and XML
Genetic Programming in C#
15 Exercises To Know A Programming Language
Top 10 Things I've Learned About Computers From the Movies and Any Episode of "24"
Recently Published Articles
HI
KonaKoder
Categories
Archive
Admin Login
Sign In
Toolroll