How to give great answers to technical interview questions πŸ‘©πŸ½β€πŸ’»πŸ‘¨πŸ»β€πŸ’»

Hi πŸ‘‹

I’m happy to be back after a short 2-week break!

To be honest, I couldn’t have hoped for a better way to start the year!

I went to New-York for the first time ever, and immediately after I also got to spend a week at the mountain:

Both of these trips actually happened in the context of my job at Photoroom, so I really have a big thank you for them ❀️

Now, how about we get into the topic of this email?


Going through a technical interview is a stressful experience 😣

Between the interviewer that tries to evaluate your skills and the pressure of trying to land a job, it's very easy to stumble and deliver subpar answers 🫠

So in this email I want to share with you a simple 3-step framework that will help you answer interview question in a way that feels clear, structured and impactful.

Step 1: Contextualize

When you’re asked a question, the natural reflex is to immediately start answering it.

But before that, it can be useful to first take the time to reformulate the question in your own words and explicitly state any assumptions you will make when answering.

You can see this step as an introduction for your actual answer.

It's a way to nicely ease into the actual answer and also give a bit of time to the interviewer to fully switch into listening mode.

But this is also a great way for the interviewer to correct you if, for some reason, you've made a wrong assumption.

This way you don't waste time starting to deliver an answer that's going into the wrong direction.

Step 2: Answer

Once you're done contextualizing, it's time to move on to the next step, which is to deliver the actual answer.

Here, it's relatively straightforward: you just answer the question.

Meaning that you give either the explanation, the definition, or the best practice that the interviewer is expecting to hear.

Step 3: Recap

But once you're done answering the question, it's not over: there is still one last step, which is to recap your answer.

The goal here is to sum up the key points of your answer.

This shouldn't take too long, just a few sentences, but doing so will really help make your answer feel more structured.

And if you have more knowledge on the topic or on adjacent or related topics, this is also a great time to mention it!

Don't forget that the goal of the interviewer is to evaluate your skill level in general, and that the questions are just a proxy to achieve that goal.

So any extra information you can share that will help convey the feeling that you do know your stuff can only have a positive impact.

How about an example?

So we just went over the three steps of this simple framework: contextualize, answer, and finally recap.

Now, how about we put this framework to the test and see how we can apply it to an actual iOS interview question!

Here’s the question we’re going to answer: Can you explain the purpose of the keyword guard?

#01 – Contextualize

How can you contextualize this question?

You can start by saying that when we implement a feature in an iOS app, we usually split our code into two parts.

First, we have what we call the happy path, meaning the code that implements our feature assuming that everything is working correctly.

And then we also have the error paths, which deal with all the potential technical and business errors that can happen.

Things like having no network connection, having an expired authentication token, using an invalid promo code, that kind of things.

Ideally, we would like the structure of our code to be such that the happy path is the main flow of the code and the error paths are branching out of this main flow.

However, if we implement our code using if statements to make sure that all the conditions are met, it's actually the opposite that will be happening.

What will happen is that each new error path, and so each new if statement, will cause the happy path to become more and more deeply nested.

And as we can imagine, this is when the keyword guard comes into play.

#02 – Answer

guard allows us to reverse the structure of the code by implementing an early return from the function whenever a condition has not been met.

And so, by using guard we will be able to refactor our code into a much more readable structure, with the happy path at the center, like we initially wanted.

#03 – Recap

So that was the answer! Now let's finish with the recap.

For the recap, we can simply state that guard is the typical example of when a seemingly simple sugar syntax actually has the potential of dramatically improving the readability of our code.

However, like with all sugar syntax, we want to be careful because they always come with a flip side.

In the case of guard, we want to be careful when using a negation inside the condition because then the statement ends up being a double negation, which will be hard to read and definitely confusing.


I hope you’ve enjoyed learning this simple 3-step framework and that it will help you during your future technical interviews!

I came up with this framework last year, while I was working on a training course to help engineers prepare for iOS technical interviews.

Thanks to the generous sponsorship of RevenueCat, this training course is actually now available for FREE on YouTube!

In this course you will find 9 other example of iOS interview questions answered using this framework, so make sure to check it out if you have an upcoming interview!


That’s all for this email, thanks for reading it!

If you’ve enjoyed it, feel free to forward it
to your friends and colleagues πŸ™Œ

I wish you an amazing week!

❀️

Previous
Previous

How to make a completionHandler much safer

Next
Next

Bad practice: loading a large image on the main thread