Re: Struct is slow



On 10/24/07, Rick DeNatale <rick.denatale@xxxxxxxxx> wrote:


This is one example where strong typing could have made a difference.
Had the array been declared as an array of arrays or array of structs,
perhaps another language could have detected the error. I'm not
advocating for strongly typed languages, I'm just saying that some kinds
of errors could be harder to find in Ruby. What do you folks think?

What would have made a bigger difference would be to develop that code
in the contest of specifications written as tests.

This would allow you to first concentrate on making the code do the
right thing before trying to optimize it.

I usually find that it really doesn't matter how fast things run if
they produce the wrong results.

Funny you say that Rick, because I was thinking about the role testing
should have in this.
I kind of ponder of writing two test suits for my projects, one which
clearly is BDD (shall be) and one that kind of replaces very defensive
programming style full of assertions.
Now this is indeed a dangerous road because one might fall
into the trap of implementing a straight jacket, killing the duck ;) etc.

I still believe however that such "microtests" can be a valuable tool
and might be
more useful to find some errors than debuggers, depending on the type
of error of course.
Any thoughts, experiences about/with that approach?

Cheers
Robert

--
what do I think about Ruby?
http://ruby-smalltalk.blogspot.com/

.



Relevant Pages

  • Re: Shorter/better way to do this?
    ... need these constructs because Ruby has dynamics arrays, ... into the array size domain of the "sieve" array, ... understand what 'sieve' is supposed to do. ... So, when p8 < lndx is true, then all the other pi are < lndx too. ...
    (comp.lang.forth)
  • Re: Shorter/better way to do this?
    ... need these constructs because Ruby has dynamics arrays, ... into the array size domain of the "sieve" array, ... understand what 'sieve' is supposed to do. ... So, when p8 < lndx is true, then all the other pi are < lndx too. ...
    (comp.lang.forth)
  • Re: A couple of questions from a Ruby neophyte
    ... Before I start: I've done most of what you need to do successfully with Ruby before, for a little while now, so the news is good :-) ... I've handled MySQL and Access connectivity before, and they're both easy to get working. ... item to the array MyArray). ... Ruby's arrays aren't quite as feature-packed as PHP's arrays, which are more like mutant hashes with strange super-powers. ...
    (comp.lang.ruby)
  • Re: SWIG typemap for ta-lib
    ... const double inReal ... outRealarray i think. ... In Ruby I like to use all input parameters as function parameters. ... int iStartIx = *arg6; ...
    (comp.lang.ruby)
  • Re: Challenge: reading ascii data
    ... to store all the data before producing any output. ... Here is a Ruby ... So I use hashes to create a two-level "sparse array", ... Well the original problem definition was: ...
    (comp.lang.fortran)