How we do the hiring process in my team

Standard

Heads up!

The blog has moved!
If you are interested in reading new posts, the new URL to bookmark is http://blog.valeriogheri.com/

 

This post is going to be slightly different from the others you can find here on my blog.
Part of my new job is to hire people and at the moment we are in the process of growing the  development team.
I had already took part to some interviews from the other side of the table, but preparing and leading an interview is something different, as I found out.
In fact, after a couple of interviews where I just sketched out some objectives and questions, I found myself in a position where I was not very capable of comparing the two candidates if not by my intuition and memories from the interview.
That’s why I decided to adopt a sort of lean methodology to use for (and adapt after) each interview.
Obviously there’s nothing groundbreaking in what follows, just some well-known good practice and ideas, but having them written down really helps on focusing and applying them, or at least that’s my experience and opinion.

So why a post such as this? Well, because I’ve seen others around lately and they helped me a lot, so why not give something back to the community and hope to help someone else?

Methodology

Establish your goals and your needs, be realistic and keep an eye on your budget

It may look trivial, but in fact this is one of the toughest things to do during the whole process. Obviously everyone would like to hire the best dev in the town, but it’s not always possible nor desirable. Let’s see why.
First of all, establish your needs trying to be as honest as possible: if you are in the middle of a project, or about to start a new project and are in need of workforce, chances are you won’t have much time to train the new comer, so you probably want to look for a developer who has a certain degree of experience in the technologies related to your project.
The degree of experience that you have to aim for may vary based on your budget, the competences inside your team and the risk/complexity associated to the project,
If instead you are not on a hurry or if you have enough people on the team to take some time to train new comers and the project is not that risky/complex, then you can probably afford to hire a junior developer or someone who is not much experienced in the same technologies used in your team, that will cost you lees money and you will have the incredible chance to train him!
Write down your tech needs based on core technologies that are a must, but also include some “nice to have”: if you know that your team is missing some skill that might come in handy, then a nice to have gain importance.
Finally it is also very important to layout some personality traits: these will need to be tailored on those that already belong to your team.
For example, something close to my experience, if your team works on different projects and technologies, it is important to look for someone who is rather open-minded and has not been long single tech focused, because it’s less likely that he/she will happily accept to have to learn something new in a short amount of time.

Again the word here is trade-off: goals and needs must meet budget and reality. Also remember: talented developers are usually hard to keep in your company if you do not motivate them enough with interesting projects and problems to solve, cool technologies, responsibilities and money.
If you know you won’t be able to provide some of these points, then you might think twice before hiring someone who could potentially quit exactly the moment when you most need workforce!

Search

This is the moment when you have to apply all the criteria identified in the first step, and use the many tools available to search for candidates: e.g. Monster and LinkedIn where you can perform really fine-grained searches.
But don’t forget about one of the most important way of finding great people: by word of mouth!
While reading CV I am often unhappy because the job descriptions are not very useful to me: yes there is a list of keywords, yes the scope of the project is there, but quite rarely it is clearly explained what was the role in the team, the responsibilities and the technologies really used and mastered.
And quite often I found out that if they have been vague it’s because they don’t know much about it. Again this is just my small experience, so take it with a grain of salt.
So when you have to screen lots of CV and profiles, I suggest skipping those who have vague job description: at the end you will have less CV, but better ones and this is really important because now we go to step 3, interviews!

The interview

This is where the fun begins! You found some great people (at least based CV or someone else’s opinion), they are available and interested by your job opening, now it’s up to you to lead the interview in a way that is useful and the less stressful possible (for everyone).
I personally don’t like phone interviews because usually the line is bad, it’s less personal and you don’t get to see the body language of the person, which is something really important to me.
That’s why, if possible, I always choose to set up face to face interviews.
For the moment I have very few rules for this phase, one of these is  that the interview should not be longer than 1 hour, after that everyone starts to lose attention and to be tired. Another good practice is to involve someone else from the team too; at the end of the day this new person will have to integrate with the team and work with other people, and having a second opinion is always a good thing 🙂
I like to start by introducing the company, the team, the projects we are working on, the methodologies and technologies we use in the development process, and again I describe the job opening, our needs and goals, just to be sure the other person gets them really clear.
Then I ask the candidate to introduce himself/herself, going through the CV and the past experiences (and here is where you can clarify all those vague job descriptions) .
All of this should take a reasonable amount of time, especially if the candidate is a senior dev.
Finally we get to the technical part of the interview: no live coding, no whiteboard coding, these are the other two rules of my interview. I don’t think that asking someone to write some code in 5 minutes in front of people who judge them can really show skills and qualities.
Therefore I wrote down a set of questions that are more colloquial and open-ended than just “Answer a b or c?”.  There are not many questions and I usually don’t ask all of them but instead I just pick the ones that I think could be more appropriate to the job and to the candidate.
Some of those questions have been written by us, many others are taken from the web and can be easily found by googling “interview questions for $technology_X”. I will list them at the end of the post just because they might help people interested to bootstrap their own list.
There are also a  couple of exercises that do not require to write code, just reasoning. Usually I don’t care if the candidate cannot find the right solution on the first try, as long as they get there after a brief discussion and reasoning together.

A project to be done in autonomy

Yep it’s not yet finished! Yes I said that I don’t like live coding, but that doesn’t mean that I do not care about coding skills, au contraire!
At this point, hopefully, there is a small set of candidates to choose from and a good way to select the right candidate is by assigning a project that should be done in autonomy and that should help the team assess several things, such as coding skills, style and quality of code, usage of project related technologies, approach to code testing and ultimately if the candidate can deliver!
If you have budget, you may think about paying the candidate to do some actual work that you need done, otherwise you can opt for very small project that should take no more than a few hours to complete, but yet they should provide good value and insight.

Conclusions

It’s useful to ask the candidate, at the end of each interview, what is his/her opinion, if some question is unclear or confusing.
At the end it’s important to constantly improve your hiring process if you want to increase the likelihood to find the right people.
Finally, bear in mind that this post is just the fruit of my experience and that is very subject to change in the future. Furthermore it applies well to small teams but I have no idea if this would apply well to big teams or other cases.
However any feedback is always appreciated!

Have fun interviewing!

Valerio

p.s. Here is the list of technical questions, mostly oriented to Asp.Net, C# and the web (HTML5, JavaScript)

Interview Questions

General introductionary questions

  • What is your vision of the position? Why are you interested by this position?

  • What books did you read about software development and methodologies?

  • What did you learn yesterday/this week?

  • What excites or interests you about coding?

  • What are your favorite parts about the developer tools you use?

  • Talk about your preferred development environment. (OS, Editor, Browsers, Tools etc.)

  • If you could master one technology this year, what would it be?

  • What’s the coolest thing you’ve ever coded, what are you most proud of? Can you share with us a code sample that you’re proud of, or that you think represents an important part of your coding philosophy?

  • Can you tell us about a hard problem you’ve had to solve, and how you went about solving it?

  • What’s a hashtable?

HTML5/CSS3 specific questions

  • Consider HTML5 as an open web platform. What are the building blocks of HTML5?

  • What are data- attributes good for?

  • Describe the difference between cookies, sessionStorage and localStorage.

  • What is a CSS pre-processor? Name at least one

Javascript specific questions

  • What is an object in JavaScript?

  • Explain how “this” works in JavaScript  (see exercises #1, #2)

  • Explain AJAX in as much detail as possible

  • What is a closure, and how/why would you use one?

  • What is JSON?

  • Explain how prototypal inheritance works

  • How do you go about testing your JavaScript?

  • How do you organize your code? (module pattern, classical inheritance?) Explain the “JavaScript module pattern” and when you’d use it. Ask about private/public properties of an object

  • Explain the concept behind JavaScript promises

  • Can you do multithread operations in JavaScript?

C# / Asp.Net specific questions

  • Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

  • Can you describe the C# memory model? What’s the difference between value types and reference types?

  • What are the available parameters passing strategies in .Net?

    • What is the ref keyword and what does it mean?

    • What is the difference between a reference object passed as a parameter by value and a reference object passed as a parameter by reference?

    • What is the out keyword and what is its peculiarity?

    • Is it possible to define optional parameters in a method signature? If yes, how and what restrictions apply?

  • Can you describe what the keyword const is used for?

  • Can you describe what the keyword readonly is used for? And what’s the main difference between const and readonly?

  • Linq: What’s the “problem” with the following block of code and how would you solve it?
    var customers = from c in context.Customers
                                  select c;
    var waCustomers = customers.Where (c => c.Region == “WA”);
    var waCustomerIDs = waCustomers.Select (c = c.ID);
    var waCustomerNames = waCustomers.Select (c = c.Name);

  • (Ask this question only if the above one has been correctly answered) When would you write a method that returns an IEnumerable<T> and when a method that returns a IQueryable<Customer> (Answer: if you want to allow for composition)

  • What are the main differences between developing a desktop application and a web application? What problem occur on the web that we don’t on the desktop?

  • Can you describe your workflow when you create a web page? / What is your approach to testing when building a web application?

  • Do you know about Asp.Net MVC? Do you know on what conceptual pillars it has been built on?

  • Asp.Net MVC specific questions:

    • What are the benefits of using MVC over Web Forms?

    • What is Razor and what are the benefits of using it?

    • What is a Filter in MVC?

    • What is the role of a controller in an MVC application?

    • Name a few different return types of a controller action method?

    • What is the significance of ASP.NET routing and what are its benefits?

    • What are the 3 segments of the default route, that is present in an ASP.NET MVC application? Example http://www.test.com/Customer/Details/5

SQL specific questions

  • What is the difference between an inner join and an outer join? (see exercise #1)

  • What’s the difference between a table scan and an index seek?

Exercises

JavaScript

#1

var Stormtrooper = function( number, weakMinded ) {
    this.number = number;
    this.weakMinded = weakMinded;
};

Stormtrooper.prototype.checkForDroids = function() {
    return this.weakMinded;
};

var tk421 = new Stormtrooper( "tk421", true );
tk421.checkForDroids(); // return value?

var checkForDroids = tk421.checkForDroids;
checkForDroids(); // return value?

#2

var deathStarTarget = {
    planet: "Alderaan",
    onClickSuperLaser: function() {
        this.destroy( this.planet );
    },
    destroy: function() {
        // DESTROY IT
    }
};

$( "#button" ).on( "click", deathStarTarget.onClickSuperLaser );

SQL

#1

We have two tables:

A    B

–    –

1    3

2    4

3    5

4    6

Show outputs for:

  1. select * from a INNER JOIN b on a.a = b.b;

  2. select * from a LEFT OUTER JOIN b on a.a = b.b;

  3. select * from a FULL OUTER JOIN b on a.a = b.b;

Advertisements

Architecting a MVC web application with Knockout

Standard

Heads up!

The blog has moved!
If you are interested in reading new posts, the new URL to bookmark is http://blog.valeriogheri.com/

 

One of the most recurring questions I see on StackOverflow (for example here) and the likes is about best practices for architecting MVC web applications and about integration with “this” or “that” javascript framework without messing up the whole design.
So I decided to share my thoughts on this, because I know how confusing and hard it can be, especially for beginners, to put all the pieces of the puzzle together.
I chose to take Knockout as an example because I like its MVVM approach and the learning curve is not so steep.
Finally, as always, the foundations of this article lie in my own personal experience mixed with all the books and articles I read, therefore this article might be quite simplicistic or naive to someone with much more experience than me, or maybe someone else will just disagree.
In every case, feel free to express what you think!

MVC

Asp.Net MVC and similar frameworks are cool and powerful, they often offer nice and easy predefined project structures and convetions, so why bothering making things more complex?
Well, conventions are surely great, but when it comes to projects that have more than a few classes, views or controllers, or projects that relies on other teams work, or simply projects that want to adopt a more structured architecture, the basic project template just isn’t flexible enough.
MVC is an architectural pattern about the Presentation layer and how it connects to the Application layer, but what about the rest of the application? How do we further logically divide the software? And how do we connect these logical parts?

Architecture

The standard solution to the questions mentioned above is to use a layered architecture, few and fairly standard in their definition. To enforce well known principles like high coesion, do not repeat yourself etc, each of these layer specialises in a particular aspect of the software.
Each layer speaks a language, usually (with some exceptions, as we will see later) the language of the domain the software is related to, and uses layers beneath to fulfill some task.
The general diagram for the architecture I will talk about is the following:

Architecture

Architecture

The focus of this article is on the Presentation Layer, its integration with Knockout and the connection between the Presentation and the Application layer.

View Model

By definition, the M in MVC stands for Model, but what is exactly the Model we are talking about? The Asp.Net MVC doesn’t constraint the developer to define what M stands for, it could be a Domain Model object (using any kind of pattern, Active-Record, Entity, Value etc…) or it could be something else.
In the solution proposed in this article, the M stands for View Model.
This View Model is not to be confused with the Domain Model, that is the core language of the real world problem our application is trying to solve.
It is instead the language of the Presentation layer, used by Views (our HTML pages) and the Controllers (can be code-behind or Controller objects).
The MVC default project structure that we find in Visual Studio, for example, with its “Model” folder can easily mislead us on this, leading us to mix both worlds not even being aware of that!

What a View Model is

A View Model object is crafter around a specific View and should contain only the elements the View needs to display and optionally validation rules.
Every View should be strongly typed to a View Model object, so that you don’t have to mess up with loose strings or similar, being able instead to work with the MVC scaffolding engine, strongly typed variables and all the HTML helpers while building up your View.
I think it is a good practice to name the View Model object after the View and the specific action, for instance EditCustomerViewModel or CreateCustomoreViewModel, so that it’s easy to do the association between the View and the View Model object.
View Model objects often aggregate Domain Model objects or viceversa may map to only a subset of a Domain model object’s properties, and they may also contain View specific validation rules (for example Asp.Net MVC 3 comes with lots of built-in Data Annotation attributes that we can use to decorate classes or properties to express requirements about fields, data format etc…).
Let’s take as an example a page where the user can Create a new customer: we won’t display a field for customer ID whereas in the corresponding Edit page we may display it as a read only field.
This difference is well expressed using two distinct Views and two distinct View Models, each with different properties and attributes that adapt to the page.
It may seem like a lot of additional work to write two different Views and View Models, but it will pay you back in terms of ease of maintenance and clarity of intents when sharing the work with other people.
Furthermore by following this approach our Views contains no logic to handle different cases like “Edit” and “Create”, they just worry about data visualization like they should.

Views

Lots of javascript framework that help developers delivering a dynamic and interactive user experience are available these days, automating the task of writing repetitive javascript code to hook up DOM objects and events handlers, at the cost of the initial learning curve and the additional code to setup it.
I chose Knockout, which brings the MVVM pattern to the web, because the declarative bindings. are easy to understand and use, it’s easy to extend, it’s very well documentend, the website is full of useful examples and the additional amount of code to setup the framework is not too much.
Knockout requires the developer to write a javascript View Model (from now on referred as Knockout View Model) per each View we want to use it in and the declarative data bindings on each DOM element we want to observe. Once this is done, Knockout can keep track of the state of the controls displayed in the page. Whenever the user will change the state of whatever “observed” control in the page, the underlying Knockout View Model will automatically update itself.
This feature is killer for example if you’re writing a Single Page Application: one full load when the user requests the page for the first time, and every other interaction is an Ajax call where we already have the page state ready for use in javascript.
At this point you may ask: another view model? Didn’t we already have a Domain Model and a View Model?
Yes, that’s true, but every model has its own scope, and the Knockout View Model scope is to contain the presentation display logic and the state of the observed controls.
The View Model is used by the Controller Action that is responsible for loading the View the first time: it will databind the View to the View Model, so that the page is initialized quickly without the need to perform Ajax calls to load data from the server.
If the View is smartly initialised with data coming from the View Model, for example pre-ticked checkboxes, pre-filled textboxes , pre selected item in select list etc… our Knockout View Model won’t know about them unless we explicitely assign every initial values.
One way to do it is by Json encoding the bounded View Model and then assigning each pre-defined value to the Knockout View Model variable containing the observable value.
For example:

var boundedViewModel = @Html.Raw(Json.Encode(Model));
var viewModel = {
selectedCity: ko.observable(boundedViewModel.DefaultCity);
…
}

The Application Layer

Also known as middle tier, it works with Domain Model objects, the Repository and other Foundation services, to work out Presentation layer requests.
To be able to communicate, the Application and Presentation layer share the same language, the View Model objects.
If they were part of the Presentation layer, as suggested by the “Model” folder that we find in the default Asp.Net MVC project, the Application would need to have a reference to it to manipulate them, thus creating a circular reference!
To avoid such a problem we create a separate dll containing View Models, referenced by both the Presentation and the Application layer.
It is then the Application layer responsibility to translate from View Model to Domain Model objects and viceversa.
For this task it is possible and strongly suggested to use automated tools to do the mapping for us, such as AutoMapper for .Net (it is also available on NuGet).
By delegating this task to the Application, the Presentation layer is free from any mapping logic and from any reference that is not directly involved in its core business.

Closing thoughts

In this article we have seen a flexible solution to architect a MVC web application by
introducing a new object Model, the View Model, and its rules that together create an ad-hoc language for the Presentation layer that will help us in the task of building elegant front-ends and to an easier integration with javascript frameworks such as Knockout.

References

Lots of inspiration for this article comes from the following articles:

  1. http://msdn.microsoft.com/en-us/magazine/hh456393.aspx , where you’ll be able to find also more info on the Domain Model and the Repository layer.
  2. http://lostechies.com/jimmybogard/2009/06/30/how-we-do-mvc-view-models/
  3. http://www.methodsandtools.com/archive/archive.php?id=97