UCLA Computer Science 130 (Winter 2005) midterm 100 minutes total, open book, open notes Name:_______________________ Student ID:_______________ -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ 1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11 |12 |total | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ 1 (5 minutes). During which parts of this quarter (if any) will your software project most likely to be exempt from Brooks's Law? Why? 2 (10 minutes). Give some good examples of the application of the Pareto Principle to software construction. 3 (5 minutes). Which integration strategies are tinderboxes (i.e., smoke and build tests) inappropriate for? Explain. 4 (5 minutes). What abstract layout rule is violated by the following code, and why? if ( ( ( '0' <= inChar ) && ( inChar <= '9' ) ) || ( ( 'a' <= inChar ) && ( inChar <= 'z' ) ) || ( ( 'A' <= inChar ) && ( inChar <= 'Z' ) ) ) 5 (10 minutes). Critique the following proposed coding style rule: Lay out methods of a class in the order that they are typically invoked. How well does this proposed rule achieve the overall objectives of good layout? 6 (10 minutes). Is debugging a wicked problem? Explain. 7 (5 minutes). If routine names are supposed to start with verbs, then do sqrt(), abs(), and main() have poorly-chosen names? Explain. 8 (10 minutes). Code that is written in a strictly functional style can ignore approximately half of McConnell chapter 14. Which half, and why? 9 (10 minutes). Does refactoring typically make code shorter or longer? Faster or slower? Why? 10 (5 minutes). Which technical problems occur with optimistic version control systems but not with pessimistic ones? Which problems occur with pessimistic ones and not optimistic ones? 11 (10 minutes). Give brief, concrete code that should not be rewritten to avoid hybrid coupling. Explain why it should not be rewritten. 12 (15 minutes total). How do the following construction heuristics affect the ease of adherence to the Liskov Substitution Principle? Explain. 12a. the Law of Demeter 12b. Avoid classes named after verbs. 12c. Use a consistent level of abstraction. 12d. Avoid base classes with more than ten subclasses. 12e. Use classes to model real-world objects.