# Saturday, September 26, 2009

We have been hosting Grok Talks at Sogeti since my arrival. Recently we decided to make them available via LiveMeeting and record the presentation. Here is a Grok Talk from September 23 2009.

In this presentation, Sogeti Principal Consultant Dr. David Truxall discusses the challenges of debugging and how to use WinDbg to debug production issues.

.Net | Grok Talk | Sogeti | Video
Saturday, September 26, 2009 4:09:26 PM (GMT Daylight Time, UTC+01:00)
# Friday, September 25, 2009

Episode 54

Kirstin Juhl came to software development from a career in manufacturing, where she learned about Lean principles. Now she sees those same principles being applied to software development. In this interview, she describes Lean in both worlds and compares the two.

Friday, September 25, 2009 12:24:22 PM (GMT Daylight Time, UTC+01:00)
# Wednesday, September 23, 2009

Episode 53

Joe Kunk is writing a chapter covering XTraReports for Paul Kimmel's upcoming DevExpress tools book. In this interview, Joe describes XTraReports and how to use it.

Wednesday, September 23, 2009 5:10:51 AM (GMT Daylight Time, UTC+01:00)
# Tuesday, September 22, 2009

I count many software developers among my friends and colleagues. Many of them tell of writing code in high school or earlier; of hacking during junior high school; or of knowing their career path at an early age.

My programming career began much later in life. Because I grew up with no inkling what I wanted to become, I majored in biochemistry as an undergrad and I studied finance in graduate school. During my eight years of matriculation, I kept busy working as a laborer for a construction company, coaching a high school wrestling team, selling financial securities, interning for a commodity trading advisor and painting. After four years attending grad school at night and working two jobs, I took my MBA and went to work doing accounting and financial analysis for a printer manufacturer. I spent almost four years at this job and it rarely changed. I learned almost nothing after the first year and found myself mightily bored.

At the time, it seemed like misfortune, but I was laid off from this job when the economy turned south and my employer sold off a large subsidiary. Months of job searching during the recession of the early 1990s left me feeling discouraged about my prospects. So I took this as an opportunity to change careers. I had taken a couple programming classes before and I had done well and enjoyed them, so I enrolled at the local university to study Computer Engineering. Sometimes the curriculum was difficult. For example, every other student in my Calculus 4 class had taken the prerequisite class the semester before.  I had taken it nine years earlier.

After two semesters of straight A’s, I was prepared to pursue a degree in Computer Engineering until the phone rang between semesters. It was an old friend of the family calling. He owned a small company in Cincinnati, had heard I knew something about computers and was looking for someone to help him with his computers. I had never been to Cincinnati before, but the offer was good and he was willing to pay for my training so I accepted and moved. Six months later, my house in Michigan sold and my family joined me.

I was a novice at that time and I knew it. I worked my tail off to learn everything I could about networking and programming and computers in general. On most days, I was the first to arrive and the last to leave work. I would get up early and drive in on Saturday to work a few hours before my family woke up. I worked at that company for five years. For most of that time, I was the entire IT department. I managed a LanManager network that I converted to a Windows NT network; I ran a call center of data input operators;  I was the company’s primary computer help desk; I evaluated and bought personal computers and servers and printers; and I wrote all the company’s custom software.

Of these tasks, writing software appealed to me most. In programming, I had the ability to learn technical skills, to practice logical thinking, and to exercise my creativity. It gave me the opportunity to exercise all parts of my brain. I decided I wanted to focus most of my energy on programming.

At that time, my language of choice was FoxPro, which gave me a chance to build Windows user interfaces and to learn about relational databases. I learned about language constructs and programming algorithms and naming conventions and frameworks. I would stay up late into the night reading programming books and technical journals. I enjoyed learning about programming far more than I enjoyed accounting or finance.

When Visual FoxPro was released, I redoubled my efforts, trying to grasp the concepts of object oriented programming and deciding when to use inheritance.

After five years, I got the opportunity to join a local consulting company, where I could focus on software development and training. I would rotate between teaching classes and building business solutions. This was another great learning experience: Teaching made me a better programmer and programming made me a better teacher.

This consulting company was known for its FoxPro expertise but we did a fair amount of Visual Basic programming and I was able to learn my second language. When Microsoft released ASP and Visual InterDev, I learned that and began teaching a class in web development. I taught that class more than any other.  I learned about XML in 2000 and began applying it anywhere I could, like a hammer looking for a nail.

Unfortunately, the company I worked for made some poor business decisions and people began to leave – first the customers, then the consultants. I followed a friend to G.A. Sullivan (aka GAS), a medium-sized consulting company in Cincinnati. I was attracted to GAS because of all the talented developers they had on board already.  Where my old employer seemed to be drifting from day-to-day, the new group had plans. They managed projects with efficiency, they had in-house experts in numerous areas; and they were well-respected by their customers and by other development shops. Not only did I learn a great deal of technology (I was at GAS when I did my first .Net project) but I first began to do public technology presentations at that time. I spoke in front of customers and at the local VB user group (later reborn as CINUG).

To this day, I have not worked with a group as talented and tight as the folks at GA Sullivan. Most of us have moved on, but I remain close friends with a number of my former colleagues from those days.

After a couple years, GAS was purchased by Avanade, a large multi-national consulting company started as a joint venture between Accenture and Microsoft. With such enormous parents, Avanade was able to go after much larger customers. During my years there, I traveled a lot but I was able to work on a number of large enterprise applications, which helped me in understanding scalability, security and how to navigate the bureaucracy of a large corporate environment.

I had my first exposure to Rules Engines, Workflow Foundation, Unit Testing, and Continuous Integration on various projects for Avanade. I spent over a year focused almost exclusively on BizTalk Server, diving deep into Microsoft integration technologies.

I wrote very little code my last year at Avanade as I led a team designing an e-commerce integration project. Instead I got experience writing design specifications and developing project plans for a waterfall project.

In 2007, I left Avanade because I wanted to spend more time with my family. I took a job with Quick Solutions Inc. (QSI) because I was impressed with the smart developers I met there and I admired their passion working and speaking in the community. I got back into coding working on an ASP.Net portal project. I also had a chance to learn from some smart people about Agile development methodologies, Team Foundation Server and the database tools of Visual Studio. Being closer to home allowed me to spend time with the developer community.  For the first time in years, I began actively speaking at conferences and user groups and participating in user groups. In 2008, following a change in ownership, QSI decided to get rid of all their consultants outside of Columbus, OH. 

A year of being active in the local community made it easier to find a new job and I joined Sogeti, my current employer. While here, I’ve worked in a variety of industries and even did my first SharePoint project. I’ve kept active in the development community, in part as a way of expanding my own knowledge of technologies.

I’ve had a number of stops over the past 15 years and I’ve learned something new everywhere I’ve been. Looking back, losing my job as an accountant was a good thing for career and my life.  

Tuesday, September 22, 2009 5:06:01 AM (GMT Daylight Time, UTC+01:00)
# Monday, September 21, 2009

Episode 52

Often, an application experiences a bottleneck retrieving and delivering data from a database. In this interfview, Jeremiah Peschka discusses ways to troubleshoot performance issues within a database.

Monday, September 21, 2009 12:29:45 PM (GMT Daylight Time, UTC+01:00)
# Sunday, September 20, 2009

I have been working for Sogeti for almost exactly a year now and I'm proud to announce that Microsoft has awarded our team the Partner of the Year award. Although the award goes to the entire unit, it was given for a SharePoint intranet portal produced for Oakland County and most of the work on that project was done by Mike Hacker.

Congratulations to Mike and to Sogeti on this prestigious award.

You can read more about this at http://us.sogeti.com/news/2009/08/31/sogeti-usa-wins-2009-microsoft-central-region-part/

Partner of the Year award

Sunday, September 20, 2009 1:37:30 AM (GMT Daylight Time, UTC+01:00)
# Wednesday, September 16, 2009

Episode 51

Chris Hay is a Scotsman living in Cambridge, England. He has made several trips this year to developer conferences in North America. In this interview, he discusses what goes into a good presentation and how developer communities in the UK differ from those on my side of the ocean.

Wednesday, September 16, 2009 12:55:17 PM (GMT Daylight Time, UTC+01:00)
# Tuesday, September 15, 2009

When I work on a project and I hear advice from others, I’m reminded of all the advice I heard the year my first son was born.  Often one recommendation would directly contradict another. They couldn't all be right, could they? In the end, I decided there are multiple correct ways to raise a child so I followed my own instincts each time I had to make a decision. 

Software design and development are full of decisions – some big and some small. We argue passionately over these decisions. We agonize over them, sometimes even after we make them.  Here are just a few examples

    • Web forms or MVC?
    • ASP.Net or Silverlight?
    • ADO.Net or ORM?
    • Web Services or Remoting?
    • Visual Basic or C#?
    • .Net or Java?
    • Comments evil or comments good?

But are these decisions worth agonizing over? In many cases, they are not.

In my professional life, I have argued vigorously many times for architectural points I believed were correct. Some choices were small and some were large. Sometimes I won and sometimes I lost these arguments. But I accepted those decisions because I recognize that there are multiple right answers to almost every question.  In almost every lost argument, the decision we settled on was good enough to get the job done.

I recognized that the important thing was to commit to a plan of action and move forward with it as a team.

Occasionally I’ve seen colleagues pout over a decision they did not buy into and use that decision as an excuse for failure. This is a self-fulfilling prophecy. A divided team is unlikely to succeed regardless how they design their project.

I am not trying to justify bad decisions. Some mistakes can be fatal and are inexcusable. These should be escalated up the command chain. But the vast majority of software project decisions are not life-threatening – even if they go against our thinking. We may grumble that our path is not optimal, but a decision that moves the project forward is acceptable.

There is very little dogma in software development. Your view works for you but it may not be best for the team or the project. And even if it is best, that doesn’t mean other views will not solve the same problem. Here are some guidelines that I use.

  • Time-box your decisions.  Commit to a decision by a certain date.
  • Don’t feel the need to explore every alternative. Generally speaking, time will not permit this.
  • Pick a good solution that meets your needs. Don’t be swayed by those who insist it is not the absolute best. It’s better to move forward with a workable solution than to delay a project indefinitely in search of the best solution.
  • Debate openly and honestly. Be respectful but recognize the pros and cons of each alternative.
  • Don’t make it personal. Just because someone disagrees with you doesn’t mean he is attacking your intelligence or integrity.
  • Keep an open mind. Consider that there may be an alternative solution with advantages you have not considered.
  • What worked on another project might not be appropriate for this project. Always consider decisions in the context of your current needs.

The overarching theme of this list is you should find a solution that works for your problem and move on, without wasting excessive time doing so.

And for the record, my newborn son is not 18 years old and had turned out better than I ever hoped.

Tuesday, September 15, 2009 4:36:55 PM (GMT Daylight Time, UTC+01:00)
# Monday, September 14, 2009

Episode 50

In this interview, Nathan Blevins describes how to program Microsoft Robotics Studio to control robots via programs written in Visual Studio.

Monday, September 14, 2009 1:29:21 PM (GMT Daylight Time, UTC+01:00)
# Sunday, September 13, 2009

Back To Basics

The yield return and yield break keywords are shortcuts introduced in C# 3.0. They are designed to assist you in a method that returns IEnumerable <T>.
Often such methods consist of the following steps

  1. Create an empty IEnumerable set.
  2. Loop through some data (via a while, foreach or other construct)
  3. Add to the set within your loop.
  4. Exit the loop when some limit is reached.
  5. Return the set.

A sample of such code is shown below.

public IEnumerable<Int32> GetOddNumbers_Old(Int32 maxNumber)
    List<Int32> oddSet = new List<Int32>();
    int num = 0;
    while (true)
        if (num % 2 == 1)
            oddSet.Add (num);
        if (num >= maxNumber)

    return oddSet;

The new yield keywords allow you to shorten your code to only the following steps

  1. Loop through some data
  2. yield return within the loop
  3. yield break if a limit is reached before the loop is complete

That’s it. There is no need to explicitly create or return your IEnumerable set.

The yield return statement appends a value to the IEnumerable set. The yield break statement exits any looping construct to prevent more items being added to the return set. If you omit yield break, the loop exits as it normally would.

The difference between using the yield return and simply returning a set is subtle. Returning a set at the end of the method returns the entire set at once. The client must wait until the method is complete before it can use any values in the return set. Each time the yield return statement executes, the client has access to another element in the set. Essentially the set trickles back a little at a time. This can provide a gain in performance or perceived performance if you have a large set to return.

Here is a sample that returns the same results as above, using yield return and yield break.

public IEnumerable<Int32> GetOddNumbers_Yield(Int32 maxNumber)
    int num = 0;
    while (true)
System.Threading.Thread.Sleep(1000); num++; if (num % 2 == 1) { yield return num; } if (num >= maxNumber) { yield break; } } }

If we call the two methods above, we will get the same results but they will return in slightly different ways. I added the System.Threading.Thread.Sleep(1000); line to help demonstrate this. That line simply pauses execution for 1 second each time the loop executes.

Assume the above two methods are in a class named MyMethods.  The following code will call each.

Console.WriteLine("Get Odd Numbers using old way:");
MyMethods mm = new MyMethods();
IEnumerable<Int32> oddNumbers2 = mm.GetOddNumbers_Old(11);
foreach (Int32 n in oddNumbers2)


Console.WriteLine("Get Odd Numbers using new YIELD keyword:");
IEnumerable<Int32> oddNumbers1 = mm.GetOddNumbers_Old(11);
foreach (Int32 n in oddNumbers1)


The above code produces the following output

Get Odd Numbers using old way:

Get Odd Numbers using new YIELD keyword:

Notice that both methods return the same data. However, if you watch the code as it runs, you will notice the first method waits 12 seconds, then immediately outputs all odd numbers; while the second method outputs a number every 2 seconds. Each method returns the same values and each takes the same amount of time, but the second method uses yield return, so the client is able to output a bit of data each time a yield return executes.

There are a few restrictions to using the yield keywords

  • These keywords cannot appear in blocks marked "unsafe"
  • These keywords cannot appear in a method with ref or out parameters
  • The yield return statement is not allowed inside a try-catch block, although it may be located inside a try-finally block.
  • A yield break statement may not be located inside a finally block.

You can download this sample code at DemoYield.zip (45.06 KB)

Mike Wood contributed to this article.

Sunday, September 13, 2009 2:44:07 PM (GMT Daylight Time, UTC+01:00)