Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11194

Re: Best Way to Pass Info Between Objects?

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: Best Way to Pass Info Between Objects?
References (3 earlier) <54qdnTd-nYZBj5fSnZ2dnUVZ_q2dnZ2d@earthlink.com> <jed608$j13$2@localhost.localdomain> <qMudnaJsDvKGsJfSnZ2dnUVZ_s-dnZ2d@earthlink.com> <%ozOq.43065$aW6.17493@newsfe09.iad> <jehir9$vk$1@news.albasani.net>
Message-ID <9C3Pq.8545$wy.3300@newsfe21.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2012-01-10 19:13 -0400

Show all headers | View raw


On 12-01-10 10:43 AM, Lew wrote:
> Arved Sandstrom wrote:
>> I will also point out, neutrally, that what has been advocated here for
>> unit tests in support of software component design is test driven
>> development (TDD), or *close to it*. Lew and Martin both describe a
>> process very close to it; I don't have enough information to say whether
>> they are _requiring_ that all of the first tests fail (which is
>> necessary in classic TDD), or simply assuming that many/most will.
> 
> When you write that up-front test and keep it simple, you don't have to
> run the test to know it'll fail initially.
> 
> I, too, write implementation before the unit test.  Or did.  I've
> learned that unit tests save effort and eliminate bugs, the more so
> earlier you write them, up to concurrently with implementation.
> 
> Covering your code with unit tests, you are freed of doubt whether
> you're free of unit-level bugs.  (Ducking tomatoes.  Hey, don't get mad
> at me if you wrote insufficient unit tests.  Fix them.)
> 
> I'm working on assimilating this lesson properly myself.  New habits
> displace ingrained patterns only by dint of diligence.  My
> transformation is helped by how little overhead a test-propelled
> approach introduces, and how much faster and better development goes.

I'm cool with the idea of getting unit tests in there early. I'm not too
concerned with writing them first, but when I get the chance to write
them, I try to have unit tests in place immediately after a method that
rates being tested.

Note the "get the chance to write them at all". 90 percent of the code I
write is bespoke stuff, usually done on-site. While there is generally
tolerance for some decent level of testing prior to UAT, clients tend to
heavily favour system and integration and functional testing over unit
tests. There are a bunch of reasons why clients think that way, some of
them justified, and some of the clients who do have a bias against unit
tests have experience with them.

I'm not being judgmental when I point this out, it's simply a fact of my
work environment. It's not a universal client attitude but I believe it
to be a common one. And it's entirely possible to work with clients who
are enthusiastic about functional and higher tests, but go so far as to
forbid unit tests. I've worked with such.

>> In any case the OP could read up on TDD to get more background on what's
>> being described here. A salient point is that these are unit tests that
>> support software component design; they are not unit tests for defect
>> detection [1].
>>
> ...
>> 1. And how much of one's time one should devote to writing unit tests
>> for _testing_, as opposed to higher-level tests, is a different
>> discussion.
> 
> Would you expound on this distinction, please?  I've heard a lot of
> distinctions drawn around tests and unit tests in particular, but never
> this.
[ SNIP ]

It's pretty simple, you've usually got limited time for all testing
activities, much less than you'd like and less than you need. Your
project has X days for unit tests, functional tests, integration tests,
system tests, load tests and acceptance tests. Acceptance tests usually
get a fixed, adequate amount of time. System tests and load tests also
usually get fixed, almost adequate blocks of time. Everything else has
to fight for budget, so of unit or functional or integration testing,
where do you get the most bang for the buck?

I have my own thoughts on the latter, but that's not relevant in
answering your question. I am merely pointing out that in the real world
you almost always have to sacrifice some forms of tests.

AHS
-- 
...wherever the people are well informed they can be trusted with their
own government...
-- Thomas Jefferson, 1789

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Best Way to Pass Info Between Objects? Novice <novice@example..com> - 2012-01-08 16:41 +0000
  Re: Best Way to Pass Info Between Objects? Patricia Shanahan <pats@acm.org> - 2012-01-08 09:08 -0800
    Re: Best Way to Pass Info Between Objects? Novice <novice@example..com> - 2012-01-08 18:22 +0000
      Re: Best Way to Pass Info Between Objects? markspace <-@.> - 2012-01-08 10:45 -0800
      Re: Best Way to Pass Info Between Objects? Lew <noone@lewscanon.com> - 2012-01-08 11:49 -0800
      Re: Best Way to Pass Info Between Objects? Patricia Shanahan <pats@acm.org> - 2012-01-08 14:04 -0800
        Re: Best Way to Pass Info Between Objects? Martin Gregorie <martin@address-in-sig.invalid> - 2012-01-08 22:40 +0000
          Re: Best Way to Pass Info Between Objects? Patricia Shanahan <pats@acm.org> - 2012-01-08 15:56 -0800
            Re: Best Way to Pass Info Between Objects? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-09 06:34 -0400
              Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 12:39 -0500
                Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 12:42 -0500
                Re: Best Way to Pass Info Between Objects? Lew <lewbloch@gmail.com> - 2012-01-09 13:43 -0800
                Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 17:26 -0500
                Re: Best Way to Pass Info Between Objects? Lew <noone@lewscanon.com> - 2012-01-10 06:47 -0800
                Re: Best Way to Pass Info Between Objects? Patricia Shanahan <pats@acm.org> - 2012-01-09 14:26 -0800
                Re: Best Way to Pass Info Between Objects? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-09 19:06 -0400
                Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 18:46 -0500
                Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 19:52 -0500
                Re: Best Way to Pass Info Between Objects? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-10 06:43 -0400
              Re: Best Way to Pass Info Between Objects? Martin Gregorie <martin@address-in-sig.invalid> - 2012-01-10 02:11 +0000
              Re: Best Way to Pass Info Between Objects? Gene Wirchenko <genew@ocis.net> - 2012-01-09 20:17 -0800
              Re: Best Way to Pass Info Between Objects? Lew <noone@lewscanon.com> - 2012-01-10 06:43 -0800
                Re: Best Way to Pass Info Between Objects? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-10 19:13 -0400
      Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 14:30 -0500
        Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-09 17:28 -0500
          Re: Best Way to Pass Info Between Objects? Martin Gregorie <martin@address-in-sig.invalid> - 2012-01-10 02:24 +0000
            Re: Best Way to Pass Info Between Objects? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-10 06:35 -0400
              Re: Best Way to Pass Info Between Objects? Martin Gregorie <martin@address-in-sig.invalid> - 2012-01-10 22:48 +0000
  Re: Best Way to Pass Info Between Objects? v_borchert@despammed.com (Volker Borchert) - 2012-01-08 17:17 +0000
  Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-08 13:43 -0500
    Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-08 19:01 -0500
  Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-08 14:10 -0500
    Re: Best Way to Pass Info Between Objects? Jeff Higgins <jeff@invalid.invalid> - 2012-01-08 14:41 -0500
  Re: Best Way to Pass Info Between Objects? Roedy Green <see_website@mindprod.com.invalid> - 2012-01-09 04:13 -0800

csiph-web