|
|
|
|
|
by RodgerTheGreat
5186 days ago
|
|
Honestly, maintaining the stack in your head is a skill that can be learned with practice. In my own experience, it was very hard at the beginning but over the course of a few weeks it became second nature. You get used to idiomatic ways of doing things- arranging expressions so that they don't become deep, factoring words apart as a means of reducing the number of elements you care about in a given context, when to use a variable or two to untangle a complex expression. From the debugging side, well-factored code consists primarily of short pure functions with a very small number of code paths. This couldn't be a more perfect scenario for TDD. In my own projects I use an extremely simple unit testing system called the Test Anything Protocol (TAP). Here's an example of a fixture: https://github.com/JohnEarnest/Mako/blob/master/lib/Test/tes... |
|