TAG | Technical
I will be diving into a few questions that we use in our technical screenings for the WO Central development team.
Must a value type be boxed for a call to Object.GetType()?
To investigate this I will be using a struct (a struct is a value type). Take the following struct as an example.
struct Person
{
public string FirstName;
public string LastName;
public override string ToString()
{
return FirstName + " " + LastName;
}
}
That’s pretty simple.
Now let’s make a call to GetType().
Person p; p.FirstName = "Brian"; p.LastName = "Thoman"; Type t = p.GetType();
The C# compiler produces the following IL for the call to GetType().
L_001a: box TestBoxing.Person L_001f: call instance class [mscorlib]System.Type [mscorlib]System.Object::GetType()
Notice the explicit box instruction TestBoxing.Person. This happens because GetType() is a non-virtual method on System.Object.
Must a value type be boxed for a call to Object.ToString()?
Using the same Person struct, let’s take a look at ToString().
Person p; p.FirstName = "Brian"; p.LastName = "Thoman"; String s = p.ToString();
For this call the compiler emits the following IL.
L_0027: constrained TestBoxing.Person L_002d: callvirt instance string [mscorlib]System.Object::ToString()
The compiler places a constrained prefix to the callvirt instruction. This tells the CLR to do some checking before calling the virtual function. From the MSDN:
When a callvirt method instruction has been prefixed by constrained thisType, the instruction is executed as follows:
- If thisType is a reference type (as opposed to a value type) then ptr is dereferenced and passed as the ‘this’ pointer to the callvirt of method.
- If thisType is a value type and thisType implements method then ptr is passed unmodified as the ‘this’ pointer to a call method instruction, for the implementation of method by thisType.
- If thisType is a value type and thisType does not implement method then ptr is dereferenced, boxed, and passed as the ‘this’ pointer to the callvirt method instruction.
This simply means that if the value type implements the virtual function it does not need to be boxed. If the value type does not implement the virtual method it will be boxed and the ancestor class’ method will be called.
So…
Must a value type be boxed for a call to Object.GetType()?
yes – all the time (remember the explicit box instruction)
Must a value type be boxed for a call to Object.ToString()?
it depends on if the value type overrides ToString() and provides its own implementation. It also makes sense that calling base.ToString() in the Person class’ ToString() implementation will box.
Finding top tier developers is not an easy task. Here is a quick overview of our process.
Resume Screening
First up is a look at a candidates resume. We take special notice of work experience, the type of projects, and level of involvement. We like to know how long they have worked at prior companies. We are attracted to candidates that have experience in areas we are currently developing or are moving into. We tend to favor candidates with hands on experience actually writing the code.
Technical Screening
After we look through resumes we schedule a technical screening over the phone. The screening typically lasts 30-45 minutes and usually leaves candidates thinking it did not go well. However, the intent of the screening is to determine if the candidate can converse on a technical level. A developer is picked from the team to call the candidate and perform the screening. The questions are written to require many pieces of knowledge to understand the question – not just know the answer.
What are the public, non-static methods available on System.Object?
To answer this the candidate must know what public is and what non-static is. Most candidates correctly answer ToString, and GetType. The lesser common are GetHashCode and Equals.
One thing that makes the screening effective is the level of knowledge the developer has that is giving the screening. Typically, they will drill down into the questions answered correctly to gauge a candidates depth of knowledge.
A good thing to note here is that no one has gotten all the questions right on our screening. The score is just one piece of criteria we use. We also like to know how well a candidate communicates, frustration level, etc.
In-Person Interview
Assuming the candidate passes the technical screening, they are invited for an in-person interview. The interview lasts between 2 and 3 hours with multiple WideOrbit participants. We go through some white boarding problems (graphs, algorithms, etc.), simple coding problems, and a work history interview. Personally, I find the work history interview most interesting. We ask about the projects a candidate has worked on. We like to know how things were implemented. This is usually a very fun part of the interview. The candidate gets to do some real bragging about projects they have worked on.
After that, we contact the candidate to discuss opportunities. Also, we have and will allow a candidate to ask questions regarding their interview to see why we made a decision.
