Practical .NET2 and C#2 by Patrick Smacchia
Uncategorized
TODO or not TODO
Just read “//TODO: Uncomment Later” over at the newly renamed “DailyWTF” (it’s now called Worse Than Failure, and while I understand Alex’s motivation for the name change, I think the original was better…) . It got me thinking; as part of the build process, do you have a task that checks for any TODO comments? (You do use TODO comments, right?) In addition, check out the comments to that post: I love the wolves story, classic!
That post got me thinking, as part of the TODO comment checking task we should also check for commented out code lines. I deplore seeing commented out code that developers have left in the codebase; it’s a warning sign that something smells. That’s what Source Control is for! The only time leaving commented out code is acceptable is to indicate that it shouldn’t be done that way WITH an associated clear and explanatory comment.
When I program against the .NET Framework, I’m happy swapping between C# and VB.NET, although I must confess a preference for C#, having spent many years programming in C. It occurred to me that it would be slightly easier to check for commented out code (without using System.CodeDom) by checking for lines that contain “\\” and “;” or “{” or “}”. OK, it might match a few false positives. What are your thoughts on this?…
Structuring Projects for Team Foundation Server
J.D. Meier has a nice post up on how to structure projects for Team Foundation Server here. He’s also asking for real world practices you use on your project as feedback to incorporate into the patterns and practices guidance.
Crowds, Screws and Software
I’ve recently been reading “The Wisdom of Crowds” by James Surowiecki. It’s a well written, easy to read, intriguing and thought provoking book. It doesn’t contain any heavy mathematics; in fact it contains no mathematics at all, so should be accessible to the widest audience. I would definitely recommended reading this book.
The ‘wisdom of crowds’ refers to collective intelligence, namely how it is possible for a crowd to pick a solution which is better than a corresponding one made by an expert: “when our imperfect judgments are aggregated in the right way, our collective intelligence is often excellent”.
The wide variety of complex problems upon which collective intelligence can be brought to bear, is broken into 3 problem groups: cognition, coordination and cooperation. Cognition problems are defined as those that have or will have a definite solution, such as “Where would be the best place to build this new road?”. Coordination problems require members of a group to determine how to coordinate their behavior with each other, such as buyers and sellers trading at a fair price. Cooperation problems involve getting self-interested, possibly distrustful people to work together, even when self-interest would seem to imply no benefit from taking part, such as paying taxes.
One of the key concepts discussed is the ‘Information Cascade’, a situation where people make a decision based more on the decisions being made around them rather on their own private information, the outcome of which is not always beneficial. I loved the story of one such example, plank-road fever (pg 51)!
[The human brain can be viewed as a crowd; perhaps that’s why when you become expert in a particular field, you can become better still by learning about other fields. Diverse perspectives are more likely to come up with something new, but I digress…]
I came across an example of an information cascade that centers on the humble screw in 1860s America, which was vaguely reminiscent of the ongoing changes we have seen in software development over the last 30 – 40 years. Back in the 1860s, when the machine-tool industry was a rough analogy to the technology industry in the 1990s, screws were individually hand-made by machinists. In the absence of national or industry standards, when a nut or bolt was damaged or lost, either a new one would have to be hand crafted or a replacement sent for from the original builder. This obviously severely limited the possibility of mass-production, and as James notes, it also enabled individual machinists to protect their way of life. As a customer, if you have a reliance on something that is custom made, then you are locked in to that supplier. Here’s the line that resonated with me in terms of the software development industry: “But if the screws became interchangeable, customers would need the craftsman less and would worry about the price more”.
William Sellers, a respected machinist of his era, believed that mass production was inevitable. Over a period of approximately 6 years he designed and promoted a standardized screw that was easier, faster and cheaper to produce than any other. Each new customer he secured meant it more likely that others would follow suite, based on the experience of the predecessors.
James sums up an information cascade as follows: “In a cascade, people’s decisions are not made independently, but are profoundly influenced – in some cases, even determined – by those around them.”
Another Visual Studio Tip
Several months ago, a colleague was editing a file in Visual Studio 2003 and said “…it would be great if you could select a block of text by columns…”. He was therefore a little surprised when I mentioned that you have been able to do this since around version 4 of what was then called Visual C++! If you hold down the ALT key whilst right-click dragging a selection you can select a rectangular block of text. (Ok, I know most people will already know this, but just in case…)
Cool Commands for Visual Studio 2005
I have been using Omer van Kloeten’s Copy/Paste Visual Studio project references between projects for a while and noticed that he had updated his blog to point at another set of add-ins for Visual Studio 2005 that do this and much more. Gaston Milano’s CoolCommands are simply great. If you are not already using them, go and get them from here. You won’t regret it!
Passwords, Passwords, Passwords
Think you don’t need to secure that router? Think again: Default Password List.
I was talking to Nick Randolph (whose been busy updating the Perth .NET User Group web site, more news to follow) and was reminded about the topic of passwords, hence the post.
Visual Studio IDE Tip
Every so often you come across something so useful, so fundamental, that you find it hard to believe you did not know about it! Yesterday was one of those days. I have access to an A3 colour printer where I’m working, so I printed out the Visual Studio 2005 Cheat Sheet that I mentioned recently. I’m making an effort to increase my productivity using the IDE, so in a moment’s reflection I thought I’d have a look to see if there was anything useful that I was not using regularly.
If you paste text using CTRL + SHFT + V, you can cycle through all the entries on the clipboard ring! It means you can do multiple copies of different text then move to another location and have access to them all without jumping to and fro.
I’m assuming I’m probably the last to know about this, but just in case I’m not…
Url Rewriting with ASP.NET
Scott Guthrie has posted what must be the ultimate guide to Url Rewriting with ASP.NET. If you code for ASP.NET, and you haven’t visited Scott’s blog, you will be amazed at the gems in his Tips/Tricks section.
Integrate FxCop into Visual Studio 2005 Build Process
David M. Kean posted a great tip for developers using Visual Studio 2005 Professional, on how to integrate FxCop into the post build process. As he points out, it is not a replacement for the Code Analysis features of the Team editions.