Posts

TDD: Test-Driven Development

Image
Write unbiased tests and “don’t waste your time coding”... I recently read Test-Driven Development by Example by Kent Beck. This is one of the books that define Test-Driven Development (or TDD for shorter). In summary, TDD is the concept of writing tests before writing the code itself. You write the smallest test, the test fails. You make the smallest update to code, the test succeeds. You refactor the code. By writing tests first, developers can validate their understanding of the business requirements and ensure that every code is testable and the tests are unbiased. Also, TDD increases the confidence in the code. There is less fear of changing a code when you know that the tests have your back. If a change breaks the code, an existing test will immediately fail. In the first step of TDD, the test is the most important part that you write. Which means that while you're writing your test, you only add interfaces in the code but no implementations and you move on

Aliases: simplify your command-line life

Automate, auto-correct, type less, don’t repeat yourself… I’ve been a programmer for the last 10 years and, most (or at least a significant amount) of this time, I spent typing on terminal. git add —all docker rm -f $(docker ps -qa) npm run test cd tests/unit-tests && dotnet run test && cd ../../ Are some examples of commands that are often repeated over and over again. Add to that that I’m a twrrible [sic] typer and because of that I have to retype the same commands 2 or 3 times until I get it right and I can be a little lazy to read and remember the docs for specific commands and the command line experience starts to become tedious and frustrating. Enter alias . This is not a new concept and I had used before for mapping environment variables (who never had to map JAVA_PATH, ANDROID_HOME?) but I had never realized that I could use those for my own benefit to help me type less and to “auto-correct” my typos. Take for example the git add command. I freq