UnitTests

Adam adam.spitz at gmail.com
Tue Jan 11 00:49:04 UTC 2011



Back when I was working in Smalltalk, I hacked my class browser to have a big TEST button in the very middle of the window, which would run all my tests and show me a green or red bar. (Just like the SUnit TestRunner, except it was always right there in my face. I think I also had the green colour fade or get duller or something as time went on, to encourage me to keep running the tests frequently to keep the colour fresh. I felt good whenever I saw the vibrant green colour, whereas I found the duller green to be kinda ugly.)

I also experimented with ways to keep myself aware of various other aspects of the code. For example, I made myself a tool that showed me all of my methods, sorted from longest to shortest. Every so often I'd look at the tool and wince at how long some of my methods were. (If I were implementing this today I wouldn't do it as a separate tool, but there's the Smalltalk tool-based mindset for you. ;) Made me really motivated (maybe a bit too motivated, but still, I liked it) to find a way to factor those long methods more nicely, so that they'd stop standing out at the top of that list.

I think I also played around with some algorithms for estimating how complex a class was - how many methods and instance variables it had, how long its methods were, how intertwined the class was with other classes, etc. I don't think I ever got the formula quite right, though.

These tools didn't try to force good habits on me; they just helped me stay aware of things that I wanted to stay aware of. I always kinda liked that approach.


Adam

P.S. Incidentally, for those of you who don't feel like watching the whole video, the relevant part is at 21:25:
        Ward said, "What killed Smalltalk is that it was just too easy to make a mess. You C++ programmers are lucky, because the language punishes you if you make a mess. Your builds start to take forever. You've got to undo some of the mess just to survive. But the Smalltalk people could add mess upon mess upon mess with no immediate ill effects. Their builds didn't run any slower - there *was* no build. There was nothing that went wrong with them; as long as they could manage to keep all the balls in the air, they were all right. But eventually you could build a system that was so indirect and so impenetrable and so convoluted that no one could understand it or touch it and it would become impossible to deal with."



--- In self-interest at yahoogroups.com, Randy <randy.smith at ...> wrote:
>
> He only briefly makes the argument that any medium can be improved by adding resistance. I believe resistance makes bad results harder, but it also makes good results harder. 
> 
> He argues more effectively that a programming environment can be improved by offering a mechanism to insure you maintain constraints you think are important (TDD). I find that more compelling, but it is a suggestion on how to improve an environment, not how to select a language.
> 
> Creating an otherwise low-resistance language with the property that you can't create anything without a test would offer an interesting check of his hypothesis.  Is there such a language? If not, is it even possible? (Who tests the tests?)
> 
> He would do well to take his own advice about adopting attitudes that don't put people off ... the dripingly sarcastic tone, the bounce in his step as he walks ... heck, the fact that he feels he even needs to walk, the toss of each card to create trash for someone else to pick up with the lingering posed gesture that emphasizes how he doesn't have to attend to that problem .... they all suggest to me he wants me to know he is much more space-fillng, much larger, and perhaps therefore much more important than the average speaker. 
> Personally, even though his arguments have merit, I find it an uphill battle to credit them when the presenter finds it necessary to spend all that energy conveying self-importance.
> 
> Considering my watching his presentation as me dealing with a medium: this is a good example of how unnecessary resistance can be added to purely detrimental effect.  
> 
> 	--Randy
> 
> 
> On Jan 9, 2011, at 4:42 PM, Jan-Paul Bultmann wrote:
> 
> > Hey,
> > I just wanted to share this with you,
> > it gave me a good laugh.
> > 
> > http://blip.tv/file/2089545
> > 
> > It also has an interesting point.
> > Smalltalk died because you could make a mess too easily. And I think this is especially true to Self, because of its behaviorism.
> > 
> > Cheers Jan
> > 
> >
>





More information about the Self-interest mailing list