But I did learn some great things from this book, such as “Domain separation” – each Class (in my case it’s the xxProcess.js files) should handle one domain and not care about anything else – it shouldn’t care what DB will be used or how the output will be used – only what’s the input and what’s the proper output. It actually was like this before where the only change I made in the code in this regard was to extract “Comments” function to a new process file.
Another thing was to have descriptive function names for test so you’d know exactly what this test is running. I had a testProcess before which I didn’t really use. I’ve added Qunit in and created a simple mechanism to run the tests from the console. I removed the testProcess and maybe I’ll add it again in the future.
So it came down to this. Yes, I wrote the testing-platform which works great. Yes, I wrote some tests into it. Yes, I know I should use it from now on. But then, for the next major development, I didn’t use it – I didn’t write any test before or after making a huge change and I’m quite sure my new code works great, Because I fiddled with it and any test I might have written – I also checked it myself. Took me a lot less time, I’m sure. This is something that actually bothered me in the book – how much time do they spend writing the test? yes, writing test is important, I’m not saying it doesn’t – but the longer you spend writing test – the more probable you’ll have bugs in the test-code and you’ll spend hours to fix your tests instead of just continuing to write the code.
So yes, I promise that from now, I’ll try writing more tests as part of the design process. While writing this I’m fully aware that I’m lying, which is kinda sad.