Stubs vs Mocks
In this article, I’d like to discuss the differences in using stubs and mocks and show how you can abandon using mocks even in the cases where you need to verify that objects interact with each other correctly.
The most important TDD rule
In the previous articles, we discussed what causes the pain while writing unit tests (mocks), and how to make TDD painless (get rid of the mocks). Today, I want to set the groundwork and discuss why mocks actually cause so much pain to us, developers.
Integration testing or how to sleep well at nights
Unit testing is good at checking the correctness of your code in isolation, but it’s not a panacea. Only integration tests can give us confidence that the application we develop actually works as a whole. They are also a good substitute for mocks in the cases where you can’t test important business logic without involving external dependencies.
-
Integration testing or how to sleep well at nights
How to do painless TDD
Last week, we nailed the root cause of the problems, related to so-called test-induced damage - damage we have to bring into our design in order to make the code testable. Today, we’ll look at how we can mitigate that damage, or, in other words, do painless TDD.
Test-induced design damage or why TDD is so painful
I’m going to write a couple of posts on the topic of TDD. Over the years, I’ve come to some conclusions of how to apply TDD practices and write tests in general that I hope you will find helpful. I’ll try to distil my experience with it to several points which I’ll illustrate with examples.
-
Test-induced design damage or why TDD is so painful
Encapsulation revisited
The third most important software development principle is Encapsulation.
KISS revisited
Today, I’m going to discuss the KISS principle. I consider it the second most valuable software development principle.
YAGNI revisited
I’m starting a new blog post series about the most valuable principles in software development. Not that I think you might not know them, but I rather want to share my personal experience and thoughts on that topic. The order in which I put those principles reflects their significance relative to each other, as it appears to be in my opinion.
That is quite a large subject and I’m going to dilute it with articles on other topics, so it might take a while.
Okay, let’s start.
Make hard-coding your default choice
Hard coding is often considered an anti-pattern. Having values that can change over time hard-coded in the source code requires recompilation every time these values actually change. While this statement is true, I think that hard coding should be the default choice when developing an application. Hard coding vs configuration file When you work on a project or feature, there always are some magic numbers or strings that potentially can change in future.
Interfaces vs Interfaces
Today, I’d like to discuss the differences between interfaces, abstractions and .NET interfaces, as well as what the term "implementation details" means.