find -name Root -exec sed -i.bak -e 's:/old/path:/new/path:' {} \;. You will also need to be careful if you use a Windows CVS server like CVSNT, since using the ':' as the sed separator will require you to escape the colon in your repository path if you have one. By the way, this will make a backup of each Root file called Root.bak, just in case you don't trust it (and why should you...:P)Sunday, November 21, 2004
Re-routing CVS repositories
Thursday, November 18, 2004
Star Wars on the (really) small screen
But having picked up a 1Gb SD card for next to nothing, I thought I'd investigate the supposedly forthcoming phenomenon of pocket movies. Microsoft has been making some noise about their new portable devices that play movies, but you don't need one of those. You just need a copy of this software and you're done. In about the time it takes to watch the film, it's converted to a 250Mb AVI at 320x240 resolution. That's 15 frames per second at a resolution that's higher than your TV, so it's pretty darn watchable. There is a slight weirdness to the screen when rotated to watch in landscape mode, probably because the RGB subpixels on the LCD or up/down aligned in this mode, but you get used to it.
So having recently picked up the Star Wars box set to relive my childhood like all the other 30-something males on the planet, but not having time to scratch myself like all the other 30-something males on the planet, I can now squeeze this necessary pastime into my morning commute and leave all the iPod weenies wondering why exactly they think they're so cool. Rock on.
Why I Hate Domain-Driven Design
If you'd like to share the joy, as usual my recommendation is to get it on the cheap at Safari
Thursday, October 7, 2004
Power Pointers
I often get asked how I go about doing a technical presentation, so I thought I'd put down a few pointers for those who would like to do some presenting but think it's all a bit intimidating.
- Have something you want to say. This is generally not a problem for most serious geeks, although it's surprisingly common to find many who have incredible experience and insight but think nobody is interested in what they might say. That is almost never the case, either, since all of us are sponges for good stuff of all kinds.
- Care about your audience. It's important to really want to connect with the audience and make them feel important. Even in a stand and deliver situation, I often survey the audience to get a feel for their likes, dislikes and interests. This can help you focus on what they need and want over what you thought they might like.
- Don't start in PowerPoint. I never, ever begin my presentations by opening PowerPoint and looking at a blank slide. I always open a Word document instead and switch to Outline View. Then I just start brainstorming, imagining I'm having a one-on-one conversation with someone, explaining the topic at hand. No structure is present yet. It's all about noting down all the things you might want to say first. Then it's a matter of learning to use the outline view's features of indenting, outdenting, dragging and dropping to apply some structure to the thoughts. This is very much like the test, code, refactor cycle in development of code. The test is that you can explain the idea. The code is recording the points you need to do that. The refactoring is cleaning up the structure. And just like coding, it works really well if you treat these as distinct tasks and switch between them cleanly.
- Generate the slideshow from the outline. Once you're done in Word, just hit File->Sent to->PowerPoint and voila! All your top level headings become slides, and the subpoints become bullet points underneath them. You can then click Format->Apply Design Template, go looking for a pre-canned slideshow and bingo! your show is just about done without a single tedious minute in PowerPoint itself. If you have time, add some pictures and animation, but remember they're the icing, not the cake.
- Less is More. I much prefer slides with fewer words on them. I do not consider a slide to be of any value without me in front of it to turn it into the presentation experience. Resist the temptation to turn a slideshow into a whitepaper. It's just there to remind you what you wanted to say and help the audience to follow; it's not there to say it for you!
- Remember that nobody finds it easy. Public speaking is daunting for everyone, and I do mean everyone. I sweat bullets for days before an important presentation, but once it starts it's almost like it's someone else doing it, not me, and in a way it's easy. If you're serious, look into Toastmasters for some training (I did it 20 years ago and am still grateful) or try your hand at a low-risk venue like a user group or other friendly and supportive environment.
- Have fun!
Wednesday, September 15, 2004
Smell the Tests!
When you are faced with a team that's new to agile development, it's common to spend a lot of time driving home the need to test everything. Along with refactoring, test-driven (or at least test-conscious) development is the most basic skill the aspiring extreme programmer must acquire. We strive to testability in design and the cheapest, most effective quality we can get. So is there such a thing as bad testing? Can tests hinder more than help? Can tests just be a downright pain in the rear?
The answer is a resounding YES! YES! YES!
Just because you code in an object-oriented language does not guarantee that what you write will contain any object-oriented characteristics whatsoever. Similarly, just because you write JUnit test cases does not guarantee that what you produce will display any of the qualities of an effective and adaptable test suite. Naive application of testing frameworks has the same potential for developers to exercise their bad judgement and bad taste as any other technology. Now while I'd certainly rather have a project with lots of less than ideal tests than no tests at all, we need to learn to 'smell the tests' to really get the most out of our (and our customers') investment in testing.
So here are some of the smells that tests can emit. I'm sure you can think of more, so please drop me a line so I can share your pain...:P
- No statement of intent. If I have a Widget with a getPrice() method, I often see a testGetPrice() test method, and my first thought is "test getPrice() does what?". Prefer names for tests that express the intention of the test, such as testGetPriceReturnsZeroWhenNotInitialisedExplicitly(). There are tools that can turn your test names into human readable documentation, so don't be afraid of full-length sentences as test method names.
- Irrelevant assertions. It is common (particularly in functional tests) for a test that is concerned with proving a small incremental behaviour to make irrelevant assertions about all sorts of other fields, even on other screens. Prefer semantic generalisations over value-specific assertions. For example, if your test is not concerned with the actual price algorithm, don't assertEquals("46.12", widget.getPrice()) when you can say assertNonZeroMonetaryValue(widget.getPrice()) - even though it's a bit more work at first.
- Setup leakage. It is extremely common for developers new to testing to not easily be able to distinguish the concerns of their test from the setup steps required to get them to the point where their test can begin. The newly test-infected developer can thus create maintenance burdens and simply waste time reinventing the testing wheel with every test case. Strive for a clear separation between setup and test, and look for reuse in the setup code via fixtures and scenarios.
- Overtesting. Many developers find it difficult to focus only on what is relevant to the test at hand. It is not only more efficient to assume the rest of the system works when writing a new test, but it also improves maintainability as each test is more isolated and targeted. It is common for developers to turn themselves into knots to get controlled input and output moving between different components when a mock would be faster and more effective. Leave it to the other tests to do their job and assume away responsibilities that are not yours right now for the code under test.
- Multi-layer tests. Unit tests should rearely (if ever) traverse multiple layers in your design. A sure sign that they do is when they run slowly. Unit tests should run in the thousands per minute kind of rate, while functional tests tend to be in the 30-50 per minute range, so prefer unit tests to achieve coverage and functional tests to prove wiring of configured components.
- In-container unit tests. T'ain't no such thang. Don't make sense. If you think you have some, that's a smell. :)
- Fractured functional tests. Adding functionality a small bit at a time leads to functional tests with a lot of overlap and there is no force to encourage the consolidation of these tests other than slow build speed. I'm not sure how to fix this one other than slow slog refactoring. We have a lot of this joy ahead on our current project!
None of this alters my belief that test-driven development is the best method I know for building quality software. But it does mean that (once again) we need to be careful about silver bullet syndrome when it comes to testing.
Sunday, August 8, 2004
Have Hair Dryer, Will Boot
So being a software guy, I rang my buddy the hardware guy and told him my story, of how the box had been running happily for 18 months without being turned off, then it was shut down for a couple of weeks during the house move/new baby transition. "Ah-hah", says he, "just get out the hairdryer and heat that drive up for 20 minutes; it'll boot first go". And bugger me if he wasn't right on the money! A quick plug in of a new drive onto which I ghost-ed the dying one, switcheroo and off we go.
Phew!