tag:blogger.com,1999:blog-3833072356413502019.post7164502744965826725..comments2024-03-18T10:06:43.949+02:00Comments on The Code Sheriff: Excuse #5 - The Frequent Refactoring ExcuseAnonymoushttp://www.blogger.com/profile/06100813770559493046noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-3833072356413502019.post-41952260678897879672011-12-19T06:48:36.559+02:002011-12-19T06:48:36.559+02:00Oh! Oh! I've certainly heard this excuse at wo...Oh! Oh! I've certainly heard this excuse at work. And goodness knows, I've experienced some of the pain because I've "done it wrong" myself, in every way you describe. I think it shows that writing simple, effective tests is harder than most people think — especially when you only look at good tests as examples. They're so simple, it's easy to say, "Gosh, that's dumb." But it can take careful thought (and experience from previous bad tests!) to learn the nuances of what to express, and how. Simple is hard.Jon Reidhttp://jonreid.blogs.com/qualitycoding/noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-42759035212397509662011-12-17T16:56:41.916+02:002011-12-17T16:56:41.916+02:00- First of all, Chuck Norris doesn't need test...- First of all, Chuck Norris doesn't need tests, he writes code with zero bugs in first place.<br /><br />- A very good post. Rather than a fanatic 'you must always fix your tests and never complain about it', I liked your one of your messages - 'maybe your test code should be improved to allow easier refactoring'. Raises some thoughts.<br /><br />- Yes, refactoring rather than re-writing! Nimi's comment is very rational, yet I suspect that in most cases people have an exaggerated tendency for rewrites, so your tip DOES make sense usually.<br /><br />- As for Allanis - http://www.youtube.com/watch?v=nT1TVSTkAXg :)Oren Hhttp://www.held.org.il/blognoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-38606993731227942372011-12-13T11:02:15.222+02:002011-12-13T11:02:15.222+02:00Tomas, thanks for your comments - I think they are...Tomas, thanks for your comments - I think they are very interesting and present an insightful view and not simply a "tests are bad" view I get from other people.<br /><br />Maybe your experience is different, but from my humble experience in the field:<br /><br />1) The bests programmers I know and the ones who I look up to the most are ones who strongly believe in unit-tests. I doubt it you won't hire someone like Kent Beck for any programming task.<br /><br />2) 99% of the time software development is about delivering solid products on time and not about developing ground breaking technology.<br /><br />3) In many of my previous projects, the test code was the most interesting part of the code, applying many complex design decisions and nifty tricks. I don't see a real difference of the challenge of writing test-code vs. writing production code. Heck, sometimes your product IS something to help you write test code (e.g. products like Typemock's Isolator).Anonymoushttps://www.blogger.com/profile/06100813770559493046noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-13601080344776963952011-12-13T09:44:34.696+02:002011-12-13T09:44:34.696+02:00Yoni, I agree that good tests can be challenging i...Yoni, I agree that good tests can be challenging in itself. But it's narrow and nowhere near what you face elsewhere in programming.<br /><br />The idea of getting confidence from tests is just plain wrong. Programming has been around for ages. Sure there's been lots of bugs as well, but imo these bugs are not introduced through the lack of tests, but through the lack of great leadership.<br /><br />By the help of tests you're going to be able to deliver a solid product on time. Yes, you read it correctly... solid product on time.<br /><br />However, you will most likely fail in developing ground breaking technology that can compete with technology coming from an excellent team not applying rigourous test principles.<br /><br />But if the edge of the business doesn't come from technology I agree with you.<br /><br />I wouldn't want to work there though.Tomasnoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-24041424263829724002011-12-13T06:26:51.648+02:002011-12-13T06:26:51.648+02:00Generally agree. But if you are chaanging tests wh...Generally agree. But if you are chaanging tests when refactoring then you are kidding yourself that you are using tests to safeguard the refractory. You can't state that the tests passed before and after the refractory and thus the refractory is good.mebigfatguyhttps://www.blogger.com/profile/14124232684220470502noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-64774473524594805762011-12-12T22:17:45.619+02:002011-12-12T22:17:45.619+02:00My next post in the series will talk about this su...My next post in the series will talk about this subject, so stay tuned.<br /><br />Anyhow, I really don't agree programmers who rely on tests are not as skilled as those who aren't writing them.<br />Usually, the opposite is true. You can't really write effective and well crafted unit tests without being a skilled programmer, and if you are not good enough - tests aren't gonna help you anyhow.Anonymoushttps://www.blogger.com/profile/06100813770559493046noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-71942193513982725062011-12-12T22:07:43.204+02:002011-12-12T22:07:43.204+02:00Indeed.
But in order to deliver high quality soft...Indeed.<br /><br />But in order to deliver high quality software you have to have the right tools, and for me highly skilled developers is a better tool than loads of safety arrangements.Tomasnoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-71942255996002499172011-12-12T21:57:28.396+02:002011-12-12T21:57:28.396+02:00Tomas, If I understand correctly, you suggest that...Tomas, If I understand correctly, you suggest that relying on tests hurts your ability to write good code without them.<br /><br />Why should that be the goal? Isn't the goal to deliver high quality software and respond to change quickly?Anonymoushttps://www.blogger.com/profile/06100813770559493046noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-15865730991921419222011-12-12T21:32:00.366+02:002011-12-12T21:32:00.366+02:00Programming is about solving problems. Solving pro...Programming is about solving problems. Solving problems is linked to cognitive performance.<br /><br />Where do you think cognitive performance comes from? I can tell you for sure that it doesn't come from loads of safety arrangements.<br /><br />As a programmer you need to always challenge yourself in order to, A) keep your current skill level and B) improve and acquire new skills.<br /><br />Would you learn to walk if someone gave you a wheelchair as a kid? Sure you would have the confidence to move around and not be afraid to fall and hurt yourself, like that would be what life is about....<br /><br />Sure, some safety equipment is good, like a helmet when riding a motorcycle. But I'm sorry to see that you're another victim of the crowd that just doesn't see the difference.Tomasnoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-66080694647242868502011-12-12T20:48:12.211+02:002011-12-12T20:48:12.211+02:00Hey Nimi, thanks for the comment!
I have to agree...Hey Nimi, thanks for the comment!<br /><br />I have to agree with you, I feel I was too harsh about NEVER doing a rewrite.<br />In situations like you mentioned, rewriting the component might actually be the right thing to do. However, it's something you should do only ONCE.<br /><br />In other words, rewrites cannot really be an excuse for not writing tests, only a measure to get your code to a state you can refactor it step-by-step in future changes.Anonymoushttps://www.blogger.com/profile/06100813770559493046noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-2938735729548223922011-12-12T20:18:03.860+02:002011-12-12T20:18:03.860+02:00Great post, but I disagree with your last argument...Great post, but I disagree with your last argument, of "never" doing a re-write.<br /><br />Specifically, think of a (already written) component that can redefine the meaning of spaghetti code for you, 10-20k LOC, written in C, that does low-level thingies, that doesn't even have corresponding component tests, and certainly no unit tests.<br /><br />The pain of making the component testable is probably tenfold the pain of re-writing it TDD-style, and if you re-write you also get the new clean code.<br /><br />I guess that advice is only valid for either<br />a) code that already has (some) tests<br />b) situations where it's easy to add tests (maybe managed languages, like python with the mock package, enable testing even in such situations)Niminoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-85197179220493868772011-12-12T18:14:51.615+02:002011-12-12T18:14:51.615+02:00Thanks, fixed the link.Thanks, fixed the link.Anonymoushttps://www.blogger.com/profile/06100813770559493046noreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-67532341772044729112011-12-12T18:09:18.707+02:002011-12-12T18:09:18.707+02:00Just remove the trailing URL-encoded space charact...Just remove the trailing URL-encoded space character and the link works:<br /><br /><a href="http://blog.thecodewhisperer.com/2010/01/14/what-your-tests-dont-need-to-know-will-hurt-you" rel="nofollow">like this</a>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-12929652741964635462011-12-12T17:19:30.474+02:002011-12-12T17:19:30.474+02:00http://blog.thecodewhisperer.com/2010/01/14/what-y...http://blog.thecodewhisperer.com/2010/01/14/what-your-tests-dont-need-to-know-will-hurt-you%20<br />is a loken brink.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-63996379851951458212011-12-12T15:44:09.574+02:002011-12-12T15:44:09.574+02:00http://codesheriff.blogspot.com//feeds/posts/defau...http://codesheriff.blogspot.com//feeds/posts/default <br /><br />works I guess its a blogspot thing. Use used to http://codesheriff.blogspot.com/rss/phpguyhttp://waiverform.orgnoreply@blogger.comtag:blogger.com,1999:blog-3833072356413502019.post-39955265041178692912011-12-12T15:41:42.056+02:002011-12-12T15:41:42.056+02:00Would be great if there was a way to subscribe to ...Would be great if there was a way to subscribe to rss I might be blind.phpguyhttp://waiverform.orgnoreply@blogger.com