The Importance of Being Open and Asking Questions

12/05/2016

Today I had a problem.

I was indexing tens of thousands of objects for a new implementation of the search engine in our application. Entity Framework is the ORM we're using to manage and query our data.

Before starting this job (2 months ago), I had not used Entity Framework except for Microsoft's simple getting started tutorials. So I knew how to get some data then filter and select what I wanted with some LINQ. Easy right? Not quite.

One of my queries was taking 10-15 minutess to complete, but when I ran SQL profiler to see the SQL query it was generating, the query itself was only taking a couple of seconds to run.

I turned to trusty Google, optimised my LINQ, but then ran into the infamous exception "Object reference not set to an instance of an object". I eventually resorted to commenting out vast swathes of my code to try and figure out what was wrong. Not the best way to debug an issue.

After 30 minutes or so, I turned around and asked my colleague (a much more experienced developer than I) for a second opinion on the code I had written. I explained what the purpose of the code was first and then the error I was getting. My colleague asked a few questions to get a better idea of the issue. During this process I realised what the issue was by myself. My colleague had become my rubber duck. I had known and made use of this effect before, however this is the first time that it has happened when I was debugging an area/technology that I am not very familiar with.

It felt really good that I had come up with the solution by myself...ish.

Don't be scared of asking questions, whether you know the subject or not. You shouldn't be looked down on because you do not know something, but looked up at because you have the confidence and the curiosity to ask.

TL:DR Don't know the answer, ask someone. Even you do not think they can help, you may get there all by yourself.