R
Roger Alsing
Hi,
I'm trying to get whats Ruby is all about.
I've been doing .NET since beta so I'm kind of stuck in the static typed
mindset.
The parts that I do get:
I love metaprogramming, I was able to make a port of my .NET AOP
framework that took about 3 months to do in .NET in a week in Ruby (w/o
ever touching ruby before.. )
I also understand that its nice with auto promotion of number types when
they would overflow in other languages.
What I don't get:
How do you deal with ducktyping?
How can anyone assume that just because a method exists that the
semantics is the same?
Brush.Draw( x , y )
vs
Cowboy.Draw( direction, speed )
The same name and signature, not even close to the same semantic
meaning.
Doesnt this put an extra burden on the developer, that he has to know
the exact intention of each and every method?
Where in a language that supports ifaces you simply know that the
methods associated with the interface have a certain meaning.
The backside of dynamic typing.
I got a mail from a newsgroup a few days ago with the title "we once
overflowed a long at google"
Ok ok, as I said, I get type promotion.
But what if you assign a "Giraffe" to a property called "Orders" , isnt
that just as bad or even worse than overflowing a number?
If someone say "that should be caught in a unit test" , well so should
the overflowed long (And Java and .NET can use big integers etc too if
you need)
And the thing that I have the hardest time with, how the heck do you
learn to use someone elses framework / api ?
in a typed language with decent intellisense I can see what types Im
supposed to pass in and what I get back.
One can often understand how to use an API by just looking at the
intellisense.
While I found myself browsing ruby docs back and forth just to see if
the result of a method would be a string or an object etc.
So can someone try to convert me or am I forever lost?
I'm trying to get whats Ruby is all about.
I've been doing .NET since beta so I'm kind of stuck in the static typed
mindset.
The parts that I do get:
I love metaprogramming, I was able to make a port of my .NET AOP
framework that took about 3 months to do in .NET in a week in Ruby (w/o
ever touching ruby before.. )
I also understand that its nice with auto promotion of number types when
they would overflow in other languages.
What I don't get:
How do you deal with ducktyping?
How can anyone assume that just because a method exists that the
semantics is the same?
Brush.Draw( x , y )
vs
Cowboy.Draw( direction, speed )
The same name and signature, not even close to the same semantic
meaning.
Doesnt this put an extra burden on the developer, that he has to know
the exact intention of each and every method?
Where in a language that supports ifaces you simply know that the
methods associated with the interface have a certain meaning.
The backside of dynamic typing.
I got a mail from a newsgroup a few days ago with the title "we once
overflowed a long at google"
Ok ok, as I said, I get type promotion.
But what if you assign a "Giraffe" to a property called "Orders" , isnt
that just as bad or even worse than overflowing a number?
If someone say "that should be caught in a unit test" , well so should
the overflowed long (And Java and .NET can use big integers etc too if
you need)
And the thing that I have the hardest time with, how the heck do you
learn to use someone elses framework / api ?
in a typed language with decent intellisense I can see what types Im
supposed to pass in and what I get back.
One can often understand how to use an API by just looking at the
intellisense.
While I found myself browsing ruby docs back and forth just to see if
the result of a method would be a string or an object etc.
So can someone try to convert me or am I forever lost?