in reply to Re^9: OO automatic accessor generation
in thread OO automatic accessor generation

The idea that you can unit test all possible inputs and all the possible permutations of their internal interactions, and that this is enough to ensure proper type usage, is just naive.

No! I'm not.

I'm saying that if the input types to an algorithm are both type-checked & range-checked, then the ranges and types of the outputs will be consistant. There is no need to re-check those derived types and ranges. There is no need to check all possible permutations, only the boundary conditions--and thats a given.

A challenge: Demonstrate otherwise?

It makes the assumption that the design will be frozen and especially in a language like Perl where a simple bit of anti-social code like *{BrowserUK::ClassFullOfAwesome::tested_method} = sub { ... } is possible, that is a bad assumption.

You are suggesting that you need to protect against the possibility that someone will make modifications to production code to override methods at runtime. Why? So that you can tell them what they did wrong.

I guess our undestanding of what constitutes "production code" varies.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)
  • Comment on Re^10: OO automatic accessor generation

Replies are listed 'Best First'.
Re^11: OO automatic accessor generation
by stvn (Monsignor) on Nov 13, 2009 at 05:12 UTC
    I'm saying that if the input types to an algorithm are both type-checked & range-checked, then the ranges and types of the outputs will be consistant. There is no need to re-check those derived types and ranges. There is no need to check all possible permutations, only the boundary conditions--and thats a given.

    We are (as usual) arguing past one another and talking about different things. Not worth trying to explain, suffice to say that I do not agree that removing checks at runtime is a good idea, no matter how many unit tests you have. Honestly, I rarely find myself writing code that can be tested in this way, most of my $work code is all messy with humanity and is not as clean as yours seems to be.

    A challenge: Demonstrate otherwise?

    No thanks, I have better things to do. Like I said, we are talking past one another anyway and clearly not speaking about the same things (which seems to be a pattern too, *sigh*)

    You are suggesting that you need to protect against the possibility that someone will make modifications to production code to override methods at runtime. Why? So that you can tell them what they did wrong.

    Nah, I was just using that as an extreme example, there is plenty of other stupid things that can be done in between here and there that would still break the assumptions I am talking about (but which are different from the ones your talking about since we are never on the same page here anyway).

    I guess our undestanding of what constitutes "production code" varies.

    No doubt, but does this really surprise you? At $work we maintain systems for a long time, constantly adding new data and features, fixing bugs, etc etc etc. Don't get me wrong, our production systems are solid and we have the customers to prove it, but I believe that code in todays world has to be fluid and flexible, able to adapt in the ever changing business landscape. And while I believe strongly in testing my software, I don't lean too heavily on that. Bugs happen, ARE YOU PREPARED!!! I know I am, because I have 30 quadrillion type checks in my poorly written OO ready to chew up all remaining disk space in one GIANT MONSTER of a stack trace!

    -stvn
      we are talking past one another anyway and clearly not speaking about the same things (which seems to be a pattern too, *sigh*)

      Shame! I do try very hard to write clearly; and to ask questions and/or paraphrase you, in the hope of getting us on the same page.

      ARE YOU PREPARED!!! I know I am, because I have 30 quadrillion type checks

      But if half of them are duplicates, is 15 quadrillion enough? And is their overhead totally inconsequential?

      one GIANT MONSTER of a stack trace!

      Hm. And there was me thinking that $Carp::verbose = 1; would give you that.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.