Smarts alone are not enough

Working in a company that is obsessed by hiring people on smarts alone I can attest to the fact the being smart isn’t always helpful. The use with of Google-style puzzle questions to select candidates rather than “boring” questions about “what does this piece of code do?” drives me nuts.

I overheard someone here saying “All the new graduates we interview seem to be better at the puzzles than the more experienced hires, I wonder what that means?”. The answer is: it means they are better at puzzles, nothing more. I think the important thing is that software engineering is not like pure mathematics. Your achievments are not 100% correlated with your IQ.

The point is that there is such a large body of knowledge – admittedly not as developed as the BOK for structural engineering – that it is not possible to work out the best way of doing things from first principles. Just because a person has a 140 IQ it doesn’t mean that they will figure out how to make an enterprise strength messaging system – or a secure cryptosystem – because it takes tens of man-years to do such a thing.

Tinkering around with little programs doesn’t teach some of the things that an experienced programmer on large (i.e., more than 100k lines) systems take for granted. Having spent some time trying to tell very clever people (i.e., PhD from Cambridge, self-taught programmer) that they should do things in a certain way because that is the best practice, I know that they aren’t always responsive. They think that they can manage the complexity because they are clever, and immature enough to be in love with their own cleverness.

Of course, there is a point where the system outgrows them and having no structure means that point is meltdown for maintainability.

Experience actually does mean something. Raw knowledge of best practice obtained from books means slightly less on its own. But the two together are really useful. Now, if you can combine them with a person with enough IQ to do the job, and enough maturity to not want to show off their IQ… then you have a software engineer and not just a clever hacker.

Exceptionally fast

scale is in seconds
time scale is in seconds

This is the result of a test I did with some very stupid code to test the speed of exceptions. We sometimes hear that exceptions are slow and I wondered how much the stack depth affects the result. I used very simple code that recursed if the level of recursion was less than a threshold and threw an empty ApplicationException when the threshold was reached. The test was repeated one thousand times and the results are graphed above.

The verdict? Well – as you might expect – the answer is : it depends on what you mean by slow!
i think that the really slow exceptions are ones that occur as a result of a problem with COM or p/invoke or ones that are marshalled across remoting or AppDomain boundaries. I’d like to do something with recursed AppDomains as that could be really painful.
PS: apologies for the image, I am simply too lazy to figure out how to make it display properly. I just cut as pasted it from Google docs where I wrote this post. I have no idea how that is working!

Project thoughts: Every task takes a week

I recently went on a basic project management course, and while discussing while estimating I had a minor insight.

It is a frequently cited problem in software development that estimating how long it will take to do a task – whether desgin or implementation – is hard. On the project course we discussed using ranges instead of simple estimates and using the size of the range as a measure of risk. Some people even objected to that, saying that you could only estimate what you had done before. There is a grain of truth in that but, IMHO, once you have written your first “hello, world” in a language everything is similar to a greater or lesser extent.

When I have done any estimating myself I noted how frequently I answered “how long will this take?” with “a week” or “two weeks”. My feeling is that, any task that is too big to be done in a week is generally too big to even attempt to estimate or even give a title to, so we split it up into chunks that generally take, well, about a week. And any task that is so small that it would take less than a week is combined with other tasks that add up to, well, about a week!

If you have ever seen the movie The Money Pit or worked with house builders at all then you are familar with the two week estimate. There is only ever two weeks of work: what we do this week and what we intend to do next week!

Project thoughts braindump

I went on a project management course recently. It was pretty 101 level but good enough for a n00b like me. It fired off a few thoughts that I want to dump here, not much insight here, but I want to write some more about it in another post.

What was interesting is that I feel that Agile is already accepted as being a great thing for business software, but this course basically ignored it on the grounds that
a) MOST people are still doing waterfall, in business or not
b) project planners sort of dislike it as it is hard to get the predicitability of waterfall.

a) is, I think, undeniable. b) is wrong but interesting. The problem (as I note below) is that people like waterfall because it feels precise and ordered, but when it breaks you only find out late, and their is no way for it to degrade gracefully.

The problem with Agile is, of course, little emphasis on documentation of design or user guides etc etc. The emphasis is on producing working software of known, high quality in a fixed time with all the flexibilty coming from precisely what functionality is delivered. To some people on the course (e.g., people writing firmware for tomahawk cruise missiles – no, really!) flexible function and no documentation is not an acceptable compromise, not matter how fast and cheap you can write the software!
<braindump>

* you must succeed and be seen to succeed: reporting is not an afterthought

* project manager’s role is to be looking ahead to the next phase, not working on the current set of tasks.

* checklists and templates are a kind of “project process lite”, not a substitute for real thought but provide something to react to. Most of project management is based on using what you already did that was similar. Good checklists/templates to have
* project stakeholders
* task estimation spreadsheet with 3-point estimate logic
* project milestone/gate reports
* risk checklist

* project owners are the people who have the right to judge whether the project was a success. project owners measure success in terms of things that were delivered 100%, not in terms of effort and tasks completed.

* a project goal statement is the definition of success; it is not high-level requirements list, nor a brief definition of the project owner’s problem, nor a desecription of the proposed solution.

* project stakeholders are any people who are impacted by the project.. not neccessarily people on the project team doing the work.

* by creating and publishing a project goala you may flush out a unhappy – and previoulsy unknown – stakeholders. we can then correct the project goal at very low cost in effort and political standing. It won’t be easy, but it will be easier than changing course later.

* it is better to have one project goal that everyone knows about. For projects that have stakeholders that are outside the organization – or have such disparate opinions and viewpoints – then multiple goal statements may be needed. Consider your honesty and what you do if you are “found out”.

* the project management lifecycle is separate from – but interlaced with – the software/system development lifecycle. The initial gathering of high-level project objectives are correlated to early requirements capture for development, but project goals are NOT the same as the user requirements that will be needed to create even high-level architecture of the system/software.

* the advantage of the waterfall model is that the project can proceed with many specialists who are coordinated by the project manager and work on different phases. only a few project “masters” are needed who understand all phases and work on the project for the whole cycle.
… the disadvantage of this is that different specialists will have little ownership and will not feel involved when their part is “done” and that can lead to different parts of the project team being at war (e.g., developers and

* project plan estimates are often nonsense: project managers pad time estimates for tasks in the plan and then senior managers cut these estimates arbitrarily because they know that they have been padded! How do we avoid these games and keep the plan a real tool for planning our projects? The answer: keep estimates ACCURATE but IMPRECISE by using a RANGE. The more imprecise the estimate is, the higher the risk. In some cases, highly imprecise or otherwise highly uncertain/risky tasks should be pushed towards the upper end of the estimate range. This means that only a few tasks are padded, and if senior management want to cut estimates for risky items then they can take responsibility for these specific cases!

* Building good, accurate plans is only possible where estimates are accurate. We must estimate then measure, re-estimate the remaining tasks and re-plan the project tasks to ensure that the project plan is still relevant. We must ensure that the estimate ranges are compared with the measured duration of the tasks so people can improve their estimation skills.

* Project planning and software design is inherently iterative; you must revisit earlier stages as you discover changes in the scope and deliverables of the project. The advantage of agile processes is that it recognises this explicitly; the disadvantage of waterfall is that it maintains the illusion of precision for too long; the iterative corrections are a footnote that we only discover late in the project.

* The balance between agile and waterfall is how many corrections we have to make; if the scope doesn’t change significantly then we can get away with the waterfall and get the advantages of simplicity, predictability and resourcing and staff with a single skill-set. If changes are constant or large then we need to recognise it and use agile which are unpredicatable (you don’t know what you will get, you only know that you will get it when the iteration ends) and requires highly-skilled, multi-talkented developers who are highly motivated.

* Reducing length of the critical path by overlapping dependent activities is possible but entails increased risk. (could be financial risk of sunk costs in a cancelled project)

* Risk control activities: prevention, reduction (of impact or probability), acceptance (absorbing risk), transfer (of control or the risk itself), contingency (what we do when the risk comes to pass).

* Research to try and evaluate probability or impact of risk is a TASK that should be on the project plan.

* If we find a risk but don’t want to carry out the risk control work but don’t want to accept the risk then we can use risk monitoring TRIPWIRES to regularly monitor some metric that will indicate increased probability or impact of a given risk. The effort of monitoring the metric is some small repeated task that will enable the FULL risk control task effort to be saved unless it is needed.

* Project reporting for milestones should be deliverable based, not task based. No project owner casres what effort you have put in, only what you have delivered 100% complete. A 90% complete feature is a missing feature. For reporting inside the team, you can be activity based, as long as people know what these activities are. For informal, regular (say daily or weekly) meetings you can report what people are doing now.

* remember the project manager’s job is to be ahead of the team preparing the ground ahead so you should be able to report what you will be doing NEXT. You should also be clearing behind the team ensuring that milestones/gates are truly delivered.

</braindump>

If you can’t name it, you can’t write it

Some people in my company have recently decided that they need some some more layers in their architecture. They are right, as it happens; but they are going about it all wrong. They are attempting to create a framework and we all know what happens when you put on your architecture hat and start building frameworks. Architecture astronauts only. Rather than solving specific problems and rolling them up in a framework they have started with the idea that they want a framework that wraps the database up and produces objects. And it should use LINQ. And it should do all sorts of cool stuff.

Unfortunately, since they don’t know what cool stuff it will do, they didn’t know what to call it so they held a little competition for people to suggest a name. And that is the problem, if you don’t even know what a thing should be called, how do you know what it is? If you don’t know what it is, you cannot sit down and write the code.

Of course, I pointed this out and made them very unhappy. A quick browse throught the source control history revealed that they had not started coding without any requirements. Of course, there were lots of empty interfaces with one object implementing the interface with only the method signature! And they really funny thing is that they have already changed the name.. When they started they called it ClientAPI (actually the “client” refers to the customers of the business, not client as in “client-server”). The later they changed it to ClientBusinessObjects. Great name.

And the really, really funny thing is that they aren’t business objects, they are actually database objects and that factory classes from the database! It will be really fun when they start reading pattern books too!

XP since the beginning…

I had an interesting conversation with someone the other day on the subject of XP. I told him that I’d been involved in an “early attempt at doing XP” back in 2001. We chatted a little about how it was only a couple of years after some of the books on XP were published but that, of course, there were many things about the attempt that were not perfect. He then casually mentioned that he used to work for ThoughtWorks and asked if I’d heard of it. I said, of course – because of Martin Fowler – he then told me that he was lucky enough, while at ThoughtWorks, to have been taught XP by Kent Beck. I asked him how and he said that he was lucky enough to go on the second ever ObjectMentor “total immersion” XP course.

Wow. Pretty impeccable agile credentials.

 

Extension methods are interesting

Not my idea, but it amused me. Thanks Dave.


namespace ExtensionMethodsAreEvil
{
 class ExtensionMethodsAreEvil
 {
 public static void Main()
 {
 string myNullString = null;
 Console.WriteLine("Is the string empty? " + myNullString.IsNullOrEmpty());
 }
 }

 public static class ExtendString
 {
 public static bool IsNullOrEmpty(this string s)
 {
 return string.IsNullOrEmpty(s);
 }
 }
}