Developer Interview Questions

Transform Labs has been hiring developers recently, and since I’m a team lead, I’ve been part of tech screenings for these potential hires. This was a new thing for me so right away I started to compile a list of questions to ask. Now that I’ve done many interviews, and filled up my team, I thought it would make a good post to go over the questions I usually asked and what I was looking for in the candidate’s answer.

The goal of these questions was not to assess technical skill exactly but to gauge familiarity. I mostly was looking for how deep into the weeds someone was with the tech stack we were hiring for. Also on the interview were two other team leads who had their own sets of questions, both about culture fit and technical familiarity with other stacks, so I could focus on the things I knew best: ASP.NET MVC and HTML.

MVC Questions

A Quick Aside About MVC

I’ve been working with ASP.NET MVC (now ASP.NET Core MVC) for almost 15 years now. It’s a rock solid framework for building server-rendered web applications. I’ve learned React and kept up with various JavaScript developments, but MVC is still my go-to for most new projects at work. It’s just so good.

Razor

What is Razor and what role does it play in MVC?

This was always the one I started with. It’s a simple question but the candidate’s answer can tell a lot about how much they’ve actually used MVC. If they get this one wrong, I usually moved on and let someone else ask questions because that would be a fail in my mind.

A good answer is that Razor is a templating language that let’s you mix HTML with C#, letting you generate HTML for a given model (which is a C# type). It’s the view in Model-View-Controller. Bonus points if they use the term “view engine”, and super bonus points if they mention that it replaced code nuggets (one person knew this).

Routing

Picture a typical “out-of-the-box” MVC application. How does MVC determine what controller should handle a given URL?

This is a bit harder than the Razor question but should be second-nature to anyone who has worked with MVC. Sometimes I would phrase this one as a debugging thing, so ask them how they would find the controller if they only had the URL for a page. Either way, I want to know if they know about routing.

A good answer, which I almost never got, is that MVC looks at the route segments and uses the first to match to a controller by class name. Yes, there’s lots of nuance around custom routing and areas, but I asked about a basic application.

What I almost always got was answers about routing attributes or route tables. Attributes are not incorrect, per se, but are a fairly “old” way of doing things. Route tables may be used under-the-hood, but are not really relevant. I

Views and Partials

What’s the difference between View() and PartialView() when returning from a controller?

I didn’t actually ask this one much, but sometimes I would ask it instead of the routing one.

What I want to hear is simple: a view uses a layout, a partial does not. If they wanted to go on, then I want to hear that partials are used to return HTML fragments (as opposed to full pages) and how that may be used (AJAX, HTMX, etc).

The Model Binder

What does the Model Binder do? What data does it take in and what does it spit out?

Oh boy, does this trip up just about everyone. I’m not asking about mapping libraries (I heard so many explanation of AutoMapper), I’m asking about the Model Binder. The reason I ask this one is that, if you are careful, you should never really have to directly interact with the Model Binder. It’s part of the framework and should be pretty opaque to most developers. But it is also a fundamental part of MVC.

A good answer goes like this: the Model Binder is the component of MVC that takes in data from requests (query string values, form fields, JSON in the request body, etc) and populates the parameters of controller actions. Bonus points if they mention that it triggers validation and populates ModelState, but no one ever got that far.

Tag Helpers

What are tag helpers? How can you use some of the built-in ones?

Again, basically no one answered this right. Tag Helpers are amazing and I would reckon that basically every developer who has touched ASP.NET Core MVC has used them even if they didn’t realize.

In short, what I want to hear is that Tag Helpers are C# classes that can target and run code based on HTML elements or attributes as part of Razor’s rendering. They let you extend the rendering process with server-side code.

The built-in tag helpers are ubiquitous in an MVC application. Think about rendering a textbox: <input asp-for="Something" />. asp-for is a Tag Helper. Same idea when rendering a link. Instead of <a href="..."> you can use <a asp-controller="..." asp-action="...">. The built-in ones are super useful for routing and forms. Bonus points if they mention that Tag Helpers are basically the modern version of HTML Helpers, though again no one ever got those points.

But they are also a feature of ASP.NET Core MVC, so this question does a great job of letting me know if they’ve only ever used .NET Framework instead of modern .NET, which you think wouldn’t be a thing, and yet…

HTML and CSS Questions

A common problem with .NET developers is that they tend to be very back-end focused even when they’re full-stack developers. These questions are basic when it comes to front-end but let’s me know if they actually have an understanding of how the browser works.

Semantic Elements

Why would you use a <nav> element as opposed to a <div>?

Such an easy question with a one word answer: semantics. That’s all I want to hear.

They could go on an explain why semantics are important (accessibility being the main one), but we didn’t get that far very often, sadly.

Form Fields

How do you link a <label> to an <input>? Why would you want to do that?

MVC apps make heavy use of HTML forms so I want to know they understand how the actual forms work without any JS framework to obscure them.

The best method is using id and for attributes: <input id="foo"> and matching <label for="foo">. No one ever mentioned the alternative of nesting the input inside the label (though that’s probably for the best). The benefits are the behavior (clicking on the label to focus the input) and accessibility.

CSS Layout

What is the difference between flexbox and grid? Where would you use each?

CSS is pretty universal knowledge for developers, even ones who are more back-end focused, so my lone CSS question is about modern layout methods.

Basically, flexbox is great at layout out elements along a single axis where grid can do layout on two axes. Simple, right?