ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date
Re: [TDD] Howto mock a final object that doesn't offer an interface?
Stefan, I would /not/ write production code (particularly alternate flows like this) for testability. I /would/ modify the structure of the code for tes
By George Dinwiddie · #35200 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
It's the tests that have "driven" you to introduce the indirection, so your argument may be that you've introduced it "just for the test", but what you've actually done is decoupled the main body of
By Colin Vipurs · #35199 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
Ah. I get it. The way most of us handle it is to not worry about it too much. James Grenning talks about all the electronics in your car that are only there to allow diagnostics. He suggests it is no
By Tim Ottinger · #35198 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
You are *not* testing the rendering object (real or adapted). You are TDDing *your* code that calls that object. If an adapter facilitates TDDing your own code, then what is the downside? What is the
By Steve Gordon · #35197 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
Hi Tim, Am 23.01.2013 16:07, schrieb Tim Ottinger: that maybe a misunderstanding because of my english. The objection I wanted to express is: I don't want to introduce (production-)code that only
By sh <shvfn@...> · #35196 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
TDD is constantly about modifying the code to fit the tests, since the test comes first and the code is written to satisfy it. I don't understand the objection here. But +1 on everyone else's
By Tim Ottinger · #35195 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
Stefan, I generally use the adapter pattern to isolate my code from such a dependency. On my side of the adapter, I express the API in terms that are most convenient for my code, and do translation in
By George Dinwiddie · #35194 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
Hi Colin, ok, so I should use a view-class as a wrapper for the Graphics object and then mock the view? I thought of this as making the code fit the test, but it's probably the easiest way. I'll try
By sh <shvfn@...> · #35193 ·
Re: [TDD] Howto mock a final object that doesn't offer an interface?
My advice on this is always "don't do it". My second piece would be "don't do it (unless you absolutely have to and have no other choice)". If you *can* use a the real object, use the real object. If
By Colin Vipurs · #35192 ·
Howto mock a final object that doesn't offer an interface?
Hello everybody, I need a little help again. The question is: How do you test 3rd party objects, that are declared final and do not implement any interface to work on? Background: Yesterday I started
By sh <shvfn@...> · #35191 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
>Dear Listables, > >first post here. I hope, this hasn't been asked a thousand times... :) > >TL,DR first: >What are your experiences regarding the evolutional aspect of TDD when it comes to systems?
By Zhengshangmin · #35190 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
Esko, that looks like a great tutorial to get going. I also read your article about "three styles of naming tests". Very good read. I realized, that I am used to implementation-style naming and
By sh <shvfn@...> · #35189 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
I just saw this blog entry today, and I think it might help you understand and answer your questions. It might also help you get past your mental block (which I believe we all have had at one point or
By Avi Kessner · #35188 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
I'm not Matteo, but you usually have a number of choices. Joseph Leddy, Kent Beck, & I wrote this article, "Slicing Functionality: Alternate Paths" to talk about exploring some of them:
By Bill Wake <william.wake@...> · #35187 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
Sometimes the test you choose turns out to be too difficult... in the sense that it takes more than a few minutes to make it pass. This is where the fun begins :) you can comment the current test and
By Matteo Vaccari · #35186 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
Well, for instance in Tetris you could list a few simple behaviours: - a block falls - a block stops when it hits the bottom - a block stops when it hits another block - the player can rotate the
By Matteo Vaccari · #35185 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
For Tetris I've done this: https://github.com/orfjackal/tdd-tetris-tutorial I first focused on getting 1x1 blocks falling, then moved to rotating multi-block shapes, and merged those together to get
By Esko Luontola · #35184 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
Avi, ok, I see. So you would start with something more "practical" than the concept of class Engine? This is something I noticed when I read about behaviour driven development, that I had problems to
By sh <shvfn@...> · #35183 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
Hi � For a look at one what man is trying see the Codea articles on my web site. I'm not very far along yet, but they'll show you the way I'm thinking at the beginning. Questions welcome, they'll help
By Ron Jeffries · #35182 ·
Re: [TDD] Does TDD ask me to 'forget' all I know about software design?
Ummm.. for Tetris, I could write tests (one by one) to: - Give me an empty "board" - Put a Piece X at position x,y, get its position - Put a Piece X at position x,y, run a cycle, get its new position
By Angel Java Lopez · #35181 ·