Am I doing this wrong? My experience of interviewing ASP.NET developers
Tags: interview, dotnet, firstpost, webdev
Published: 2019-07-28 21:56:08

---
title: Am I doing this wrong? My experience of interviewing ASP.NET developers
published: true
description: We wanted an ASP.NET MVC web developer (mid to senior level). I asked these questions. I wanted to know are these questions fair or am I committing the same mistakes we devs complain about all the time?
tags: #Interview #dotnet #FirstPost #webdev
---
I recently interviewed some candidates for an ASP.NET web developer opening in my project. I was looking for a candidate with 6-9 years of experience for a typical ASP.NET web application. I must state here that I have not done this much. I hate doing it but then we have had some bad experience with some folks and this time I decided I will take the plunge. Also, this is my first post on DEV. Finally got the courage to write something. 

So here it goes.

I generally started with questions around their current project and what is their role and responsibility. This gave me an idea about their communication skills as well. Note, not "language" skills but communication overall. Here, I don't mean fluency in "English" language (because that's what we deal in), but more about how prepared you are. How you can explain concepts unknown to your audience. How much you get involved with your domain? Do you participate in design decisions? Essentially, their level of involvement.

I realised this question eased up the candidate. Here, however, I noticed many candidates were not coherent and genuinely struggled to explain the purpose of application in brief succinct sentences. 

I felt a lot of candidates although mentioned that the project was "Agile", they were not able to communicate their daily contribution to the "Agile" process part. For e.g, I would often ask, how did they manage conflicts in opinions on estimates? How do they contribute to backlog refinement calls? And I understand, for a big, remote team, this may not be applicable always but most of the candidates I spoke to were working in small co-located teams. Agile doesn't mean we have a daily standup. But that's just my opinion.

After discussing roles and responsibilities, I would ask their contributions (technical as well as non-technical). What is the latest work they did? Here I like to go into the code review process as well. How often was code reviewed and what were the common code review comments they received and give? What is a code smell and were they using tools to identify them? Now I completely understand not everybody has the privilege of working with tools and fancy build process. I have not worked on a project with completely automated builds myself. And I know this could be due to various reasons, foremost of which is budget. But often its also a lack of initiative from the team. Not making a case for it etc. So I want to know what's your deal? :)
So here again the intention is to get a view of a person's current work culture and their knowledge (or lack thereof) around these concepts. Also, just because it is not used in the current project, are you inquisitive enough to find out yourself, what the fuzz is about?

Finally, I would jump into some pure code-based scenario. I would start from the front end.

## Scenario
1. You have an HTML page, called `home.html` and it refers to 2 JS files. `home.js` and `homedetails.js`. 

```
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src='home.js'></script>
    <script src="homedetails.js"></script>
    
</head>
<body>
<div>

</div>
    <script>
        
        hello(); 

    </script>
</body>

</html>

```

You have one function given below in `home.js`

```!JS
function hello(){
   console.log('hello'+ this.value);
}
```
In `homedetails.js` you have below function

```!JS
//yes the function is named same as above intentionally
function hello(){
   console.log('hello World');
}
```
Question 1: What will you see in the console? And why?
Question 2: What if I reversed the references of JS files? Will it affect output? So what if `homedetails.js` is referred before `home.js`?
Question 3: What if I had a third js file referenced in this page, say `homefotter.js` and it has just this one line. And we go back to original HTML, what will be the output now?

```
var value = 'World!!!';

```

Now you may argue, that it's not a real-world scenario and I 100% agree, but this in my humble opinion is to test your basics. Also, is it a very contrived scenario? The same function name is the bane of JS. Have you never encountered the scenario where some other team members function overwrites your intended implementation? Good libraries use closures/namespacing to avoid this but most often it happens in your own code. Obviously, I'm interested in your opinions. And I may be wrong.

At this point, I would like to acknowledge that ASP.NET devs for some reason consider Javascript only for validations and some ajax calls. I don't know why but a lot of people told me that they used JS only for these 2 things. But with follow up questions, it became apparent to both of us that the candidate just never bothered to learn these things and relied only on "getting it to work" rather than understand why it worked.

Next up is `CSS` and I generally don't spend too much time on it. Although I have frequently asked people if they have used `bootstrap` and if the answer is yes, I ask when you need to override default styling, what's your approach? E.g. default bootstrap buttons are blue as primary, red for danger etc and I want to have different primary secondary colours (basically a different theme), where will they make these changes. In the bootstrap.css or in a custom stylesheet leaving the library as-is. Why and why not?

Now we get into the proper `.NET` side of things. The JD was always clear we are not using `dotnet core` so my questions are related to dotnet full framework. At this point, my questions are more around the level of experience they have described in roles and responsibility question above. Again, I didn't ask the below to everyone but to quite a few.

Scenario:
I have `form` in my view with two input boxes, `FirstName` and `LastName`. I want to save/insert the name details in my database. Assuming we are using ASP.NET MVC, walk me through your approach to save these details in a SQL Database. But remember this is a production application so consider everything like performance, security, scalability, readability, design etc. You are free to do whatever it takes to save, but you have to explain the reasons behind your approach.

The answer here obviously varies based on experience level. A less experienced person generally just assumed a lot of things and will get down to `Html.BeginForm` level straight away, which is not what I'm looking for but I don't stop the flow. In fact, sometimes I have asked them why not `AJAX` and why synchronous save? 

> A lot of time I get the answer "We can do AJAX if **you** want" and for the first few candidates, I reminded them that it's their solution, so they get to choose. I'm just asking why one over the other? But I noticed that this puts off people for some reason. So I changed my answer to whatever that you are comfortable with. :)

I would also ask about Model binding here. Do they understand, how it's working? What will happen on the model binding? What if I want some extra customization. Again, this is just to understand the exposure and not checking your theoretical understanding. Although +1 if you can explain the pipeline here :)

On `Action` side of things, most of the people didn't mention `ValidateAntiForgeryToken` at all for the `POST`, which I was very surprised with.

Another common issue was no checks for `Model` using `Model.IsValid` before starting to save. A lot of them didn't realise this mistake until after I point it out by saying, what if I clicked submit without filling anything. 

Lot of them mentioned `Data Annotations` after that but felt client-side validation is enough. Few even mentioned an if condition to check null values. And when probed if this is a good approach, finally spoke about `Data Annotations` but again no mention of model validity at server side. Again, if you mention `Fluent Validation` or some other library here (which you use in your project, +1, but seriously -2 if you don't mention any validations at server-side)

Many didn't ask me if authentication is required or not. I purposefully never mentioned it to see if candidates ask me. But no minus points for not asking. Plus points for asking though. :)

Same with error handling. Again, lots of assumptions, but a few candidates, mentioned `try catch` when probed in this area. I was surprised very few mentioned `Logging` and global error handling.

Eventually, they will reach the saving part and most will use EF6 and use LINQ to save. Now because they choose EF, I will ask them what is `Eager loading` and `Lazy Loading`? Which one to use in "Web Applications"? Have they had any need in their application to see what query EF generated? What tools they used to see the generated query. Most of them answered `SQL profiler` but no one mentioned `Glimpse` or `Stackify` etc which was a bit surprising since I was under the impression that SQL profiler is an ASP.NET developer's least fav tool :)

Now, depending on how it has gone so far, I dwell into exposure to performance issues? What is your overall approach? What're your go-to tools when dealing with such issues. How do you leverage the tools at your disposal? But, frankly, this, in my opinion, is one of those things, you know if you have dealt with such issues. But again it gives me insight into what kind of work you have been doing.

Now and then I would ask people about `bundling` and `minification` in ASP.NET. What are some of the challenges people have faced? What did they learn?

> One candidate told me he felt that ASP.NET minification was flawed and he wrote his own minifier for it. I was impressed and shocked at the same time. Talk about reinventing the wheel. (BTW, he didn't answer the first JS question, so I had my doubt about his answers here)


Now my question to you fellow devs.

Is this the right approach? Am I being naive in asking these questions and this doesn't prove anything about the candidate? 

I hate theory questions. What is `class`? What is `inheritance`. The top 20 dotnet questions you find on google. 

My idea was to have a conversation but it has not reaped good benefits. 

Is it unfair to ask security and performance-related questions? 

Finally, What are your approaches?