Loading ...
Sorry, an error occurred while loading the content.

about no-arg constructor

Expand Messages
  • Qingtian Wang
    Hi- I am an XP newbie. I ve a question about no-arg constructors in Java. To do test (whether first or later), I often find it convenient to have a no-arg
    Message 1 of 127 , Jul 14, 2005
    • 0 Attachment
      Hi-

      I am an XP newbie. I've a question about no-arg constructors in Java.

      To do test (whether first or later), I often find it convenient to
      have a no-arg constructor for a class - such that I can extend the
      class to make a fake impl, and use the fake one to test classes that
      use the fake impl.

      At times, I find the class being faked is really better off without a
      no-arg constructor: ex. an object of that class may not have any real
      use in the application unless you pass in some specific init data as
      args when constructing it.

      From the biz logic point of view, I want to inforce the way the object
      is created, and really don't want to have a no-arg constructor. But
      often times I found myself writing a no-arg constructor just for the
      sake of test convinence. And I don't feel confortable about that.

      Do I have a reason to be concerned about this?

      Thanks,
      Qingtian
    • Kent Beck
      Chris, The concept you are refering to below sounds like blame, not accountability. Whether I accept someone else s blame partly depends on whether I ve given
      Message 127 of 127 , Aug 1, 2005
      • 0 Attachment
        Chris,

        The concept you are refering to below sounds like blame, not accountability.
        Whether I accept someone else's blame partly depends on whether I've given a
        whole-hearted effort to the task. If I have, I find it easier to see
        attempts at blame as not saying something about me.

        The OP was asked to provide coverage metrics for his code. I think if I was
        comfortable with my testing efforts, I would just report my coverage. If my
        manager told me 80% just wasn't good enough, that could be the start of a
        valuable conversation.

        Sincerely yours,

        Kent Beck
        Three Rivers Institute

        > -----Original Message-----
        > From: extremeprogramming@yahoogroups.com
        > [mailto:extremeprogramming@yahoogroups.com] On Behalf Of Chris Hanson
        > Sent: Wednesday, July 20, 2005 10:51 PM
        > To: extremeprogramming@yahoogroups.com
        > Subject: Re: [XP] Is "skip the test" ever an option in XP?
        > (was: about no-arg constructor)
        >
        >
        > On Jul 20, 2005, at 1:03 AM, Kent Beck wrote:
        >
        > > I asked that question because in my own experience if I try to
        > > wiggle out of
        > > reporting some metric, it is generally because I am not
        > comfortable
        > > with the
        > > underlying factor the metric is trying to measure.
        >
        > Sometimes people aren't comfortable with things for external
        > reasons. We may have done our best, and be comfortable with the
        > result, but may have a management culture that likes to beat people
        > up over a metric-of-the-week.
        >
        > When you're dealing with a pathological organization,
        > "accountability" is not used to build mutual trust or respect. It's
        > used to enforce a position in a hierarchy, or at the least as a way
        > to try and browbeat more time or work out of developers.
        >
        > There are way, way too many pathological organizations out there.
        >
        > -- Chris
        >
        >
        >
        > To Post a message, send it to: extremeprogramming@...
        >
        > To Unsubscribe, send a blank message to:
        > extremeprogramming-unsubscribe@...
        >
        > ad-free courtesy of objectmentor.com
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.