Re: Struct is slow
- From: "Robert Dober" <robert.dober@xxxxxxxxx>
- Date: Thu, 25 Oct 2007 05:36:30 +0900
On 10/24/07, Rick DeNatale <rick.denatale@xxxxxxxxx> wrote:
On 10/24/07, Robert Dober <robert.dober@xxxxxxxxx> wrote:looking forward to it
On 10/24/07, Rick DeNatale <rick.denatale@xxxxxxxxx> wrote:Paraphrasing, you should test before you optimize, and use tdd/bdd.
I usually find that it really doesn't matter how fast things run ifFunny you say that Rick, because I was thinking about the role testing
they produce the wrong results.
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?
I should, and probably will eventually, answer this more fully on my
blog,
but off the top of my headWell better give an example, let us assume I want to write a package
1) I'm not sure what you mean by the second type of test suite. I
don't think you're talking about putting test assertions into the
code. If you're not I'm not sure I see the real distinction
that does err, what, no idea, just translation, than I would do
TDD/BDD somehow like follows, sorry I am not fluent in rspec but I
will just use something similar.
"Vive la France".shall.translate.to "Viva Italia"
"Je ne suis pas disponible".shall.translate.to "Gone fishing"
Now that is normally considered enough. But for my personal comfort
and anticipating problems and bugs inside my great plan of
implementation - experience speaking ;). I will add some tests very
closely related to the implementation. You see, something totally
opposed to the BDD thing.
E.g.
assert_kind_of? Enumeration, my_thingy.instance_variable_get("@words")
but better would be duck type tests
assert_respond_to? :each, my_thing.....
assert [:each, :map, :size] <= my_thingy.ivarget("@words").methods
The trick would be to identify some few strategic test points to get
alarmed about any
misconception or coding error.
I believe it too but less firmely.
2) That said, I firmly believe that tests belong outside of the code
under test.
We talked about this some time ago when Trans asked forTrue but, I find Trans' tests rather instructive and he does not
opinions of the inplace tests in facets. I distinguish between
instrumentation and test equipment. Instrumentation is writing code
to be testable, but the 'bulky' test equipment doesn't weigh down the
F1 car being tested.
really want a F1 car, but generally I agree with you. Libraries like
Factes and Labrador are somehow different because they are so
reflective and code pretty well describes what their code does.
Here again I am with you, even instrumentation is a pain I guess and
3) The chicken typing, I recently wrote about (and I like the term the
more I use it) is just that, weighing down the car unnecessarily. If
the code will fail it's going to fail with or without the chicken
tests, and usually in a way that the chicken tests fail to anticipate.
that is why these microtests would be almost an exercise in
metaprogramming, I guess you would know some Smalltalk stories about
that.
The idea would be to identify stratigic points where being chicken
makes the duck more confident elswhere.
But not sure at all if that might work!
Furthermore, introducing the chicken tests introduce additional waysHere I am losing you, should we not test because of the fear of false positives?
for the code to fail unnecessarily when the chicken tests report false
positives.
I guess it does for me
4) Getting back to the distinction between two types of test suite.
Personally, the attitude and approach to testing is much more
important than Sapir-Worff considerations, syntax, and whether you
call it TDD or BDD or call them tests or specs. IMHO BDD is a sect of
the main test-first religion, and things like RSpec are kind of like
fancy exercise equipment. If it helps you acquire the proper attitude
towards test first design that's great.
To my mind, when I've lookedthat was true when I tested Rspec about 1.5 years ago, is it still?
at the bdd tools, although the have some nice ancillary features, I've
sensed that they are a little too intrusive
on the code under test forErr how did you know? ;)
my taste, so I'd rather just use 'free weights' such as Test::Unit and
discipline.
Just like exercise equipment, neither does much good if you just use
it for a clothes rack! <G>
R.
--
what do I think about Ruby?
http://ruby-smalltalk.blogspot.com/
.
- Follow-Ups:
- Re: Struct is slow
- From: Jay Levitt
- Re: Struct is slow
- References:
- Re: Struct is slow
- From: Robert Klemme
- Re: Struct is slow
- From: Sylvain Joyeux
- Re: Struct is slow
- From: Joel VanderWerf
- Re: Struct is slow
- From: Robert Klemme
- Re: Struct is slow
- From: Rick DeNatale
- Re: Struct is slow
- From: Wayne Magor
- Re: Struct is slow
- From: Rick DeNatale
- Re: Struct is slow
- From: Robert Dober
- Re: Struct is slow
- From: Rick DeNatale
- Re: Struct is slow
- Prev by Date: Re: [ANN] main-2.2.0
- Next by Date: Re: string method that takes in a regex
- Previous by thread: Re: Testing Philosophies [was Re: Struct is slow]
- Next by thread: Re: Struct is slow
- Index(es):