Ayende @ Rahien

Oren Eini aka Ayende Rahien CEO of Hibernating Rhinos LTD, which develops RavenDB, a NoSQL Open Source Document Database.

Get in touch with me:

oren@ravendb.net

+972 52-548-6969

Posts: 7,386 | Comments: 50,788

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. Fundamental knowledge - 13 hours from now
  2. Looking into Corax’s posting lists: Part I - about one day from now

There are posts all the way to Nov 30, 2022

RECENT SERIES

  1. Recording (6):
    17 Nov 2022 - RavenDB in a Distributed Cloud Environment
  2. RavenDB Indexing (2):
    20 Oct 2022 - exact()
  3. Production postmortem (45):
    03 Oct 2022 - Do you trust this server?
  4. Webinar recording (15):
    26 Aug 2022 - Modeling Relationships and Hierarchies in a Document Database
  5. re (32):
    16 Aug 2022 - How Discord supercharges network disks for extreme low latency
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats