Monday, April 16, 2012

A Taste of C++11

Herb Sutter has an example of what C++11 feels like. Here it is, from the video:

string flip(string s) {
   reverse(s.begin(), s.end());
   return s;
}

int main() {
   vector<future<string>> v;
   
   v.push_back(async([] { return flip(   " ,olleH"); }));
   v.push_back(async([] { return flip(" egdelwonK"); }));
   v.push_back(async([] { return flip("\n!rebmahC"); }));

   for (auto& e : v) {
      cout << e.get();
   }
}
Concurrency, futures and lambda functions... Moved objects, automatic type deductions and new for loop syntax...

A whole new language, isn't it?

Friday, April 6, 2012

About 'Making Things Happen'

I just finished reading 'Making Things Happen: Mastering Project Management', by Scott Berkun.

Rather than trying to explain why this is a really great book (although it is, and you can find reviews here, here and there), I thought I'd rather just mention a few ideas/topics/quotes I noticed while reading.  If you want to know more about these items, you know where to go...


p 11 - PMs have to balance several pairs of forces: ego/no-ego, autocrat/delegator, tolarate ambiguity/pursue perfection, oral/written, acknowledge complexity/champion simplicity, impatient/patient, courage/fear, believer/skeptic.  Depending on the phase of the project, or the situation at hand, PMs must balance these forces differently
p 16 - "PMs have to understand the advantage of their perspective and choose to make use of it"
p 25 - A schedule has a forcing function: people tend to try and stick with it
About schedules: a simple way to build one is to ask people in the team to provide an indented list of one liner tasks with estimates no longer than 2 days
p 137 - Specifications are needed to build a plan, and help define tests:
- ensure the right thing gets build
- create milestones to focus the team
- enable reviews and feedback
They should be in VCS (markdown format?) to allow others to check what changed.  PM should make it clear with the team what the goals for the specs are (p 138)
p 143 - "Remember that good feedback comes more easily if you ask for it than if you wait for it."
p 144 - Ask the readers of the spec 'Do you have what you need to do your best work?'
p 145 - When writing a spec, put the questions about the specs itself at the end, or in another document.
p 183 - PM is tough: you have to invest in relationships with people, regardless of how much they're investing in you
p 185 - PM should discuss, wich each person, his role, the other person's role, and the common parts.  This sets expectations.
p 186 - "What can I do to help you do your best work?"
p 215 - When an urgent issue arises:
- Calm down
- Evaluate the problem
- Calm down again
- Get the right persons in a room (and often, you don't belong to this group -- Offer help, but don't get in the way)
p 221 - "The challenge [of managing projects] isn't sailing in calm, open waters with clear skies. Instead, the challenge is in knowing w to juggle, prioritize and respond to all the unexpected and difficult things that you're confronted with".
"Taking responsibility for something doesn't make it your fault: it means that you will be accountable for resolving the situation"
p 224 - Getting to Yes, by Roger Fisher -- Know you BATNA (Best Alternative To Negociated Agreement)
p 232 - It's much more expensive to recover from burnout than to slow the project down
p 232 - Feelings about feelings
If someone says something to you that makes you sad ("You smell funny"), next that happens is a feeling (anger) about this first feeling (sadness) and one usually only can express the former (the feeling about the feeling). Cf Virginia Satir
p 233 - Living, loving and learning, by Leo Buscaglia
p 233 - Beware the hero complex (the person creates bad situations to be able to solve them)
p 234 - 'Always' and 'never' are not valid answers to the question of when a process is necessary
p 235 - Beware codependance between bad management and heroes, where the former creates the bad situation that the other saves
p 236 - Exercises for bad situations
p 242 - "To be a good leader, you must learn how to find, build, earn, and grant trust to others - as well as learn how to cultivate trust in yourself"
p 253 - Criticizing others
p 254 - What to do after a mistake, what to learn from your mistakes
p 255 - Never reprimand in real time
p 257 - Self-Reliance, by Ralf Waldo Emerson
p 261 - PMs do ordered lists of stuff
p 265 - Saying no.  "If you're asked something, say no and point them to me"
p 354 - Project Management Clinic (closed now, but archives available) - http://www.scottberkun.com/forums/pmclinic

Friday, January 6, 2012

LaTeX-like Project Management

With project management role comes the need for a project scheduling tool.  The obvious choice would be Microsoft Project, but I thought I'd rather look for some free programs first.

I tried two that are very similar to MS-Project: OpenProj and GanttProject.  Both are open-source software.  Both have a GUI that's centered around a Gantt chart, and allow you to manipulate activities as in MS-Project.  But both also lack a very basic feature: resource leveling.  They don't have any intelligence whatsoever, and the user must check by himself that resources are not overloaded, and correct issues by adding spurious precedence or 'starts after' constraints.  I therefore don't really see how to actually use these tools for any serious work...

But then I discovered The TaskJuggler.  It's a command-line program written in Ruby that will read a text file and output HTML pages with various reports like a gantt chart or a resource allocation graph.  Installing the tool is as easy (once/if you have Ruby) as typing 'gem install taskjuggler'.

Using a text file as the input for all your project data has important benefits. The first one is that you can make use of your Source Management system to allow multiple people to collaborate on the file, while with a binary file (or even a text file that's completely rewritten by your tool when you save it) can't effectively permit sharing.  Another is that changes are much easier to track, as a change to a single part of the project will not touch the rest of the file.  So it's possible to revert individual changes...

This very much reminds me the difference between a word processing program, and LaTeX...


Here are some screenshots:

The Gantt chart
The resource allocation chart

And here is an example of a trivial project file. You'll find a much more complete example of a project file in the tutorial that is provided with the project.

project tiny "Example TJ3 Project"  2012-01-09 +12m {
  timezone "Europe/Paris"
}

resource Xavier "Xavier Nodet" {}

resource dev "Developers" {
  managers Xavier
  resource dev1 "Dev1" {}
  resource dev2 "Dev2" {}
}

task Tiny "Our Tiny Project" {
  responsible Xavier

  task t1 "Task 1" {
    
    task sub1 "Sub-task 1.1" {
      effort 30d
      allocate dev1
    }
    task sub2 "Sub-task 1.2" {
      effort 10d
      allocate dev1
    }
  }

  task t2 "Task 2" {
    effort 20d
    allocate dev2
    depends !t1.sub1
  }
  
  task deliveries "Milestones" {

    task start "Project start" {
      start ${projectstart}
    }
    
    task ega "EGA" {
      start 2012-11-01
      depends !!t1, !!t2
    }
  }
}

# Skipping the report generation part...


I only scratched the surface so far, but this seems very promising to me...

Saturday, December 3, 2011

Results are not enough

Of course, results are a very important part of a manager's evaluation.  But that's not the end of the story...

Consider the manager of a great team of engineers. One can expect that the team will deliver good results. And this may be the case even if the manager is not so great... Conversely, let's consider the manager of a bad team: it may be the case that whatever the manager will do, the team will not deliver. In the long run, a great manager will manage to improve the results he gets from the team, but it may take quite some time. Evaluation of the managers only from the team's results is thus not enough, and may even be completely counter-productive...

So what's a good manager to do?

Of course, a manager must make plans. But that's not enough: as Tom Foster puts it, managers should build robust plans that take external factors not under their control into account. And they should be judged on the fact that they not only planned for success, but made it more likely to happen. Luck, or the lack of it, should not play a role. Kids learning chess often setup traps, only to discover that their opponent did you fall into it. They plan for the best, instead of planning for the worst. Explicitly supposing that things can go wrong is a good way to not depend on random external factors, and improve the likelihood of getting good results.

Getting results is not the mark of a good manager.  Consistently getting results is.

Thursday, March 31, 2011

Partial working copies with Subversion

When working on large and/or multi-platform projects, it often happens that your Subversion working copy contains items that are useless: ports for other platforms, module that you don't need for your work, etc.

Recent Subversion versions allow to specify the maximum depth to use when updating a given target.  You can e.g. specify that you only want the files in a given directory, but not its sub-directories.  Or you want a given directory to be empty, or removed from the working copy entirely.

Let's consider you've checked out an entire working copy, with the following structure:

root
  dir1
    file1.1
    file1.2
    subdir1.1
    subdir1.2
    subdir1.3
    subdir1.4
  dir2
    file2.1
    subdir2.1
      file2.1.1
  dir3
    file3.1
    dir3.1

If you're not interested anymore in subdir2.1 and its content, you can issue the following commands:
> cd root/dir2
> svn update --set-depth exclude subdir2.1
Now dir2 only has file2.1, and an 'svn update' command that does not specify a '--set-depth' option will not bring back subdir2.1 or any of its content.

If you're only interested in the files inside dir1, but not the subdir1.*, you could do:
> cd root
> svn update --set-depth files dir1
This tells SVN to only get the files in dir1, but not its sub-directories

Similarly, you can use '--set-depth empty' to get an empty directory (this can be useful to ask for one of its sub-directories), '--set-depth immediates' to get the immediate sub-directories, and use '--set-depth infinity' to restore the default and get everything in a given directory.

On the reverse, if you have to checkout a working copy but you know you only need some parts of it, you can use the '--depth' option (not '--set-depth', go figure...) of the checkout command.  Then you create your paths in your working copy, step by step:
> svn checkout --depth empty [repository URL] root
> svn update --set-depth empty root/dir1
> svn update --set-depth infinity root/dir1/subdir1.2
> svn update --set-depth infinity root/dir3

Hope this helps!

Friday, March 18, 2011

New features in C++0x allow really impressive stuff...

Slack has a very interesting blog entry about Automatic memoization in C++0x...

Memoization is a pretty well-known optimization technique which consists in “remembering” (i.e.: caching) the results of previous calls to a function, so that repeated calls with the same parameters are resolved without repeating the original computation.

He starts with the short and simple Python function that returns a memoized function from any regular one, and then shows how C++0x features can be used to do the same!

Very impressive...

Wednesday, January 5, 2011

Opening the Fisheye page for your current file from your IDE

Our revision control system is SVN, with a Fisheye server providing easy browsing of the repository. I use Fisheye very much and was tired of having to dig through the deep hierarchies of our project to display the information about a file. I therefore wrote a very little script that I can launch from Visual Studio to open the Fisheye page for the current file, with the correct branch/trunk information.

This script assumes that the directory structure on the disk mimicks the directory structure on the SVN repository, with a prefix (here: f:\work): f:\work\theProject\branches\aBranch\foo.txt corresponds to file foo.txt in the root directory of project theProject on branch aBranch. This will open page https://your-fisheye-server/browse/theProject/branches/aBranch/foo.txt. Of course, you will probably want to edit the location of the server...

rem
rem Launch a browser directed to the Fisheye page for
rem a particular file.
rem
rem mailto:xavier.nodet@gmail.com
rem

@echo off

rem Assumption: first argument is a absolute path to the file
rem on the disk for which we would like to display the
rem corresponding Fisheye page.
set FILE=%1

rem Remove the "f:\work" prefix from the file path
set FILE=%FILE:f:\work=%
rem @echo %FILE%

rem Replace all the backslashes with forward slashes
set FILE=%FILE:\=/%
rem @echo %FILE%

start "c:\Program Files\Mozilla Firefox 4\firefox.exe" https://your-fisheye-server/browse%FILE%

You will have to launch this script from your IDE with as single argument the full path to the file you want to see in Fisheye. Here is how to do this from Visual Studio. Open the 'Tools' -> 'External tools...' menu, click the 'Add' button, and fill the information needed, using $(ItemPath) for the argument:
You now have a 'Current file on Fisheye' entry on your Tools menu, that you simply have to choose to launch Firefox...

I hope you'll find this useful...