Let’s continue building up our calculator with more mathematic operations. So far we have addition and subtraction, so multiplication comes up next. In this post, we’ll have a look at test driven development. Even though the examples are a bit trivial, I hope they’ll outline the important points. Continue reading What is Test Driven Development?
In the previous post we started writing a basic Calculator class and added the first unit test. Let’s have a closer look at that unit test and extend our calculator with more features.
So, let’s start with some basics. What is a unit test? A unit test is a piece of code that validates the expected behavior of a unit in isolation. I guess the next question is, what is a unit? A unit is the smallest piece of code in a given programming language. Typically that is a function or a class method. Let’s see it with an example.
Unit tests is an essential method of ensuring quality and predictability of software. In my current work, we have been going through a hard learning curve involving many factors:
- developers not familiar with unit tests.
- a proprietary technology ecosystem where the community is typically not practicing unit tests at all.
- a legacy code base not written with unit tests in mind
This week the internet exploded in drama after 11 lines of code got unpublished from npm. If you didn’t read about it, the summary is that the developer of left-pad removed his package from npm, after npm renamed another package of his because of some name conflict with some other company’s trademark or so. Lots of other packages broke because of this due to the missing dependency. What is interesting here, is that this removed left-pad package consists of a single function (only 11 lines of code). How can that tiny package break the internet? Continue reading On the left-pad drama
Code coverage is a useful metric of the quality of your code. It shows how much code is being covered by unit tests. It doesn’t necessarily mean that the unit tests are well written, but no metric can probably tell you that. However, aiming for a specific code coverage, let’s say 70%, is a good practice, because failing to meet the goal might mean somebody didn’t write enough unit tests.
I’d like to have code coverage as part of the CI I had set up in a previous post with Travis. The bad news is that code coverage and Mono seem to be strangers. There is an open source module called monocov but I couldn’t get it to work. In fact in the homepage it says it’s not maintained. In my opinion, these kind of tools are essential and they should be included in the core Mono package. I hope they change this some day. Continue reading Code coverage for open source .NET with AppVeyor and Coveralls
It doesn’t matter if you’re using a simple editor or a full blown IDE, if you want to be more productive you have to spend time to learn some keyboard shortcuts. Here’s a few keyboard shortcuts I use frequently when I work with Atom. Continue reading Atom Keyboard Shortcuts