The need to constantly update your tests whenever you change production code is one of the arguments against unit testing. Sure, when you do a big refactoring tests will need to change, but smaller changes should not make you change all the tests. I will try to help you with this issue. Specifically I will try to help you make your setup code easier to maintain.
Cleaner constructors with throw expressions in C# 7
When creating classes it’s important to create constructors that don’t allow creating objects in an invalid state. I blogged about this in the past (in polish – Czy programiści .NET zapomnieli o konstruktorach?). To prevent this we add validations in constructors. One of the most common is validating if object passed to constructor isn’t null. This is boooring code that you just have to type in (Resharper helps here) and before C# 7 and throw expressions it introduces it was taking a lot of space in constructor.
How to find great IT books?
In my opinion if you’re trying to be the best possible software developer you can ever be reading books is the best way to achieve this (other than writing code :)). In no other way you will be able to learn from one of the best, incredibly clever and most respected developers on this planet. Some of you may be lucky enough to work with them but most of us are not.
Top mentioned books on stackoverflow.com
Stackoverflow analysed more than 40 million questions and answers to find books mentioned the most. And No. 1 is one of my personal TOP 3 books on software development ever written – „Working with legacy code” by Michael Feathers.
In case you are interested in two other books from my personal TOP 3:
No. 1 – „Agile Principles, Patterns, and Practices in C#” by my favorite author Robert C. „Uncle Bob” Martin and Micah Martin.
No. 3 – „xUnit Test Patterns: Refactoring Test Code” by Gerard Meszaros.
I really believe that if you don’t like to read a lot of books (not me, I lost count how many I have read) those three will give you extremely high return on time invested in reading (and understanding!) them.
I would also like to mention my No. 4 too because it’s close call with No. 3. It’s „Growing Object-Oriented Software, Guided by Tests” by Steve Freeman. It’s not No. 3 only because I think it’s good to read „xUnit Test Patterns: Refactoring Test Code” first.
Oh, and I almost forgot. Here is the site where you can check the results of Stackoverflow analysis – http://www.dev-books.com/
Czy programiści .NET zapomnieli o konstruktorach?
Dzisiaj ABC, ale chyba warte przypomnienia. Wprowadzony w .NET 3.0 Initializer syntax jest bardzo wygodny. Pozwala skrócić zapis i spowodować, że kod jest trochę czytelniejszy. Jednak coraz częściej mam wrażenie, że przez niego programiści .NET zapomnieli o konstruktorach.
Programista prawie jak chirurg – musi dbać o dłonie
Gdy po raz pierwszy usiadłem przed klawiaturą komputera PC zagadką było dla mnie to dlaczego klawisze F i J mają jakieś wypustki. Po jakimś czasie dowiedziałem się, że pomagają one w łatwiejszym odnalezieniu czegoś, co określane jest jako HOME ROW.
StringCalculator Kata in F# – revision 1
“Learn at least one new language every year” – The Pragmatic Programmer book.
Late 2014 I have decided to learn F#. This is my first attempt at String Calculator Kata in F#.
Zapewniaj metodę ToString() w swoich obiektach – część 2
W moich zamierzeniach ten temat miał być omówiony w jednej części, ale duża ilość komentarzy, pytań i uwag spowodowała, że powstała część druga.
Zapewniaj metodę ToString() w swoich obiektach
Pomimo stosowania TDD każdemu z nas od czasu do czasu zdarza się debugować kod. Czy to lubimy, czy nie, czasem po prostu nie ma innego wyjścia. Ułatwiajmy sobie (i osobom, które odziedziczą kiedyś ten kod) debugowanie przez dodawanie ToString() do wszystkich swoich klas.
Tortoise SVN – interaktywny commit
Z jednej z prezentacji nt. GIT-a dowiedziałem się, że posiada on coś co nazywa się Interactive staging. Pomyślałem, że czegoś takiego brakuje mi w codziennej pracy z duetem SVN/Tortoise SVN. Jak się jednak okazało i w Tortoise SVN od ostatniej wersji jest odpowiadająca temu funkcjonalność.