Computer science and programming interviews

Recently my friend Janie has done a series of blog posts on her disagreement with using computer science questions as a major part of the hiring process. I can agree with her, to a point.

If you’re hiring for someone to do a specific job using a specific language or framework, and the person being interviewed can demonstrate experience with and competence in that language or framework, then that’s probably as far as you need to go. You have a job that needs to be done and you’ve found someone who can do that job. Win!

I think that when the job is less well-defined is when algorithms questions can more usefully come into play. But let me back up and relate a few stories from my personal experience.

As a GTA (graduate teaching assistant) part of my job was to monitor the computer lab and help people as needed. The undergraduate classes at my school used Java; I don’t, but I grabbed a book and picked up enough of it to be able to get people unstuck. I guarantee that pretty much everyone I helped had much more experience with and knowledge of Java than I did – they were using it every week for their classes, while I’d picked up the bare minimum to be able to read it. But I was getting people unstuck because they didn’t understand how to take a problem and write a program that would solve it; they knew how to program, but they didn’t know how to think.

The class that I taught, Foundations of Computer Science, involved no programming whatsoever (and many people put off taking it, for that reason). We covered finite state machines, regular expressions, Turing completeness, that sort of thing. I can recall thinking that if I was hiring someone for just about any job, I would consider an A in that class as a strong recommendation, because it meant that you could think logically and solve problems.

When I was working on my PhD I did almost no programming; I was focused on theory. I think I wrote three programs in four years. Towards the end of that, Microsoft was doing interviews on campus, and I decided to give it a try; the interview turned out to be two questions along the lines of “Here’s a problem. Solve it, then find the fastest possible solution.” I found the problems to be reasonably straightforward (though you had to be a little creative for one of them) but the interviewer told me that most of the people he’d interviewed couldn’t even answer the first problem.

I don’t mean to suggest here that programming skills or experience are not important, only that unless the problem is very well defined, they may be less important than knowing how to figure things out. The advantage that knowing algorithms (and everything that goes with it) gives you is that you have more tools available to you; in the case of the Microsoft questions, one of the problems was very obviously susceptible to dynamic programming, and knowing big-O analysis made it easy to say “this is the best asymptotic runtime of any solution to this problem.”

My current employer has a similar philosophy. The initial test I took allowed you to use any programming language you liked; another one taught you an obscure language and then asked you to use it. Combined with a preference for people with strong academic backgrounds, they’re selecting for employees with a demonstrated ability to both solve problems efficiently and pick up new things quickly. Now I regularly use half a dozen languages at work, none of which I knew when I started, and the turnover at the company is low compared to the larger tech industry. Microsoft and Google have actually pouched half of my team over the last few years, but that’s another story..

Oracle, index-organized tables, and overflow tablespaces

I’ve been rewriting a utility that moves certain tables and their indexes from their old tablespaces (many, many old tablespaces) to a new one. This week I ran into a new (to me) error message:

SQL Error: ORA-25191: cannot reference overflow table of an index-organized table

My utility wasn’t providing enough special handling for index-organized tables (IOTs), which were throwing up this error (and a few others). So what’s an index-organized table, and why are they so difficult to work with?

A refresher: a SQL database is relational, and rows are stored unsorted; Oracle calls standard tables heap-organized tables. For a given SQL query, unless an ORDER BY clause is used, results can be returned in any order. Oracle also has IOTs, which are tables that are instead stored in a B*Tree index structure. This structure stores all columns of the table, sorted by primary key; because this is both the table and the index, accessing rows is much faster and less storage space is needed than for a heap-organized table with a separate index.

There are, however, exceptions to the rule that everything is stored in one place. If some columns are rarely used, they can be moved into an overflow area (which could be in a different tablespace) to speed up access to the main segment. Additionally, any columns that cannot fit into a single block must go into the overflow area.

When an IOT is created using an overflow segment, Oracle will automatically create a second table with a name like SYS_IOT_OVER_XXXXX. Trying to use this table directly results in the above error.

If I query dba_tables, I see that SYS_IOT_OVER_XXXXX has an IOT_TYPE of IOT_OVERFLOW (confirming that it’s an overflow table, as expected) and the IOT_NAME column gives me the name of the original table that this is holding overflow from. I can then resolve the issue by moving the IOT, specifying both the regular and overflow tablespaces:

alter table SCHEMA.”TABLE_NAME” move tablespace TABLESPACE_NAME overflow tablespace OVERFLOW_TABLESPACE_NAME;

Now Oracle moves the overflow table along with the heap-organized table, and everyone is happy.

On Writing, Learning, and More

The problem with having a blog is that you have to post new content pretty consistently, or else it becomes just one of the 70 zillion sites on the internet that never gets updated and nobody reads. The question is, how do you always manage to have something to say on a (weekly or better) basis?

This becomes more difficult when it’s a professional blog rather than a personal one. I could certainly write a few posts about my amazing sabbatical in Europe (if you have any interest at all in history and/or castles and have the opportunity to see the Tower of London, DO IT!), my experience as a foster parent, and so on – but on a blog that’s focused on technical issues (specifically, programming and computer science) how many people who aren’t personal friends of mine will care?

Tower of London by Christine Matthews. Used under Creative Commons license.

On the other hand, if I can produce enough content that will be generally relevant to the main topics of the blog, then people can always skip the occasional diversion and come back for the next post. Which brings me back to the original question: how do I manage to consistently deliver content that the majority of readers will find useful? It’s not like I run across and solve an interesting problem every single day.

So I’m going to try a different approach. I’ll continue to do what I’ve been doing – when I have an opinion about a programming topic or just learn something I find interesting, I’ll write it up – but I’m also going to start chronicling things from my personal life that might be of general interest – like, again, what not to miss on a European vacation – even if they’re not strictly technology-related.

Additionally, I’m going to try to formalize my self-improvement program and use the blog to keep it moving. I’ve been in my current developer position for nearly six years now and am at the point where I’m comfortable with it, but even with my current responsibilities I still don’t feel like I’m really an expert developer. I’m always working to improve, but the hassles of day to day life mean that that books pile up unread and that Pluralsight subscription doesn’t get used nearly enough to justify the cost.

So I’m going to set a fairly straightforward goal: at the end of each workday, I’ll try to think of something that I learned or that became more clear to me that day. If I can’t think of anything, then I’ll pull out some type of educational material and go through it until I find something. That something can go on a list, and that list can be topics for blog posts to help me solidify things in my mind.

Maybe that won’t be anything groundbreaking. Maybe it’ll just be a better understanding of how to do something simple in TypeScript. But it seems that by doing this, I can’t help but become just a little bit better every day, and just like compound interest, all those small gains are going to build up over time.

Pretty soon I’m expecting a promotion to senior developer. My goal is to raise my skills to the point where I feel like I deserve it.