RSS
Facebook
Twitter

Thursday, April 21, 2011

3 signs that you’ve been coding too much

Could there be such thing as too much coding? From time to time I get reminded that there is more to the world than Visual Studio and highlighted text. Below are real stories that happened to me (sometimes more than once), causing me to ask myself – should I take a break?

Run in debug mode emailing

You’ve just tried sending an email by pressing F5
When a co-worker told me that he’s just used the “Run" from debugger” button to send an Email it made me laugh. only to do the same thing after a few months…

I guess my brain was wired to press F5 to “execute” – stupid brain.

Compiling word documents

In my pre-Resharper days I was used to compiling my code every few lines as a basic “sanity check” it was for my code what quick save is for games. it became such a second nature that a few times after I’ve finished writing a paragraph in word I’ve tried to compile it by pressing ctrl + shift + B.

Proper coding standards in text files

This one is new. I get to write comments to document my code. a few days ago after writing a line of documentation I’ve noticed that I’ve used Pascal case TheEntireTimeAndTheWierdThingIsThatIWasAbleToReadItAtLeastOnceBeforeNoticing.

Conclusion

Sadly these is not a fictionally post – it happened to me and might happen to you. And I know that I’m not the only one – so if you have stories of strange things that happened to you or your “friend” – please leave a comment.

 

Happy Coding…

Monday, April 04, 2011

Testing right by testing the right thing

Before answering questions about unit testing I usually tend to ask some questions to get the broader picture – especially if the question sound strange.

Such question was asked by a teammate – he wanted to know if he can replace the behavior of a fake object while still calling the method replaced. This sounded a bit strange to me – either you want to fake an object or you don’t so I asked him if he happens to test the functionality of the same object he’s faking – he answered that no but he needs the method to run in order for the test to pass.

At first he insisted that he wants to test if a problem report in the system was closed twice as so he needs to count the times that the close method was called while still calling it. Next I asked him how does the user notice the issue, does our user care that he closes the report twice? obviously the user does not care. After further inquiry I manage to find that if a close operation is performed on an already close report an exception is thrown and the user does not get notification for the end of the running process. After we cam to that conclusion he managed to write a simple unit test that checks whether the user is notified in no time.

In retrospect I could have told him how to solve the issue he had using our Isolation framework of choice – the result would have a been a poorly written, fragile test.

Fragile Box by DHDesign, on Flickr
Creative Commons Attribution-Noncommercial 2.0 Generic License  by DHDesign

 

Happy coding…

Related Posts Plugin for WordPress, Blogger...