
This evening I did an online presentation for the Ft. Lauderdale .NET User’s Group on DataDude Visual Studio Team Edition for Database Professionals Visual Studio Team System Database Edition showing how you can use the refactoring, testing and data generation features to do Test-Driven Development in your SQL Server Databases. I’ve put the slides (which include screenshots from all of the demos) up online (PDF), or you can view it on SlideShare. Enjoy!
Update: The presentation was recorded, and is available here: https://www311.livemeeting.com/cc/mvp/view?id=M3KWN7. No meeting key is required.
See if you can spot the problem with the following C# code:
var list = new List
for (int i = 0; i < list.Count; i++)
{
list.Add(list[i].ToUpper());
}
As the title points out, this will cause an infinite loop, and will eat up all of your memory. What happens is that we iterate through the list once (i=0; list.Count = 3) and then add an element to the list. So the next loop we have (i=1; list.Count = 4). This is because anything in the parenthesis of the for operator will be evaluated every loop.
There are three options:
And the code was a dummy example code, nothing in use in any real system.
For quite a while now, if you want to learn Ruby, you have the Pickaxe book, Why’s guide, and the fabulous Edgecase Ruby Koans on GitHub.
The Koans are especially interesting because all you really need to do is setup a working environment and go. It tells you what you need to do next, by way of running the tests and seeing what passes.
I thought to myself, why the heck don’t we have something like that for other languages? There are some obvious challenges – for example, doing it in .NET it has to be compiled, and some of the things don’t map well. But in the spirit of, “If you’re going to fail, fail as publicly as possible” I’m announcing the launch of the DotNet Koans.
The goal of the project is to eventually have a guide for C#, F#, and VB.NET – likely in that order. Ok, likely the first two, and hopefully some VB’r will jump on the third. Right now I have three of the twenty-five koans ported over – AboutAsserts, AboutNil and AboutArrays. I’ve hacked together a custom runner for xUnit.NET which tells you where you are every time you build.
My goal right now is to get everything ported over pretty much as-is, and then look at making sure this fits a good progression. For example, I don’t know if the Koans will lend themselves to LINQ, but that’s something that should be covered.
The project is now public up on GitHub at http://github.com/CoryFoy/DotNetKoans – feel free to download it, play with it, and contribute (or critique) if you’d like.
Do you know C#? Do you know Design Patterns? Do you know Design Patterns in C#? Well, heck, you just know everything, don’t ya!
For quite a while, there has been a C# Design Patterns Group headed up by Damon Carr. It took a hiatus for a while, but is back in fashion. If you think you know your stuff, now is a great time to head over, because we are in the midst of a Decorator Pattern contest judged by Damon and yours truly.
Here’s the scoop from my post to the list:
We are looking for the best implementation of the Decorator pattern. What is the decorator pattern? According to the Gang of Four:
“Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality”.
To provide some framework to work in, this round is looking for decorator patterns that increment or decrement the price of a given object. For example, the base price of a car might be $5000 USD, and you can add on various aftermarket items like wheels, spoilers or really annoying tailpipes that increment the price. In addition, you might have incentives like a coupon, a discount plan or some other thing that decrements the price of the car.
Note that your implementation does not have to use the above example. You could use houses, boats, or green beans. The main rule is that none of the decorators can be mutually exclusive to cut down on the complexity.
Your application should:
– Allow for selection of a main item (at least one)
– Allow for selection of decorators (to either increase or decrease
the price) (at least 2)
– Calculate the total costWe don’t care if the app is a web app, Winforms, or Console. I care if you used Test-Driven Development, but pay no attention to that, because I’m just a judge, and it’s not like I’ll knock you points for not using TDD. Maybe.
Again, the deadline is March 31st. Prices and Participation may very. 2 week lease at 4% APR with automatic upgrade to Gold-infused Platinum edition at the end of term. Void where prohibited. Must take dealer stock by 3/31/07. Have a nice day if applicable in your jurisdiction.