Blog by Troy Magennis on Software Architecture, Development and Management

About the author

Troy Magennis is a software developer living in Seattle, WA. Troy is a Microsoft MVP, the author of many articles, and the founder of, a LINQ specific wiki reference site.
E-mail me Send mail


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2014

Focused Objective - Software for Kanban and Scrum Simulation

I've started a new business called Focused Objective. It is a software and services business that aims to make the management techniques of modeling and simulation applicable and easy for software development projects and portfolios.

What we offer - Tools that effectively model Kanban and Scrum projects to get accurate forecasts of cost, delivery dates and staff requirements. Modeling using Monte-carlo simulation allows rapid what-if analysis to find options that minimize cost and delivery time, whilst maximizing revenue. Simulation lets you hit target delivery dates, and shows the impact of hiring (or losing) staff with certain skillsets, taking software project leadership to a new level of maturity.

As a CEO or Investor
  • Make informed portfolio/investment decisions with reliable estimates
  • Get reliable answers on questions related to IT project timelines
  • Know the true likelihood of success or delay at the earliest possible time
  • Understand the true capacity of your IT organization—promise confidently
  • Know what factors are reducing your organizations capacity
  • Plan staff levels and skill balance for future projects early enough to help
As a project manager or team lead
  • Give reliable estimates—show true understanding of likely eventualities
  • Justify staffing decisions with data—know what skills to hire
  • Help your teams balance work across skillsets, and buy-in to estimates and forecasts


Posted by t_magennis on Sunday, December 04, 2011 11:34 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Forecasting and Simulating Software Development Projects

I've started a new company (Focused Objective) and published another book on the topic of Monte-carlo simulation of software development projects and portfolios. It covers introductory and advanced simulations using the new language SimML. If you want to understand how to employ simulation to make better staff, cost and date forecasts, this book will help you.

Its available from Amazon here -

 Forecasting and Simulating Software Development Projects: Effective Modeling of Kanban & Scrum Projects using Monte-carlo Simulation.


Posted by t_magennis on Sunday, December 04, 2011 11:27 AM
Permalink | Comments (0) | Post RSSRSS comment feed

LINQ to Objects usig C# 4.0

It has been a while since i've posted. Two main reasons -

1) I started a new job and moved states, I am now VP Architecture for (and and 

2) I finished a book on LINQ which is going to press as we speak -

Title: LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ)
Paperback: 300 pages
Publisher: Addison-Wesley Professional; 1 edition (March 20, 2010)
Language: English
ISBN-10: 0321637003
ISBN-13: 978-0321637000

It is ready in Rough-Cut form online at Safari, and available for pre-order on Amazon -

Read the Rough-Cut on Safari right now!

or pre-order it on Amazon (due early 2010 to co-incide with Visual Studio 2010 release).

Tags: ,
Categories: LINQ
Posted by t_magennis on Sunday, February 07, 2010 7:56 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Zip - New LINQ to Objects .NET 4.0 Operator

When looking through the .NET 4.0 framework bits given out at the recent Microsoft PDC conference, I discovered a new operator - Zip

Zip combines the elements from two sequences, by making available the element at the same index position in each sequence. The sequence stops as soon as one of the sequences exhausts its elements; ideally, the sequences are identical in length. The merging happens in the func function. It takes two arguments (the element from foe first source, and the element from the second source) and lets you return a combined type.

The extension method signature is:

public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult>(
  this IEnumerable<TFirst> first, 
  IEnumerable<TSecond> second, 
  Func<TFirst, TSecond, TResult> func);

Sample usage:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZipTest
    class Program
        static void Main(string[] args)
            string[] s1 = new string[] { "a", "b", "c" };
            int[] s2 = new int[] { 1, 2, 3 };

            var q = s1.Zip(s2, (a, b) => a + b);

            foreach (var e in q)

            /* Output:
             * a1
             * b2
             * c3


Categories: C# | LINQ
Posted by t_magennis on Monday, January 05, 2009 5:56 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Google Chrome: about:stats Diagnostic Page/Easter Egg

If you are trying out Google Chrome, type about:stats into the address bar and hit enter. You get:


In a previous post I wrote how adding features to a product to assist in debugging issues pays dividends; its great to see others also using this technique. This page/feature is obviously for determining and optimizing memory issues and performance stats. I wonder how many other "address-lets" like this there are built in?


Posted by t_magennis on Tuesday, September 02, 2008 10:53 AM
Permalink | Comments (1) | Post RSSRSS comment feed

Google Chrome - First Thoughts

Google announced and released their Chrome browser today.

This post is from Chrome, and it does seem to work on most sites i've looked at - however, there are many rendering issues that aren't issues in Firefox or IE. Some examples can be seen on my LINQ Wiki site (Hooked on LINQ) where the spacing between adjacent span's seems squashed, and the order of table cells seems to be incorrect (OK, different) than the current popular browsers. It is a beta after all, but google have said the rendering engine is closest to Apple's API, and I must admit, my sites are less tested on Safari (in fact, not really at all).

This brings up an interesting Product Management challenge. If peoples first impression is that sites they frequent are "broken" in Chrome - will users persist with that product. Gmail is still in "Beta" which is a bit farsicle given its time in the market, so understanding what Google actually means by "Beta" is difficult to judge - But - Chrome is definately BETA!

What works

- I like the "common pages" layout of a New Tab. Rather than just a blank tab, you get previews of common sites you frequent

- I like the developer javascript and page analysis built-in features (think Developer Toolbar)

What Doesn't Work

- Rendering issues on many sites that I find work in Firefox and IE

- I'm sure this wasn't a high-priority item for Google, but I struggled to get a Silverlight app to run. I went to Hardrock Cafe, and it almost ran (showed images, but couldn't zoom, pan, etc). I think Silverlight was installed OK (no mention of anything being downloaded), but in general - no luck here.

I'm most interested to see how Google will leverage this browser as a runtime for applications. They spend some time saying how they want applications running in Chrome to be more "Desktop Like" - my point would be, why not make them Desktop Apps! Solve the deployment problem, and write well coded Smart Client interfaces.


Categories: Software Business
Posted by t_magennis on Tuesday, September 02, 2008 7:52 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Building in support features to applications

Some business rules are complex to capture, and codify into an application. Some examples are when there is company policy that is interpreted (hopefully minimally) slightly differently by different parties, or requires complex analysis when the new system "gets it wrong!".

One example I came across was the logic surrounding whether or not a banking loan application falls within an automated decision process or whether it has to be manually assessed. We took three releases to satisfy all the different business stakeholders. Our issue wasn't so much the actual rule coding, but the actual individual circumstance that swayed the rules engine one way or the other given individual interpretation. Our output of true or false didn't give us any understanding (or the end-user) as to why a certain decision was made.

In the second release, I added a right-click menu item to the "Calculate…" button. This menu allows the user (normally under the direction of the help-desk) to perform the calculation AND populate the Windows Clipboard with a small text based diagnostic report detailing the following aspects –

1.   The data it is ACTUALLY using for the decision – in many cases we were incorrectly gathering this data, making our result difficult to predict
2.   A step-by-step progress – Step 1 (Parties over 18 years old) : PASSED, Step 2 … etc…
3.   The date, time and user logged-in
4.   The version numbers of all assemblies and rules loaded

The end-user would then email this to our team as part of an "In My Opinion – You Got it Wrong" bug report. These reports allowed our Business Analysts to quickly isolate an issue, or more commonly a mis-understanding by the end-user as to actual bank policy! We quickly took a major unstable area and by the next version reports were almost zero (at least a 95% decrease in one release).

The key takeaways for me were –

1.   When a feature has many stakeholders, or the feature might be complex to remotely diagnose – consider adding some features to support the help-desk gathering the information you need to improve that feature over time
2.   Building diagnostic reports into the Clipboard was a very low impact way of getting data from end-users, and was easy for the helpdesk to explain
3.   Make the features obscure (although easy for the help-desk staff to tutor end-users). You don't want these features negatively impacting the user experience for normal cases
4.   Consider privacy issues. Only expose underlying data that you actually need. No personally identifiable medical results :-)


Posted by t_magennis on Tuesday, September 02, 2008 7:40 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Google Chart API

Old news to many, but Google has a Charting API that allows the creation of numerous chart types via a formatted URL string. The Google Chart API returns a .PNG file which is easily embedded in an image tag. If you want to embed charts into your web applications, this chart API might help get you to market quicker.

The idea is simple enough - create an API which returns an image given a specially formed URL. Values can be specified in-line, or encoded to make them more manageable. There are too many chart types and options to document here, but Google's documentation for this API is pretty extensive. I'm impressed with the approach and simplicity. I'm also impressed with the breadth of chart types and the number of options available. In general - they just look plain cool!

Although the API is pretty easy to drive natively, there is also a .NET Helper Library called ngchart which simplifies the API's from native .NET code.


Enough talk - some examples -|February|March|April,80,60,30,30,30,10,30,60,70,90,95,100|20,30,40,50,60,70,80|10,30,40,45,52|100,90,40,20,10|-1|5,33,50,55,7&chco=3072F3,ff0000,00aaaa&chls=2,4,1&chm=s,FF0000,0,-1,5|s,0000ff,1,-1,5|s,00aa00,2,-1,5,edf0d4,6c9642,365e24,13390a&chd=s:fSGBDQBQBBAGABCBDAKLCDGFCLBBEBBEPASDKJBDD9BHHEAACAC&chf=bg,s,eaf7fe&chtm=usa&chld=NYPATNWVNVNJNHVAHIVTNMNCNDNELASDDCDEFLWAKSWIORKYMEOHIAIDCTWYUTINILAKTXCOMDMAALMOMNCAOKMIGAAZMTMSSCRIAR&chs=440x220&cht=t

Posted by t_magennis on Monday, August 04, 2008 3:18 PM
Permalink | Comments (1) | Post RSSRSS comment feed

DfM for Software (Part 3) - Building and Measuring the List of Factors

In the previous articles on dFM, we covered the basic concepts and how to determine the basic factors. This posting explains a simple process for building a matrix from these factors that will allow you to "cost" a scenario. A "scenario" is an option for building and architecting a software application. We then score this scenario using a score-card (described here), to compare the various scenarios.

This is a common weighted scoring system for decision support. Its not a perfect system; the subjective weighting are controlled to a degree by a democratic voting system, but a single factor could still play an unfair pivotal role in a final score for a potential scenario. This technique is shown to spark some ideas, not as a prescriptive technique.

Step 1 -  Brainstorm a set of factors that influence - cost, time, performance, security, and reliability.

Brainstorm the factors

Step 2 - Group similar factors under a topic heading

Many of the brainstormed factors can and should be measured by one metric. An example might be the number of web servers, and the number of database servers. This can be joined under the single topic heading "Number of Servers Required"

Group the factors 

Step 3 - Build the "Scoring Matrix" for each group.

The complexity in this step takes an absolute measurement and maps it to a simple 1 to 5 score. All measures should be 1 being lowest "cost, effort, time, best performance, most secure, most reliable" and 5 being the opposite direction.

(These are just very simple samples. The list and scores are completely fabricated in this picture)

Build scoring matrix

Step 4 - Determine the factor weightings (what is more important than what)

I have three basic approaches for this -

  a) You just decide relative importance and allocate weightings subjectively! Great if you can get away with it, but the intention of Design for Manufacturing is to find the "best" design from a balanced set of design objectives. If we just designed software for ease of development, we may not fully consider the operational aspects and the cost of ownership over time.

  b) Paired Options (or Pairwise comparison): Get the group of people representing different domains of expertise (operations, development, business, marketing, sales) together again and have them vote A versus B, A versus C, etc. to determine what is more "important" to that person. Take an average measure of the room (more think A is more important than B). Total up the number of votes for each factor, and determine what percentage that total is of the entire selection. % weight = (count / total pairs (15) ) * 100


  c) * my preferred* Stack ranking: Get each representative from each domain specialist (operations, developers, business, storage, etc) to stack rank the factors, most important to least important. This will uncover and account for individual biases. It is my preferred method because it also allows people to say "No Impact" for a specific factor on a "perspective" of the factor. Total up the relative ascending score (assign 1 to the lowest row that was a factor, and 2 to the next one up, and so on) and determine what percentage that score is of the total points available. This will look something like this -


Consider doing this for more than one perspective. E.g. As far as Cost, how would you rank importance. As far as time to market, how would you order these factors. What you are looking for is a way to mathematically represent that one factor has a much higher impact on a desired delivery "factor". Some axis of ranking might be:

    1. Capital expenditure - Upfront cost

    2. Operational Expenditure - Ongoing costs

    3. Time to market - How quickly can it initially be developed

    4. Performance - hitting agreed service and performance levels

    5. Security - what factors make a system more secure

    6. Reliability and Stability - what factors make a system able to handle failure more gracefully)

Whatever method you employ, the outcome needs to be a table of the factors, and a weighting multiplier, E.g.

    Number of Servers Required - 24%

    Bandwidth - 20.6%

    Searches / sec - 10.3%

    Number of Deployment Items - 17.2%

    Number of Third Party Components - 13.7%

    Number of Features - 13.7%

Step 5 - Score a Scenario and Multiply By Weights

Break out excel. Use the scoring sheet from Step 3 to score a scenario. Multiply each score by the weights determined in Step 4. Total all of the weighted scores. Do this for other scenarios to compare.

In the next installment of this article series, i'll demonstrate this basic technique with some real examples and prepare a final spreadsheet template you might find useful in doing your own option analysis.


Posted by t_magennis on Tuesday, July 22, 2008 1:05 PM
Permalink | Comments (0) | Post RSSRSS comment feed

ExecuteQuery Tooltip - The worlds longest?

I had a need to execute a SQL statement using LINQ to SQL. Its a long story, but I couldn't use the LINQ to SQL Designer because I was calling a SQL Server 2005 System View. So, I just decided to use the DataContext.ExecuteQuery method. It was a welcome surprise when the intellisense tooltip filled the screen for the first parameter "elementType" -


Actually, the tooltip really helped. It explains the rules and priority of how the return resultset is mapped to the type you specify. To paraphrase, even though my type doesn't have LINQ to SQL attributes on each property, the system will still attempt to match properties to result columns using a variety of methods.

  1. If a field or property is matched to a specific column name, that column is expected in the result set
  2. If the field or property is not matched, a column is expected with the same name in the result set (first Case Sensitive search, then case in-sensitive search)

It goes onto specify the rules about change tracking, primary keys, etc.

A lot to read, but definitely saved me a having to hunt around for the necessary information. Nice work to whoever spent the extra time going to this detail; it shows they really thought about what someone would need when they used this method for the first time.

It could have been "elementType: The element type." if i'd been writing it :-)


Categories: C# | LINQ
Posted by t_magennis on Tuesday, July 15, 2008 10:46 AM
Permalink | Comments (5) | Post RSSRSS comment feed

Visualizing Code Change Impact and Database Dependencies

Its often difficult on large projects to keep track of all the additions as a system grows. When a project grows, it gets more difficult to keep all system drawings accurate and correct. If a drawing isn't automatically generated, then you can have little faith that it is absolutely up-to-date.

The alternative is to write tools that examine the code and draw representations of the systems continuously. This can be part of a nightly build, or a tool that can be run on-demand in order to make better decisions, resolve design issues early, and identify impact of changes.

In this instance I was having trouble keeping up with what Web Services we had; What Stored Procedures they relied upon, and what SQL Server tables those Stored Procedures depended upon.

The application we wrote in a couple of days simply hunts through all *.cs files and uses Regular Expressions to find applicable code. It then uses Microsoft Research's Graph Drawing Tool "GLEE" to visually represent it. GLEE is incredibly easy to use and integrate. The following screen-shot (with the sensitive names removed) took less than 15 lines of code to produce (and a few hundred to do the Regular Expression hunting).


A side-benefit of this tool is that it forces the team to conform to the coding standards. If they want their new code to be incorporated into the latest drawings, follow the patterns provided.

Its great to come into work each morning and see what has been added, and to ensure that the cross-coupling even at the database level isn't going to cause use duress later in the project. We can quickly see what a DB schema change will impact. Sleeping much better now....


Posted by t_magennis on Tuesday, July 15, 2008 10:30 AM
Permalink | Comments (5) | Post RSSRSS comment feed

Determining SQL Server Object Dependencies for a Stored Procedure or Other Database Object Name

Finding what dependencies a Stored Procedure has on underlying tables, views, functions, etc is often necessary when trying to assess the impact of a change. SQL Server has built-in functions that will indicate in most cases a dependency for any object in the database. The system view "sys.sql_dependencies" is viewed with skepticism by some people who have obviously been bitten in the past.

In order to see for myself the results, I wrote a simple helper class, and thought i'd share the boilerplate code to start you off here (I may clean it up and share it as a library, email me if you have difficulty getting it running). Its a rough prototype, but it is returning good results for my purposes.

Note: This code requires Visual Studio 2008. It uses LINQ to SQL in a very loose way due to the LINQ to SQL Designer not listing the System Views and Functions. Its a good example of just how flexible LINQ to SQL is though.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Configuration;

namespace DatabaseDependencyCrawler
    public class SysDependsResult
        public int referenced_major_id { get; set; }

    public class ObjectInfoResult
        public int id { get; set; }
        public string name { get; set; }
        public string xtype  { get; set; }
        public DateTime crdate { get; set; }

    public class DatabaseDependencyCrawler
        public List<DatabaseDependencyEntity> GetDBObjectDependencies(string connectionString, string name)
            // the system views built-into SQL Server 2005
            string dependsQuery = "select referenced_major_id from sys.sql_dependencies where object_id = object_id('{0}')";
            string objectInfoQuery = "select * from sys.sysobjects where id in ( {0} )";

            List<DatabaseDependencyEntity> result = new List<DatabaseDependencyEntity>();

            // find the list of dependencies based upon a database object's name
            DataContext context = new DataContext(connectionString);

            var dependencies = (IEnumerable<dependencies>)context.ExecuteQuery(
                string.Format(dependsQuery, name), 
                new object[] { });

            // build a list of object_is's to we can ask for their name in a second query
            StringBuilder ids = new StringBuilder();
            foreach (SysDependsResult d in dependencies)
                if (ids.Length > 0)


            // if any records were found...lookup the names of those id's comma separated
            if (ids.Length > 0)

                IEnumerable<ObjectInfoResult> objects = (IEnumerable<ObjectInfoResult>)context.ExecuteQuery(typeof(ObjectInfoResult),
                    string.Format(objectInfoQuery, ids.ToString()),
                    new object[] { });

                foreach (ObjectInfoResult o in objects)
                    result.Add (
                        new DatabaseDependencyEntity {
                            DatabaseConnectionString = connectionString,
                            SourceObject = name,
                            Dependent = o
            return result;

Categories: C# | LINQ | Resources
Posted by t_magennis on Tuesday, July 15, 2008 5:34 AM
Permalink | Comments (37) | Post RSSRSS comment feed

Microsoft SharedView

Old news to many, but I had a need to share my desktop today for a conference call. I remembered Microsoft had ShareView coming out of beta, so I downloaded it and was up and running in a few minutes. Its well worth your time having installed. For demo'ing a website prototype to external people, it worked great.

Microsoft ShareView download

Microsoft ShareView Connect Page


  • Hold more effective meetings and conference calls
  • Connect with up to 15 people in different locations and get your point across by showing them what's on your screen.
  • Work together in real time
  • Share, review, and update documents with multiple people in real time.
  • Use when and where you want
  • SharedView is easy to use, from anywhere, at a moment's notice.


I can see this coming in useful for all sorts of ad-hoc collaboration. I'd like to know how it goes as a remote pair-programming platform as well.


Posted by t_magennis on Wednesday, July 02, 2008 10:25 AM
Permalink | Comments (3) | Post RSSRSS comment feed

Project "Velocity" A Distributed In-Memory Application Cache

I dropped by the ADO.Nets team stands at TechEd 2008 and saw a demo of a new project called "Velocity". It is a distributed caching technology, that allows in-memory caching across a distributed set of machines that is resilient and fast.

Although not on schedule for RTM release until 2009, this technology hold promise for scenarios like distributing reference data, and session state across multiple machines in a server farm.

Anil Nori and Muralidhar Krishnaprasad presented a session on the topic and posted their TechEd slides here. Here is the "What Is slide" -



More resources -

The Velocity team blog

Velocity Project Page

CTP 1 Download


Posted by t_magennis on Monday, June 30, 2008 6:41 AM
Permalink | Comments (1) | Post RSSRSS comment feed

Programming Quotes and Wisdom

I found a good set of programming, and software development quotes. Here is a short-list of my favorites I found at this site. If you know of any other good programming quote websites, leave a comment.

"The Six Phases of a Project:

  • Enthusiasm
  • Disillusionment
  • Panic
  • Search for the Guilty
  • Punishment of the Innocent
  • Praise for non-participants"



"Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why - Programmers combine theory and practice: Nothing works and they don't know why."



"Good judgement comes from experience, and experience comes from bad judgement."

Fred Brooks


"The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time."

Tom Cargill


"Learning is not compulsory. Neither is survival."

W. Edwards Deming


"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "

Albert Einstein


"Measuring programming progress by lines of code is like measuring aircraft building progress by weight. "

Bill Gates


"The perfect project plan is possible if one first documents a list of all the unknowns. "

Bill Langley


"There are two ways to write error-free programs; only the third works. "

Alan J. Perlis


"Without requirements or design, programming is the art of adding bugs to an empty text file."

Louis Srygley


"I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone."

Bjarne Stroustrup


"There are only two industries that refer to their customers as "users". "

Edward Tufte


"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise. "

Larry Wall


"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."

Maurice Wilkes discovers debugging, 1949

Posted by t_magennis on Thursday, June 26, 2008 5:17 AM
Permalink | Comments (1) | Post RSSRSS comment feed
christian louboutin spiked heels beats by dre red bottom shoes cheap Christian Louboutin Christian Louboutin outlet christian louboutin pumps Christian Louboutin replica Christian Louboutin sale christian louboutin shoes louboutin outlet red bottom shoes Christian Louboutin outlet red bottom shoes Christian Louboutin sale Christian Louboutin shoes sale Christian Louboutin sale Christian Louboutin outlet louboutin outlet Christian Louboutin shoes Jeremy Scott Adidas Jeremy Scott Adidas Air Jordan Pas Cher Air Max Pas Cher Hermes Handbags Outlet Christian Louboutin Shoes Christian Louboutin Outlet Cheap Christian Louboutin Christian Louboutin cheap Christian Louboutin discount Christian Louboutin outlet Christian Louboutin replica Christian Louboutin sale louboutin outlet Louboutin sale Louboutin shoes Christian Louboutin shoes