What Would You Do Next?

Darren Neimke posted an interesting question on a situation many developers/managers find themselves in. I’ve quoted it in full below:

You’ve just joined a new company as a senior developer. During the interview process your role was discussed in depth…

1. Lead a development team
2. Deliver a new application
3. Using state of the art tooling
4. Highly ambitious

You start, and in your first few days you are shown more details of the task at hand. The project plan and delivery timeline were created by the head developer – a person for whom you have a great deal of respect. Internally you are no really about how you will deliver this in such a short space of time.

What do you do next?

Even though Darren posted this over a week ago I thought I would chip in with my 2 cents worth and attempt to answer some of these questions, beginning with a few of my own:

Does point #3, do you mean that there is little experience with a new set of tools? Are these tools stable, well documented, well supported? Are we talking about VS2005 Team System?

Point #4: In what way is the project “Highly Ambitious”? For the customer? For the developers? Does this mean it consists of too much scope in an undoable timeframe? If so, it’s time to start pruning non-essential features.

How would you establish that the existing project delivery plan is realistic?

First thing I would do is take a look at the requirements (hopefully, you have some). Talk to the customer, and make sure you understand what they are trying to achieve; in other words, get an understanding of their target domain and how this software will make their task easier/more productive and what the essential features are (“The high level feature list”). If you are going to sign up for, and be responsible for a project delivery plan, then you should verify that what is being asked is achievable.

“Get the feature list from the customer, and then figure out the requirements you need to implement those features”

Next up, do you have a set of use cases (scenarios) describing the high level processes that the application is supposed to perform? This is a excellent way of determining if the features are all supported and the requirements are complete, or if there are there surprises lurking.

“scenario” is often used interchangably to mean one of the following:

  1. a use case
  2. a path through a use case
  3. an instance of a use case

#2 and #3 are really the same thing. #3 is preferred (more than one scenario occurs when the use case has alternate paths, but these still achieve the main goal of the use case)

Each use case must have:

  • clear value to the system
  • a well defined start and stop point
  • an external initiator

As soon as you have a set of use cases, you can perform textual analysis upon them to figure out candidates for your classes and methods (nouns and verbs). By this point, you should have enough information to break up your application into smaller pieces of functionality, and have a better handle on how much development time is required.

Grant Halliday’s comment about working 20 hr days is a little worrying! 😉 If any developer is working more than 8 or 9 hours a day, then you have a big problem. Odds are they will be making plenty of mistakes. There is considerable evidence to back this up. A good plan will not force developers to work unproductive hours. Any manager that thinks he will retain the confidence and support of his staff in doing so, is almost certainly mistaken.

A Little Gem of a Book: “The Elements of C# Style”

Here is some condensed wisdom for C# programmers from a ‘must read’ book, The Elements of C# Style. This book models itself in the tradition of “The Elements of Style”, and is a similar physical size, which means you can easily read it cover to cover in very little time.


If you program in C#, having a copy of this book on hand will provide a great reference, at least until you commit it all to memory! Some of this sage advice applies to other languages as well:

  • Use meaningful names. Names things accurately and consistently
    With the exception of loop variables used as a counter or index within a loop (where using ‘i’ is often more readable than a longer name).
  • Use names that exist in the terminology of the target domain
  • Do not use excessively long names or excessively short names
  • Do not shorten names by removing vowels; use complete words
    It’s not the 1970’s! Your compiler is not going to complain about names longer than 32 chars (Oracle might though!) Take this along with the previous suggestion.
  • Avoid abbreviations unless the full name is excessively long
  • If you really have to use an abbreviation, use one that is widely used and commonly accepted.
  • Pluralise the names of collections
    List cars = new List();
    Car car = cars[index];
  • Prefix interface names with “I”
  • Use nouns to name interfaces that describe service declarations
    public interface IMessageSink
    {
    public void MessageReceived();
    }
  • Use adjectives to name interfaces that describe behaviours
    Most of these will end in –ible or –able.
    public interface IDriveable
    {
    public void Drive();
    }
  • Add a suffix of “Base” to abstract base types
  • Add a suffix of “Exception” to custom exception types

I did find a couple of typographic errors and one bit of advice which is considered wrong if you go with the recommendations in the Framework Design Guidelines by Brad Abrams and Krzysztof Cwalina; namely, point #157 states that you should derive custom exceptions from ApplicationException. These should be derived instead from System.Exception.

Also, quite by coincidence, on a second re-read I noticed that the double-lock pattern used in point #85, should not be used (see my previous blog post which refers to Jon Skeet’s article). Jon mentions that it can be fixed using memory barriers via the volatile keyword, which in this particular example would require the instance of LoanCalculator to be declared as volatile. But, he also mentions that the experts can’t agree on this, and is therefore sensibly avoided!

I believe point #48 should read:
[MyFavouriteAttribute]

.Net C# Singleton Pattern – Best Practice

What is the best practice way to implement the Singleton design pattern in C#? You might be surprised at the number of flawed examples there are out there; many of the articles I looked at were incorrect (some subtlely, some not so) and several were on high traffic, popular sites!

This excellent article by Jon Skeet not only discusses several ways not to do it, but also the correct way:

public sealed class Singleton

{

// Prevent compiler adding a default public parameterless constructor

private Singleton() {}

public static readonly Singleton Instance = new Singleton();

// Explicit static constructor instructs compiler

// NOT to mark type as ‘beforefieldinit’

// Remove this if you do not need to guarantee lazy instantiation

static Singleton() {}

}

The static constructor is only required if you want to guarantee lazy instantiation (which Jon explains here.)

See also this MSDN article from Feb 2002.

Perth .Net UG Meeting – 10th Jan 2007

We are starting the year with an exciting talk by David Lemphers on his explorations into .NET and Robotics, 5:30pm, Weds 10th Jan 2007.

Please note that this meeting will be held at the Microsoft offices, level 14, QV1 building, NOT at the new Excom venue. Look forward to seeing you there!

He is also presenting on SQL server to the SQL UG the following evening at Excom.

Chance Quotes

Nick Randolph tagged me a while ago as part of the ‘5-things’ tagging meme pervading the ‘blogosphere’. Try as I might, I couldn’t find 5 things about me that I thought others would be interested in knowing (sad, I know), so instead here’s a few quotes and food for thought from interesting people about chance:

Chance favours the prepared mind – Louis Pasteur.

I will study and get ready, and perhaps my chance will comeAbraham Lincoln

God does not play dice [with the universe] – Albert Einstein

Men are not prisoners of fate, but only prisoners of their own mindsFranklin D. Roosevelt

Fortune can, for her pleasure, fools advance, And toss them on the wheels of ChanceJuvenal (55 AD – 127 AD)

No victor believes in chanceFriedrich Nietzsche

A lie gets halfway around the world before the truth has a chance to get its pants onWinston Churchill

When a man is pushed, tormented, defeated, he has a chance to learn somethingRalph Waldo Emerson

Fortune knocks but once, but misfortune has much more patience – Laurence Peter

Great lives are the culmination of great thoughts followed by great actions – Peter Sinclair

Chance is always powerful. Let your hook be always cast; in the pool where you least expect it, there will be a fishOvid (43 BC – 17 AD)

The Churchill quote is a bit of an odd one out.

I think I can see my parcel!

Huh?

Having had a few xmas parcels go astray en route from Australia to the UK (not to mention the horrendous cost of postage), a colleague suggested that I simply buy a few things from Amazon UK. Brilliant! Now why didn’t I think of that! Worked so well, I sent two shipments. I came across this image today, and wanted to share it: Amazon UK at xmas! If only software could be written that way…

Microsoft up to its old Tricks?

Just when I was starting to be a Microsoft champion and truly believe they had turned over a new leaf, they go and do something like this: Microsoft tries to claim a patent on RSS (just a few days ago). This is ridiculous and disgraceful! Everyone knows that Microsoft did NOT invent RSS! In fact, they were relatively slow to adopt support for RSS into their products. MS, you need to get those patent guys under control, before they seriously start damaging your newfound credibilty.

What Developers Want

Rob Walling has posted an article, Nine Things Developers Want More Than Money, that managers should read, if they want to understand what makes most developers tick. Rob draws upon Frederick Herzberg’s Two Factor Theory.

Just over 1 year ago I left a job at an engineering company in Perth (with its head office in Canada). In the space of just 10 months, before and after I left, my department had a turn over of its entire complement of staff. I mention this, because all of the problems and complaints voiced by the developers are discussed in this post. [This one’s for you Bernie!] On the positive side, everyone that left found better jobs.

Over to You!

With the New Year quickly approaching, it’s not unusual to find people thinking about changing positions or jobs and with that in mind Rob Farley has posted an intelligent and insightful piece of the subject of handing over one’s responsibilities at the end of an employment.

I really like Rob’s suggestion that a handover be ‘practised’. It’s a bit like factoring in ‘mock’ database backup restores into an overall risk strategy plan (I have witnessed first hand, 2 large engineering companies being caught short, by not checking that there was actually something on those backup tapes, that they were sending offsite to a fire safe for 2 years!)