Skip to content

Commit

Permalink
Rought draft of the beginning of a new essay
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Apr 16, 2011
1 parent 7d14258 commit 38d83a4
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions misc/lydia_book.md
@@ -0,0 +1,44 @@
### What I wish I would have known about testing when I started...

When I first got involved in free and open source software, I had no clue what
tests were or why they were important. I had worked on some personal
programming projects before, but the first time I was actually working on a
project with others, i.e. got a commit bit, was Yacas, a computer algebra
system similar to Mathematica.

At this stage in my journey, tests were an afterthought. My general
meta-algorithm was to hack on code -> "see if it works" -> write a simple test
to show it works (optional). If a test was challenging to write, it most
likely never got written.

This is the first step in the path to Test Driven Enlightment.

If I could open up a wormhole and tell my younger self one peice of wisdom
about testing, it would be:

Tests are the proof that your code *actually* works, and they guide you to writing correct
code as well as providing the flexibility to change code and know that features still work.

Some tests, in the long-run, are more important than the code they test.

A few people right about now may be thinking that I put on my tinfoil testing
hat when I sit down to code. How can tests be *more* important than the code
they test?

Code either changes and evolves or bitrots. (Footnote: The term "bitrot" is
coder slang for the almost universal fact that if a piece of code doesn't
change but everything it relies on *does*, it "rots" and usually has very
little chance of working without modifications being made to accomodate newer
software and hardware.)

Very often, you will write tests once, but then totally refactor your
implementation or even rewrite it from scratch. Tests often outlive the code
they originally tested, i.e. once set of tests can be used no matter how many
times your code is refactored. They are actually the litmus test that allows
you to throw away an old implementation and say "this newer implementation has
a much better design and passes our test suite." I have seen this happen many
times in the Perl and Parrot communities, where you can often find me.

Tests allow you to change things quickly and know if something is broken. They
are like jetpacks for devevlopers.

0 comments on commit 38d83a4

Please sign in to comment.