News for hackers. Stuff that matters.
Re:Keeping a plaintext “did” file by tempay on Monday July 16, 2018 @07:40AM (#17540467)
From your 18 lessons learned post:

> 6. Changing assumptions

My solution for this is to litter my code with "assert" which acts to both document the assumptions and prevent them sneaking past the point where the assumption was made.

Re:Keeping a plaintext “did” file by tga on Monday July 16, 2018 @08:19AM (#17540682)
Depending on the language, they might not prevent anything because asserts can/will be ignored in production. See for example Java, python -O.
Re:Keeping a plaintext “did” file by dotancohen on Monday July 16, 2018 @08:35AM (#17540784)
That's exactly why assert() is used and not if(). It is meant to be ignored in production in places where one would traditionally do `if (foo) { // This should never happen }`. Production code throws no Exception, in 20 ms the trajectory is recalculated anyway, and everybody is happy. Happens in testing or staging? The exception is logged and fixed.