Kim Gräsman | 16 May 2013 09:59
Picon
Gravatar

Test kinds (was Presenter-first design)

I think terminology gets more useful it it's defined in context.

I read about Google's naming too, and one thing they focused on was
defining exactly what constitutes a smal/medium/large test, what
characteristics they have, what you can and can't to in terms of
dependencies, etc.

This year I'm going to go through our test stack internally and
produce guidelines for developers for when to pick what kind of test,
what relative pros/cons they have, what technologies they involve,
etc.

I'm consciously staying away from terms like "unit", "integration",
"system" and Google's sizing terms to find words that reflect our
architecture, which would hopefully make it more intuitive to devs
where a given test fits.

Here's to hoping everybody interprets my terms the same way :-)

- Kim

On Thu, May 16, 2013 at 1:23 AM, Steve Freeman <steve@...> wrote:
> Apparently Google talk in terms of Small (isolated, very fast), Medium
> (integration, touches some external resources), and Large (system-level).
> S.
>
> Sent from a device without a keyboard. Please excuse brevity, errors, and
> embarrassing autocorrections.
>
> On 15 May 2013, at 21:03, Rick Pingry <rpingry@...> wrote:
(Continue reading)

Johnny Smith | 4 May 2013 06:33
Picon

Presenter-first design

The GOOS book teaches me to start my software from the walking skeleton, making sure that we can deploy our software on day one. What are your thoughts about presenter-first design? I think that's a good approach too, starting from the top layer and work your way until you touch the system.

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Samuel Edwin | 3 May 2013 19:59
Picon

Do objects need to know the environment they are running on?

Hi guys, I'm new to TDD and teaching myself without anyone guiding me, so I need some help.


From what I've learned, an object should only know about itself and it's relation with its neighbors and not more. What I'm confused about is I think that an object should need to know a little about the running environment. For example, when implementing MVC pattern in controller, the controller should be stateless because it is recreated every time a request comes in, and we can run the computation in a single thread, because we don't need to worry about UI responsiveness like GUI applications. In GUI applications, we can save the states in the controller and we can't do the execution in a single thread because it could make the UI non responsive. These considerations could make great difference in my design, especially because of the threading problem.

When I'm writing a web MVC that is a single threaded environment, I could do it like this:

class Controller{
    public void doSomething(){
        //retrieving data with slow internet connection, patiently wait until the model finished
        int something = model.getSomething();
        view.renderSomething(something);
    }
}

But in GUI applications, I don't think I can do the same. If the model talks to the database or the network, it could disturb the UI thread because of the long running operation. I think the controller needs to know that the model will take a long time to do his job, so my solution would be the controller telling the model to fetch some data asynchronously, and then doing another job until the model notifies the controller when it's done.

So, should I take the execution environment into considerations when designing? Is it possible to design the objects so that they could run in any kind of environment? I don't think that domain objects could be reusable in different kinds of environment since the design could be completely different to suit environment needs.

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Picon
Gravatar

Acceptance Tests

Hi everybody!

  In the web application enviroment, the acceptance tests should be "gui" tests or functional tests?
  When I wrote my first acceptance test should I wrote a test with tools like Selenium or I can test direct from "controller" class? Is it valid?!
  This controller tests shouldn't mock anything, right?
  Sorry about my english


cheers, 

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
David Peterson | 15 Apr 2013 16:41
Favicon

High-quality design

I wrote up what I said about code commenting in a blog post.

In that post I also claimed that: "High quality design everywhere is like highly optimized code everywhere - very wasteful."

Do you agree?

David

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Stefano Zanella | 8 Apr 2013 12:04
Picon
Gravatar

Heuristic to decide between behaviour and implementation

Hello to all,
I'm new to the list and for sure not a long-time experienced developer, so feel free to let me know if I should look elsewhere for answers to my questions.
Since it's not always easy nor obvious (at least) for me to change my mind model from procedural to OO, I'm trying to define some rough heuristics to decide whether I'm "thinking" it's something that can be classified as an implementation detail or observable behavior that should be tested. Let me clarify that with an example:

Currently I have a bridge object that separates details about communication to a serial device via a 3rd party library (let's call it RS232Device) from an object that should be responsible of handling commands and responses at a more higher level (let's call it PlantController).
Let's say that I already defined by other unit tests that PlantController has a dependency on RS232Device for what concerns *sending* commands to it. Now I need to make my way back, from raw bits emitted from serial port to the plant controller.
Since code is asynchronous, a peer can receive responses by RS232Device by registering a listener to it. This is already done in main, since a previous acceptance test already set that link (Ruby code):

class Application
  instrument = RS232Device.create serial_port
  instrument.on_data method(:receive_data)    # Here Application register itself as a listener

  ...

  private

  def receive_data(data)
     # do something
  end
end

Now I need to move receive_data() to PlantController, since that fits better the SRP principle and will help making the end-to-end pass.
What I'm trying to figure out is if I need to add a test in PlantController unit suite that checks PlantController register itself as a listener to RS232Device upon creation before rewiring components.
I feel that this would be a wrong thing to do, and that feeling (that I cannot formalize yet) is in some way supported by a smell in the test that should be written. The unit test suite for PlantController is as follows:

describe PlantController
before do
  ...
  plant_controller = PlantController.new ...
end

it 'test something' do
  # setup mock
  # call PlantController method
end

To implement the above test, I would need to do something like this:

it 'listens for responses given by device' do
  device = mock
  device.expects(:on_data).at_least_once

  new_plant_controller = PlantController.new device
 
end

Here's what I feel as a smell:
- I would need to duplicate the setup code currently handled in the before() call
- I won't "trigger" anything by calling a method on PlantController, just testing against constructor

Are these considerarions suggesting that I don't need to test this code because it is a detail on how PlantController is implemented? More generally, it is possible to define "testing code on the constructor" as an heuristic to decide something should be treated as an implementation detail?

I apologize for the verbosity, hope though that I'd been clear enough and that someone has an answer to dissipate the clouds that still reside on this kind of reasoning.
Thanks,
    Stefano Zanella

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Daley Chetwynd | 17 Mar 2013 15:20
Picon

Failing end-to-end test in chapter 19

Hi all,


I've recently been working through GOOS and I've learned a lot from it. Congratulations on a well-written book. I've been storing my code in the following GitHub repo:

github.com/dchetwynd/GOOS-Auction-Sniper

I'm currently stuck at the end of Chapter 19, the final chapter for the Auction Sniper example. At the end of the chapter I should have been at the stage where all tests were green, but the sniperBidsForMultipleItems() end-to-end test was failing. My GitHub commit where I was left with this single failing end-to-end test was 31ba62fdfd6dfd60a0bd65b41e950107e0959a32. I've since reverted a few commits to return to the last place that I was green. I've then tried again and reached the point where sniperBidsForMultipleItems() first starts failing. This corresponds to my most recent GitHub commit of bd6f752ca7bd3ffabb5809e15338495c68728e48.

In commit bd6f752ca7bd3ffabb5809e15338495c68728e48 I have the following four failing tests:

AuctionMessageTranslatorTest/notifiesAuctionFailedWhenBadMessageReceived()  (unit)
AuctionMessageTranslatorTest/notifiesAuctionFailedWhenEventTypeMissing()  (unit)
AuctionSniperEndToEndTest/notifiesAuctionFailedWhenEventTypeMissing()
AuctionSniperEndToEndTest/sniperBidsForMultipleItems()

The first three of these failures are expected failures, as I have not yet implemented the code for the XMPPFailureReporter. I cannot see why sniperBidsForMultipleItems() is failing for me here though. Even when I implement the remaining code from chapter 19, sniperBidsForMultipleItems() continues to fail for me (GitHub commit 31ba62fdfd6dfd60a0bd65b41e950107e0959a32). This end-to-end test fails at the following statement:

auction1.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID);  (line 70 in AuctionSniperEndToEndTest in my code).

If I comment out later assertions for auction1 in sniperBidsForMultipleItems() then the test passes. At the start of this test I have the line:

application.startBiddingIn(auction1, auction2);

If I reverse this line to:

application.startBiddingIn(auction2auction1);

then instead of the assertions for auction1 failing, the assertions for auction2 start failing from startBiddingIn(). It's as if connecting to the second auction somehow affects the behaviour of the first auction.

What's strangest of all though is when the end-to-end test sniperBidsForMultipleItems() starts failing for me. In AuctionMessageTranslatorTest I have the helper method expectFailureWithMessage(), where this has the following two JMock expectations:

context.checking(new Expectations()

{{

    oneOf(listener).auctionFailed();

    oneOf(failureReporter).cannotTranslateMessage(

        with(ApplicationRunner.SNIPER_ID),

        with(badMessage),

        with(any(Exception.class)));

}});


The sniperBidsForMultipleItems() end-to-end test only starts failing for me when the second of these expectations is added. If I comment out the second JMock expectation (lines 107-110 of my AuctionMessageTranslatorTest code), sniperBidsForMultipleItems() then passes. Adding an extra JMock expectation in a unit test is causing an end-to-end test in a different test file to fail for me. I've examined Steve Freeman's auction sniper code at github.com/sf105/goos-code and I can't see any difference between his code and mine to cause this failure. I'm running Mac OS X 10.8.2 with Eclipse 4.2.1 and JMock 2.6.0.


Has anyone else encountered this same problem? I'd be grateful if someone could pull my GitHub code from either commit 31ba62fdfd6dfd60a0bd65b41e950107e0959a32 or bd6f752ca7bd3ffabb5809e15338495c68728e48 and see if they get the same failure of sniperBidsForMultipleItems().


Thanks for your help and keep up the good work,


Daley

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Anthony Green | 2 Mar 2013 14:33
Picon

Reflections on OO

Jim Coplien shares his thoughts on OOP:

http://www.infoq.com/presentations/Reflection-OOP-Social


--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Aaron Bonner | 20 Feb 2013 12:55
Picon

Dealers of Lightning

Maybe like some (maybe many) developers who were born in the 80s or 90s, I have very little appreciation for
what went on in the formative era of computing. After reading a chapter in Beautiful Architecture on
Smalltalk and cross-referencing some of that with what I read in GOOS, then seeing Philip's Beck
Smalltalk best practices series of posts, I have been really getting stuck into learning Smalltalk.

In the process my curiosity has been piqued, so much of what was in Smalltalk so long ago seems to have been
forgotten - or only recently rediscovered.

So I've been devouring pretty much anything I can get my hands on regarding the origins of Smalltalk. Kay's
essay on the Early History of Smalltalk was a great staging post and that (with google's help) led me to a
bunch of stuff on the c2 wiki, including a brief entry for the book 'Dealers of Lightning' which looks at the
history and impact of Xerox's PARC.

It's been keeping me up late for the past few days. I don't know about the rest of you, but when I am reading a
book I truly love, I get pangs of regret, I know the book will end and that will be that. So I'm just curious
given this list's wide reading, if anyone knows other books on both the technical and personal history of
computing that I really should add to my reading list?

I don't give Dealers another couple of days before I finish it, and I want something to look forward to moving
on to :)

Cheers,
Aaron.

--

-- 

--- 
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented
Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe@...
For more options, visit https://groups.google.com/groups/opt_out.

jmis | 16 Feb 2013 20:39
Picon

SniperLauncher Role

I'm trying to understand the role of the SniperLauncher better.  It's in a weird spot between the user interface and the rest of the application.  It's significant in the launching of the application as it's created in the integration layer (the main function).  Is the SniperLauncher's role to provide a well-defined way of manipulating the domain?

Along the same lines, how would one add further SniperLauncher-like functionality such as cancelling an auction?  Would an approach be to have the SniperLauncher inject a well-defined way of updating the sniper or auction?  Wouldn't then the SniperLauncher have a similar role as the main function?

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
philip schwarz | 14 Feb 2013 00:21

[GOOS] TDD & Mocks – Working Backwards From Expectations


In his TDD Book, Kent Beck said:

Assert First

When should you write the asserts? Try writing them first. Don’t you just love self-similarity?

  • Where should you start building a system? With stories you want to be able to tell about the finished system.
  • Where should you start writing a bit of functionality? With the tests you want to pass with the finished code.
  • Where should you start writing a test? With the asserts that will pass when it is done.

Jim Newkirk introduced me to this technique. When I test assert-first, I find it has a powerful simplifying effect. When you are writing a test, you are solving several problems at once, even if you no longer have to think about the implementation.

  • Where does the functionality belong? Is it a modification of an existing method, a new method on an existing class, an existing method name implemented in a new place, or a new class?
  • What should the names be called?
  • How are you going to check for the right answer?
  • What is the right answer?
  • What other tests does this test suggest?

Pea-sized brains like mine can’t possibly do a good job of solving all of these problems at once. The two problems from the list that can be easily separated from the rest are, “What is the right answer?” and “How am I going to check?”

Back in 2001 William Wake, author of the Refactoring Workbook  observed and named the Arrange-Act-Assert pattern.

One thing he said was:

You might think that the Arrange is the natural thing to write first, since it comes first.

When I’m systematically working through an object’s behaviors, I may write the Act line first.

But a useful technique I learned from Jim Newkirk is that writing the Assert first is a great place to start. When you have a new behavior you know you want to test, Assert First lets you start by asking “Suppose it worked; how would I be able to tell?” With the Assert in place, you can do what Industrial Logic calls “Frame First” and lean on the IDE to “fill in the blanks.”

The Assert in ‘Arrange, Act and Assert’ is doing State Verification.

Analogously, Jason Gorman, (author, amongst other things of the Test-driven Development Maturity Model ), today posted TDD & Mocks – Working Backwards From Expectations  in which he says that when he does Behaviour Verification, i.e. ‘Arrange, Act and Verify’, he writes the verification first.

--
 
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gmane