lundi 15 juin 2009

unique has a browser

The last few releases were mostly about the new browser. The idea is to be able to spot right away where are the file with the most obvious duplication. Once you know where are the problem files, you can launch a pattern search in the right direction.

If some files displayed in the browser are not actually problematic (3rd party, build artifact, ...) you can right-click to hide it. The color of the labels will be renormalized automatically.

The browser also displays metric when the root node of the tree is selected. You can think of it as an anti-SLOC metric. People keep using SLOC as a productivity metric, keeping track of how much bloat is in those Source Line Of Code should give a better idea of the work done and the refactorings ahead.

You can always get the latest version on sourceforge : There is also the freshmeat page that's always up-to-date :

jeudi 11 juin 2009

C++ interview questions/inspiration - part 4

One, two, three

This is part 4. You can read the first three here :

Part 1
Part 2
Part 3

This fourth question is the bonus.

I didn't get to ask it very often. There is never enough time in an interview, that's why I prefer to have a small number of good questions. The questions need to be orthogonal and good predictors. This fourth question is not a very good predictor. Almost every candidate will flunk it. That's why I ask it last. Since the other three questions are good predictors, I often abandon before the fourth question.

Having questions that are good at detecting bad candidates is not enough. Interviewers often forget that interviews work both ways. Candidates judge companies too. It's very frustrating to leave an interview without having been asked at least one difficult question. If the candidate can't answer the difficult question, it's no big deal. If he succeeds, then you have learned something very important : it's a keeper.

The statement

Write a smart pointer. In the general case, it shall only keep a reference to the pointed object. If the pointed object's class inherits from IRefCountable, the smart pointer shall call the AddRef and Release member functions.

In case of silence

If there is an uncomfortable silence, ask more specific questions. What is a smart pointer? Do you know C++ templates? Have you ever used boost? Boost::mpl?

Runtime vs compile-time

Most candidates will try to use dynamic_cast. Does he know what are the limits of RTTI? What if the pointed object is an int?