Quantcast
Channel: The Code Whisperer - Latest posts
Browsing latest articles
Browse All 24 View Live

A Matter of Interpretation: Mock Objects - The Code Whisperer

Imagine that you were going to buy a car and you had a choice between two brands: Brand A has tested all of the car’s individual components in isolation. The tires, the gears inside the engine, the...

View Article



A Matter of Interpretation: Mock Objects - The Code Whisperer

@jbrains, I believe that cited person meant Mocks specifically, in the sense that you explicitly define their behavior in test setup (eg. what Mockito offers in Java world), contrasting it to other...

View Article

A Matter of Interpretation: Mock Objects - The Code Whisperer

Hi, @Anders. Fortunately, we don’t have to ever make that choice, so my answer would be meaningless, anyway. Let me propose a choice closer to what tends actually to happen. Brand A has spent 1000...

View Article

Image may be NSFW.
Clik here to view.

What's Not To Like About This Code? An Experiment. - The Code Whisperer

david.lino: The alternative is passing in an interface into the domain layer and then doing some integrated tests using mocks to ensure the right method is called, but that test then becomes an...

View Article

What's Not To Like About This Code? An Experiment. - The Code Whisperer

I like this approach because it is flexible. It is another version of “set an expectation on shipOrder()”. We could easily Introduce a Parameter Object for (shipIt, noDontShipIt), then Extract...

View Article


How Tests Support Refactoring - The Code Whisperer

I have witnessed programmers express annoyance about how tests seem to interfere with changing production code. A discussion on this topic led here: This is a companion discussion topic for the...

View Article

How Tests Support Refactoring - The Code Whisperer

Just give your unit tests a bigger scope (eg. make them as sociable as possible) and avoid mocking. See this excellent talk by myself ;); Bigger Unit Tests are Better (Peter Schuler)

View Article

How Tests Support Refactoring - The Code Whisperer

This strategy helps, but it is not the only way, not always the best way, and can lead to new problems. We will always have people who have the impulse to react to this feedback in each way: some who...

View Article


Getting Started with Contract Tests

@jbrains Hi, so I’ve been really interested in using Contract testing for replacing e2e tests. However, one thing that’s been really tripping me up is the idea of testing semantic vs. syntactic using...

View Article


Image may be NSFW.
Clik here to view.

Getting Started with Contract Tests

First things first, I need to fix the notification mechanism for comments here, because I didn’t notice one for your comment. I’m sorry that that failed and that I didn’t reply sooner. I would have...

View Article

Which Kinds of Tests Should I Write? Revisited - The Code Whisperer

I see so many programmers tying themselves up in knots, trying to find “the right” testing strategy. I’d like to offer them a simple idea intended to make at least one of these knots loosen itself and...

View Article

Which Kinds of Tests Should I Write? Revisited - The Code Whisperer

At some time a project will arrive to this point in which test category to favor on the long run. A lot of developer say that if you want to understand how a project works just check the requirements,...

View Article

Image may be NSFW.
Clik here to view.

Which Kinds of Tests Should I Write? Revisited - The Code Whisperer

TheRealHNK: I have worked on projects where we had no tests, and I have worked on projects where there were a tons of unit and integration tests, but the unit tests were tautological, and the it tests...

View Article


Image may be NSFW.
Clik here to view.

Which Kinds of Tests Should I Write? Revisited - The Code Whisperer

Recently I have shared a testing strategy - State Transitions testing. This strategy involves writing the requirements as a set of state transitions and creating test cases for each transition. This...

View Article

Which Kinds of Tests Should I Write? Revisited - The Code Whisperer

Thank you. I should have said BDD testing instead of Cucumber as that is just a shiny tool but requires a mature team to use it, if not used well it can lead to chaos as well.

View Article


Image may be NSFW.
Clik here to view.

Which Kinds of Tests Should I Write? Revisited - The Code Whisperer

mapteb: Recently I have shared a testing strategy - State Transitions testing. Indeed, this is an example of how testing strategy influences design choices. I remember this especially when trying to...

View Article

A Guard Clause Is Maybe a Tiny Parser - The Code Whisperer

December 20, 2023 Simple Design, Refactoring, Microtechniques This is a companion discussion topic for the original entry at...

View Article


A Guard Clause Is Maybe a Tiny Parser - The Code Whisperer

Thank you for this. Once, I was alerted to the “perhaps your collected validation rules suggest a Policy class”, and extracted such a thing in RubyGems, to try it. (Oh, that was six years ago.) By...

View Article

A Guard Clause Is Maybe a Tiny Parser - The Code Whisperer

Inspiring post! The functional and value type stuff is new to me, but I think it’s pretty neat. What are your thoughts on switching over types like this? Summary (click for more details)

View Article

Image may be NSFW.
Clik here to view.

A Guard Clause Is Maybe a Tiny Parser - The Code Whisperer

Your Barcode type effectively reimplements a small part of Maybe using the “OO way” to design Sum/Union types. Your switch statement reimplements Maybe.map() (the Valid branch) and Maybe.withDefault()...

View Article

TDD: For Those Who Don't Know How to Design Software - The Code Whisperer

January 8, 2024 Simple Design, Refactoring, Evolutionary Design, Programming Without Blame This is a companion discussion topic for the original entry at...

View Article


TDD: For Those Who Don't Know How to Design Software - The Code Whisperer

Thanks, as ever, JB. I suspect we can even make a stronger claim here. If we accept the notion of program as constructive proof (albeit one with effects–which are deeply confounding compared to the...

View Article


Image may be NSFW.
Clik here to view.

TDD: For Those Who Don't Know How to Design Software - The Code Whisperer

jds: If we accept the notion of program as constructive proof (albeit one with effects–which are deeply confounding compared to the enterprise of mathematics, the theorems of which don’t generate heat...

View Article

Image may be NSFW.
Clik here to view.

TDD: For Those Who Don't Know How to Design Software - The Code Whisperer

jbrains: messing around until I found the key idea that made both ends of the argument fit together Absolutely. I believe the combination of rigor with an eternal open invitation to the messiness of...

View Article
Browsing latest articles
Browse All 24 View Live




Latest Images