Friday, March 25, 2011

Testing with Mocks, stubs and an ugly testing framework

http://openmymind.net/2011/3/23/Stop-Using-Mocks

This article provides a good argument about some of the subtle issues with Unit testing. However the points are hard to make out through the vague illustration and the uncommented code polluted with yet another fuggly testing framework.

I am getting to the point where I really cannot look at another framework that introduces yet another sub-dialect of a language in an attempt to "simplify" some aspect of our lives.  Probably started off as a good idea but has then been taken to a point where its inaccessible for new users and casual readers. At least add some fucking comments to the code to help clarify what the fuck you think is going on.  That's the point of comments.  Tell us what you want the code to be doing.... even when its not actually doing it right.  We can read the code all we like and still never get any insight into whats going on in your head.  All we can do is draw our own conclusions about your head, the level of damage it may have suffered and the incompetence its demonstrating and then talk to our friends and accomplices about how to track it down and give it a kicking.  Code is not comments.  Comments are not code.  They have the capacity to tell different stories.
Its good that machines cannot read comments and "help" us by fixing them up and keeping them in sync with the code. Can you imagine just how much of a mess it would be if your IDE 'helped" by re-writing the comments to match the horrible code that some crappy coder turned in?  (you perhaps)  Imagine having to pull old copies of the code from the repository just to verify if the comments have changed and try to recapture the semantics of the original design notes that you wrote when your head was fresh.  What a pain in the arse. Long live stupid IDE's.

No comments:

Post a Comment