When I write something, half the effort tends to make clear and concise debug output or functionality that can be turned on / off when something needs debugging.
An example of a debugging function is the bootloader class, in which I can include #define, which causes it to โpretendโ to load the file and just pass me the one I already have. Thus, I can check what happens when the user downloads the file, without waiting for the network to physically capture the file each time. This is great functionality, but the code is getting more messy with C # ifdefs.
I end up with a bunch of #define like
// #define DEBUG_FOOMODULE_FOO // #define DEBUG_BARMODULE_THINGAMAJIG // ...
which are uncommented for the material I want to look at. The code itself is something like
- (void)something { #ifdef DEBUG_FOOMODULE_FOO DebugLog(@"something [x = %@]", x); #endif
This works great for writing / maintaining code, but does nothing for the appearance of code.
How do people write effortlessly on-the-fly debugging material anyway?
Note. I'm not just talking about NSLogging here ... I am also talking about things like pretend-download above.
Kalle source share