Maximum possible score: 50 points. Grade distribution:
40-50 1 30-40 6 20-30 4 10-20 11 !
So the half the class that did really badly has company. To pass this course with the B you need you must do better on the final!
Attached you will find a Java solution to the ticket system you have just completed in C++. It works - that is, it meets the specifications - but it's a terrible solution - full of bad smells. (I had to hold my nose to write it.)
ts-login> operator Ticket 4 submitted: Wed Apr 09 10:09:13 EDT 2003 by: eb priority: high second high priority ticket - should be served second closed: Wed Apr 09 10:09:14 EDT 2003
Answer: the important objects involved in producing this output are
You should have a vertical column for each of these, with a column for the driver (main) at the left. The read the code, thinking carefully about which objects send messages to which other objects. For example, main sends an iterator() message to the queue. The queue then creates the Iterator i, and returns a reference to that object to main. Then main sends a next() message to the newly created Iterator. The iterator sends a message to the queue to get a reference to the next Ticket, which is returned to main.
Most people missed most of this. You cannot pass this course with a B unless you can get UML sequence diagrams mostly right. Practice a lot between now and the final ...
Answer.
Most people identified many of the bad smells:
That's "jotting down parts ... you don't like." It was worth about 5 points.
Far fewer answered the question. The most important bad smell (when considering the need for refactoring) is the fact that there is essentially no object design here at all. The goal of the refactoring should be to redesign so as to use the model/view architecture. There should be a class to maintain the collection of tickets and a driver to send messages to that class to get work done. Only that class should know about the Ticket class. I allocated about 5 points for this part of the discussion.
Finally, in order to refactor properly you need to follow Fowler's methodology. Only one person in the class said that he would start by capturing the output from this program, which works correctly, and then make small changes one at a time (he told me what they would be), testing each time to see that the output remained correct.
Answer. Most people made a correct list of how C++ and Java were different. Few people distinguished important differences (like memory management) from unimportant ones (where is i/o easier? who has a priority queue in the library?).
Very few people even hinted at what I consider a correct answer, because very few people really read the question. It asks about design . In fact the difference between the languages has almost no effect on the design. There are some small differences in the implementation - how important or annoying those are depends more on which language you are familiar with than on anything intrinsic to the languages themselves.
Answer: Almost anything reasonable was acceptable. But I did judge your answer based in part on how important a topic you chose to discuss. Most people chose something about design patterns, which was a good idea. But just the singleton design pattern wasn't worth a full 10 points, particularly if you didn't get it right.