(no title)
apankrat | 3 years ago
Few years ago started using asserts as an ad-hoc documentation mechanism for invariants and then also started shipping them in production builds. When triggered, asserts grab the stack trace, write it into the application log and give an option of sending a bug report. And then they shut down the program.
Was scary at first, but the initial pain is absolutely worth it.
This flushed hundreds of absolutely crazy edge cases, improved code quality and stability tremendously. It also forced writing cleaner code to begin with and sped up debugging while in development. Now have about 3K asserts in 250 KLoC code base. Can't recommend this practice strong enough.
civopsec|3 years ago
This is seriously cool. I never understood why people don’t talk more about this style of programming.