Skip to the guide

Practice: Object-oriented building blocks

MixedPractice3 pages

Here are eight questions on the object-oriented building blocks: who owns state, what a class lets its callers do, interfaces, inheritance, composition, relations, values and errors. Most of them show you a class or a design and ask what you would change. The last one puts the whole section together on a small pricing problem.

How to use this page. Set a timer for each question, and answer out loud or on paper before opening anything. Open a hint only if you have been stuck for more than a minute. When you are done, open Check your answer, read the worked answer and the list of what a strong answer covers, and compare them with yours. If yours missed most of it, reread the guide the question practises and try again in a day or two.