Professional C__ - Marc Gregoire [496]
A potential employer will also want to know that you’re able to work with code that you didn’t write yourself. If you’ve listed specific libraries on your resume, you should be prepared to answer questions on those. If you didn’t list specific libraries, a general understanding of the importance of libraries will probably suffice.
Things to Remember
Design is subjective — be prepared to defend design decisions you make during the interview.
Recall the details of a design you’ve done in the past prior to the interview in case you are asked for an example.
Be prepared to define abstraction and give an example.
Be prepared to sketch out a design visually, including class hierarchies.
Be prepared to tout the benefits of code reuse.
The concept of libraries
The tradeoffs between building from scratch and reusing existing code
The basics of big-O notation, or at least remember that O(n log n) is better than O(n2)
The functionality that is included in the C++ Standard Library
The high-level definition of design patterns
Types of Questions
Design questions are hard for an interviewer to come up with — any program that you could design in an interview setting is probably too simple to demonstrate real-world design skills. Design questions may come in a more fuzzy form, such as, “Tell me the steps in designing a good program,” or “Explain the principle of abstraction.” They can also be less explicit. When discussing your previous job, the interviewer can say, “Can you explain the design of that project to me?”
If the interviewer is asking you about a specific library, he or she will probably focus on the high-level aspects of the library as opposed to technical specifics. For example, you can be asked to explain what the strengths and weaknesses of the STL are from a library design point of view. The best candidates talk about the STL’s breadth and standardization as strengths, and its steep learning curve as the major drawback.
You may also be asked a design question that initially doesn’t sound as if it’s related to libraries. For example, the interviewer could ask how you would go about creating an application that downloads MP3 music from the web and plays it on the local computer. This question isn’t explicitly related to libraries, but that’s what it’s getting at; the question is really asking about process.
You should begin by talking about how you would gather requirements and do initial prototypes. Because the question mentions two specific technologies, the interviewer would like to know how you would deal with them. This is where libraries come into play. If you tell the interviewer that you would write your own web classes and MP3 playing code, you won’t fail the test, but you will be challenged to justify the time and expense of reinventing these tools.
A better answer would be to say that you would survey existing libraries that perform web and MP3 functionality to see if one exists that suits the project. You might want to name some technologies that you would start with, such as libcurl for web retrieval in Linux or the Windows Media library for music playback in Windows.
Mentioning some websites with free libraries, and some ideas of what those websites provide, might also get you extra points. For example, www.codeguru.com and www.codeproject.com for Windows libraries; www.boost.org for C++ libraries; and www.sourceforge.org for Linux libraries. Explaining the major differences between some licenses, such as the GPL license, Boost license, Creative Commons license, CodeGuru license, OpenBSD license, and so on, might score you extra credit. Don’t stress GNU/GPL too much; you might get negative points because you might be seen as an active hazard to the company’s Intellectual Property (IP).
CHAPTER 3: DESIGNING WITH OBJECTS
Object-oriented design questions are used to weed out C programmers who merely know