Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,546
|
Comments: 51,163
Privacy Policy · Terms
filter by tags archive
time to read 4 min | 769 words

So here I am, only 3 days into WPF, and I have an interesting interview question. Given the following, what will be the title of the page? Why?

XAML:

<Page x:Class="Browser.BlogViewer"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Foo">

</Page>

Code:

public partial class BlogViewer : Page

{

      public BlogViewer()

      {

            Title = “Bar”;

      }

}

 

time to read 4 min | 765 words

A couple of days ago I had a really great interview, I figure that I am due one after the long series of horrible candidates that I had recently. Anyway, I did a couple things there that I think that I will carry on to the future interviews. I gave the guy a laptop, and the following excersise, given the follwoing object model:

public class Customer
{
  public List<Order> Orders = new List<Order>();
  public string CompanyName;
  public string Id;
}
public class Order
{
  public int Id;
  public Customer Customer;
  DateTime ShippedAt;
  DateTime OrderedAt;
}

And the following SQL Statement:

SELECT  Customers.CustomerID,

        Customers.CompanyName,

        Orders.OrderId,

        Orders.OrderDate,

        Orders.ShippedDate

FROM    Customers

INNER JOIN Orders ON Orders.CustomerID = Customers.CustomerID

The task is to give me a list of Customers with their orders collection filled. No duplicate customers are allowed. I think that you can see why this is a subject that is near & dear to my heart ;-) Anyway, this is a task that test several distinct parts of the candidate's knowledge, SQL/Database, ADO.Net, minor data structure, logic, etc. It also says a lot about the background of the candidated as they approach it.

Another thing that I thing that I'll keep is asking them what they don't know and then give a task in that area. The task is neccecarily trivial, but it shows how the candidate can learn and think. I don't want co-workers that needs step-by-step instructions.

time to read 15 min | 2819 words

I'm constantly on the look up for good questions to ask in interviews, mainly because "describe the page life-cycle" gets boring and I would like to get away from the page lifecycle myself. The problem with finding good questions is that it has to expose as much knowledge from the candidate, while keeping the answer short and possible to answer within the time limits of an interview.

Here is one that I just thought of:

Given an Employee class, create a collection that accepts employees but doesn't allow duplicate employees to be entered. You are free to use any of the classes in the .Net framework.

Basically, build a set class. This is a good question in my opinion because it tests a wide range of knowledge, in a short question, which can be implemented in about 10 minutes. The question test the following:

  • Basic data structure / efficencies knowledge - if they decide to use ArrayList and compare each time, that would cost in both time to develop and performance
  • Thinking toward reuse - if they implement this from scratch (starting from building growable arrays and moving forward), that means that they either have a problem with knowing the building blocks of the framework or they suffer from NIH.
  • Understanding basic idioms of the framework - implementing IEnumerable will make the collection usable for foreach(), for instnace.
  • Understanding how low level stuff works - can they explain what reference equality vs. value equality is, can the explain how the Dictionary works?

It then leads to another question:

In certain circumstances, I wasnt to be able to able to allow no employees with duplicate names, how would you extend the collection to support this?

And this question tests how they can extend an existing class, and whatever they can come up with something that fits into the .Net idioms cleanly. Adding a boolean to check for an employee name is not a good way to do this.

Here is what I would consider an excellent implementation (not great, because it doesn't implement ICollection<T>):

public class EmployeesSet : IEnumerable<Employee>

{

       Dictionary<Employee, object> internalDic;

 

       public EmployeesSet()

       {

              internalDic = new Dictionary<Employee, object>();

       }

 

       public EmployeesSet(IEqualityComparer<Employee> comparer)

       {

              internalDic=new Dictionary<Employee, object>(comparer);

       }

      

       public void Add(Employee item)

       {

              if(!Contains(item))

                     internalDic.Add(item,null);

       }

 

       public bool Contains(Employee item)

       {

              return internalDic.ContainsKey(item);

       }

 

       public bool Remove(Employee item)

       {

              return internalDic.Remove(item);

       }

 

       public int Count

       {

              get { return internalDic.Count; }

       }

 

       public IEnumerator<Employee> GetEnumerator()

       {

              return internalDic.Keys.GetEnumerator();

       }

 

       IEnumerator IEnumerable.GetEnumerator()

       {

              return internalDic.Keys.GetEnumerator();

       }

}

FUTURE POSTS

  1. Partial writes, IO_Uring and safety - one day from now
  2. Configuration values & Escape hatches - 4 days from now
  3. What happens when a sparse file allocation fails? - 6 days from now
  4. NTFS has an emergency stash of disk space - 8 days from now
  5. Challenge: Giving file system developer ulcer - 11 days from now

And 4 more posts are pending...

There are posts all the way to Feb 17, 2025

RECENT SERIES

  1. Challenge (77):
    20 Jan 2025 - What does this code do?
  2. Answer (13):
    22 Jan 2025 - What does this code do?
  3. Production post-mortem (2):
    17 Jan 2025 - Inspecting ourselves to death
  4. Performance discovery (2):
    10 Jan 2025 - IOPS vs. IOPS
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats
}