Fridays are optional days, and job preparation workshops are offered. I was intimidated by this, and so I participated. We were given a spec, and set off to write as much as we could, and we gathered in groups later to review each other's designs and code.
The problem involved writing a simple database with a particular command line interface.
During the discussions I noticed two interesting things.
- First, I noticed some things about my own style of program building.
- I tend to start bottom up, making functions one at a time, approximately test-first, and not gluing them into the system until later. I'm not sure how I feel about that. I like to focus on core functionality, but it does break the "minimum viable product" rule of thumb. When it was time to break, I hadn't finished my core functions, and had not touched the command line integration yet. So from one perspective, my program did nothing! On the other hand, it was probably useful to focus on the meat of the problem, because I had confidence that I could make the command line interface work later. I'm not saying there is a single right way, but it was useful to me to think about what choices I am making, so I can make them more deliberately.
- Even so, I had not successfully purified the functionality from the interface, and after the discussion, I could see much more clearly how to divide the problem more cleanly into modular interacting pieces. This leads directly into the second point.
- Alan encouraged us to think about the particular constraints we were given in a modular way: What if the data set was much bigger, so you couldn't hold it in RAM? What if the interface needed to adapt to a web app instead of a command line? What if the access to the fields needed to be fuzzier or more flexible? And so on. This is useful when designing, and in the practical situation of an interview, it would show engineering maturity to be able to talk about a problem in this way.
The situation reminded me of the introduction to Dennet's book, Intuiton Pumps, that I mentioned yesterday, in which he gives a thought experiment called the Whimsical Jailer, intended to prompt some considerations about the notion of free-will:
"Every night he waits until all the prisoners are sound asleep and then he goes around unlocking all the doors, leaving them open for hours on end."
Dennet goes on to talk about the importance of "turning all the knobs", in this example to segment the semantics like this:
Every night ‖ he waits ‖ until all the prisoners ‖ are sound asleep ‖ and then he goes around unlocking ‖ all the doors, ‖ leaving them open for hours on end.
and consider the effect changing any of these variables has on the intuitions that it pumps.