Roger A. wrote:
in a typed language with decent intellisense I can see what types Im
supposed to pass in and what I get back.
You can still have decent IntelliSense with Ruby. Take a look
http://www.sapphiresteel.com/
best wishes
Huw
SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com
Also, I’m not here to run a war about static VS dynamic typing.
I do know how both works.
What I was asking was how you were dealing with the potential problems
associated with dynamic typing.
And replying with exaggerations and metaphors to 6 y/o olds isn’t
exactly answering the questions in a constructive way, rather making you
look like you are defensive when someone is questioning the sanity of
what you do…
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Roger A. wrote:
| Also, I’m not here to run a war about static VS dynamic typing.
| I do know how both works.
|
| What I was asking was how you were dealing with the potential problems
| associated with dynamic typing.
In a sane way: Once the potential gets realized, the code gets adjusted.
Or do you guard against XSS when your application isn’t supposed to be
on the web right now, or when the issue actually arises?
How this adjustment is done depends on the code in question.
Phillip G.
Twitter: twitter.com/cynicalryan
Blog: http://justarubyist.blogspot.com
~ The purpose of writing is to inflate weak ideas, obscure pure
reasoning, and
inhibit clarity. With a little practice, writing can be an intimidating
and
impenetrable fog! – Calvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgwgnkACgkQbtAgaoJTgL/8sQCfZNTWQQmjTCEOPXHqZuAr3IWm
6aIAoJuLlGZW5GDn3QSEa2S0W7zsOK51
=FNd9
-----END PGP SIGNATURE-----
In a sane way: Once the potential gets realized, the code gets adjusted.
Or do you guard against XSS when your application isn’t supposed to be
Absolutely, I’m all with you on that one.
BUT:
The chance that others than yourself will be interacting with your code
is fairly big if you do anything else than hobby coding for your self.
Thus, preventing others from messing up is good practice in pretty much
every case.
I’m not sure what to say beyond what has been said.
Lots of people are able to deal with duck typing without particularly
finding it harmful. If you are starting a Ruby project that is going to
require multiple people working with your code, then they are going to
be used to this style of coding anyway; they won’t have a problem with
it. They know about documentation. They know about unit tests. These are
things that you are probably doing in your compile-time-type-checked
languages anyway; you aren’t losing a bunch of time with that.
Do you lose some safety? Sure. Is it within an acceptable margin for the
benefit in agility? Many people think so.
I think the overall point people have been trying to make, is please
don’t go trying to check all of your types all of the time, via is_a? or
kind_of? checks all over the place (i.e. don’t write Ruby like C#). If
it bugs you that much, well, the other languages with type checking
exist for a reason!
Again, it’s really a matter of trying it. If you find yourself getting
bitten by it, don’t use it. And yes, weigh this before starting some
sort of gigantic expensive project.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Roger A. wrote:
|> In a sane way: Once the potential gets realized, the code gets adjusted.
|>
|> Or do you guard against XSS when your application isn’t supposed to be
|
| Absolutely, I’m all with you on that one.
|
| BUT:
|
| The chance that others than yourself will be interacting with your code
| is fairly big if you do anything else than hobby coding for your self.
Call me naive, but I think that developers are able to read
documentation, unit-tests and example code.
| Thus, preventing others from messing up is good practice in pretty much
| every case.
Oh no, I cannot anticipate every kind of error somebody might make, nor
every environment my code’s being used. If it is a genuine bug or
misbehaving feature, I accept patches (or fix it myself).
While some sanity checks on data are certainly a Good Thing, going over
board doesn’t help.
I mean: feeding hpricot something else than HTML or XML isn’t hpricot’s
problem, but the users problem. Of course hpricot should be so
courteous to throw an exception if it gets data it cannot process.
Phillip G.
Twitter: twitter.com/cynicalryan
Blog: http://justarubyist.blogspot.com
~ - You know you’ve been hacking too long when…
…you want to wash your hair and think: awk -F"/neck" ‘{ print $1 }’ |
shower
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgxIrwACgkQbtAgaoJTgL+HDQCgi3G5TVmAkIyibwVdfhCH587g
sWMAnjZEm7xuk0ZkbsVhB8hKPeIHbGBj
=OQqz
-----END PGP SIGNATURE-----
On 16 May, 19:45, Roger A. [email protected] wrote:
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?
<>
So can someone try to convert me or am I forever lost?
Posted viahttp://www.ruby-forum.com/.
Two blog posts that might help:
http://jessenoller.com/2007/05/30/typeducking-on-duck-vs-static-typing/
Go deh!: Duck Typing Done Right Is Wrong!