In my previous blog, Go Away Ruby, Andy Oliver got a little upset with me in the comments section. In typical Andy style, he likes to strut the one thing he knows to show how much smarter he is than everybody else. His usual tactic is to state the one bug he found in an application to show how much the thing or the individual who wrote the thing sucks (to Andy, everything sucks) and how clever he was in finding this bug. Sounds like I dislike Andy, but I don’t. Andy is one of those rare people that know how to create an open source project, promote it successfully, and recruit talented volunteers to help him out. His mail project at Buni.org is a testament to this (cool stuff BTW, you should check it out).

Anyways, Andy had to go on a long rant on how clueless I was on Ruby. Maybe I am totally clueless, but I think he missed my point on what I disliked about Ruby and other languages like PHP, Perl, Tcl, VB, and Python. The last five of which I have written at least one project in. What I dislike is that these languages do not require type declaration in their syntax. Take this from the Ruby Language homepage:

 

# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end

  def salute
    puts "Hello @name"
  end
end

# Create a new object
g =Greeter.new("world")

# Output "Hello World!"
g.salute

I dislike the fact that the initialize method does not require a return type and that the parameters of the method declaration don’t require a type either. Also, the ‘g’ variable has no syntactically assigned type either. I just don’t see how the refactoring and code analysis tools that Intellij and Eclipse have for Java could ever be mirrored in Rubyland, or even Python, Perl, Tcl, VB, or PHP for that matter. Maybe Andy is married to his VI editor, but I just can’t go back to the days of having grep and sed as my sole refactoring tools.

I am guilty though of using incorrect vocabulary to define my beef with Ruby or Andy. I should not have used typeless or dynamic typing and stuck purely to type-safety. Maybe things are clearer now?

If dynamic typing sucks, JBoss AS must suck

In the Go Away Ruby comments Andy state that if I think dynamic typing sucks (I don’t), then in turn I must also think JBoss AS sucks. In Andy’s world, java.lang.Proxy and JBoss’s Invocation object are just a workaround for the lack of dynamic typing in Java. Dynamic typing, in my mind at least, means that type is assigned at runtime and can even by augmented at runtime. JBoss is not trying to provide dynamic typing for the user, we’re trying to take a statically typed interface that the user defines and tunnel it over a generic construct. We are neither assigning type at runtime, nor are we augmenting types at runtime. The JBoss interceptors do not care or even interact with the arguments or return type of a method invocation. Yes, the transport layer need to use Java Serialization to marshal and unmarshal these objects, but, last I heard, reflection != dynamic typing. Even if JBoss’s use of proxies fell under the Andy Oliver definition of dynamic typing our use of it still does not fall under my beef with Ruby and other dynamically typed languages that don’t require type declarations. Our use of these constructs does not prevent me from using any of the powerful tools available in Intellij and Eclipse for refactoring or analyzing JBoss’s code base.

JBoss AOP and dynamic typing

JBoss AOP does try to mimic some of the features of dynamically typed languages. Or, as Andy would say, it tries to work around the fact that Java isn’t dynamically typed. Specifically, introductions and mixins. It would be cool if Java made it easier for JBoss AOP to provide this type of feature. BUT….not at the expense of relaxing type safety.

Could care less about performance Andy

And, yo Andy, when did I ever say in my blog I didn’t like languages like Ruby because they weren’t compiled? I don’t align myself to any performance debate when comparing interpretted or JITed dynamically typed languages. The debate sounds too similar to the C++/C vs. Java junk that flew around in the late 90’s. In any database or networked application, any overhead Ruby et al. have will probably be negligible compared to DB access. CPU power is cheap anyways.

Why Groovy is different

Now, in my last statement in Go Away Ruby blog, I talked about pushing Groovy over Ruby. Groovy is cool because you can write pure type-safe Java and get the zero turnaround. You get much of the nice syntax sugar that the Ruby guys have. Here’s an idea, what if we strip down Groovy and pull out all the untype-safe (vocab again πŸ˜‰ ) things to get Dynamic Java?

Can I go back to my vacation?

Anyways, Andy now that you have proved how smart you are and what an idiot I am, can I go back to my vacation?