The Java 2 Developer Essay Exam
Terms you'll need to understand:
Remote Method Invocation (RMI)
Design patterns
Design choices
Search algorithm
Multithreading
Techniques you'll need to master:
Describing your design choices
Answering essay questions about your solution
Recognizing legal and illegal Java identifiers
Justifying the technologies you used
Explaining the advantages and disadvantages of your design choices
In this chapter, you review the essay exam and learn what you need to do before taking it. Although the essay exam is short, you can still harm your final score if you perform poorly on it.
TIP
Study your design choices document thoroughly. Don't simply assume you'll remember that material for your essay exam without studying it. Also, you can't take any reference material into the exam room, so be ready before you take the exam. Certainly you know what you did, but trying to type the key details and names of classes, exact design patterns, and advantages of RMI versus sockets, all from recall, can be difficult while you're taking an exam.
The exam is simple. It took me 20 minutes to type complete answers to the five questions. I then spent 15 minutes reviewing and revising all answers. The entire exam took me 35 minutes, even though I was more detailed and careful than necessary. Even if you go half that speed, you need only an hour to complete the exam. Again, by thoroughly studying your design choices document to help you prepare, this exam will not be difficult.
The Exam's Purposes
The essay exam has four purposes. Sun does not state them anywhere, but I hope you'll agree that the exam serves the following purposes, instead of testing your understanding of the technology, as all the other certification exams do.
First, the essay exam is a fraud buster. The evaluators will know whether you wrote the code by matching your essay answers with your actual code. For example, if your essay exam answer talks about sockets but your certification project uses RMI, you'll get a call from the secret police. By asking "How did you do such and such?" the evaluators want you to demonstrate an in-depth familiarity with your submitted solution. There is little technical challenge to answering that type of question, if you did the work yourself.
Second, the essay exam assesses whether you understand the technology needed to satisfy the assignment requirements. Evaluators want to know, for example, how well you understand RMI or sockets, whichever one you chose. It is good if you can build a program using one of these technologies, but showing mastery of the technology is better.
Third, the essay exam demonstrates to evaluators whether you have a good feel for how to architect a solution. Sure, the code is a better measure of this skill, but an essay can expose foggy thinking and incorrect assumptions. At times I have finally gotten a piece of code to work, but didn't understand why it worked until lateron occasion, much later. That approach won't work here, however. Your essay description reveals how well you understand the approaches and classes you used. For example, perhaps you finally got RMI to work, but don't actually feel comfortable with its inner workings.
Fourth, the essay exam shows whether you can tell someone else about Java in a way that makes sense. In the real world, communicating how technology works is a large part of a developer's job. If you can't tell an evaluator what is going on in your solution, even though you had unlimited time to prepare, you won't be effective in real projects. Therefore, it is to your advantage to prepare for the essay so that you can demonstrate familiarity with the portions of Java used in your project submission.
TIP
I've worked with people who had difficulty communicating. They were quick at writing codevery smart in that waybut their communication skills were inadequate. Too bad: They did the hard part but neglected the easy part, so their salary suffered. I chose the word "neglected" carefully, meaning that they could have easily improved their communicating. However, they made a career blunder by underestimating the importance of communication skills. Writing about the code and your solution is nearly as important as writing the code itself. It will affect your score, so do the necessary preparation by writing out answers at length before taking the essay exam.
Table 19.1 lists the facts about the essay exam.
Table 19.1 Essay Exam Facts
Exam Fact |
Detail |
Exam type |
Essay |
Number of questions |
5 separate essay questions |
Allotted test time |
2 hours |
Average test time |
Less than 1 hour |
Test expiration after purchase |
1 year |
Difficulty level |
Moderate |
Preparation time |
4 hours of writing out the answers before taking the exam |
Impact on total score |
10% of total score |
Cost |
$150 |
Exam location |
Prometric testing centers |
Exam number |
CX-310-027 |
Prerequisite |
Submission of certification project to CertManager before you can buy an exam voucher |
Wait for results |
14 weeks |
Passing score |
Not applicable: The exam is assessed with your certification project |
Location for viewing grade |
Sun's CertManager site |
The Questions
A few questions on the exam are not technical in nature, but they ask about implementation details to ensure that it is your code in the certification project. For example, the question "How did you implement the search functionality?" doesn't require technical know-how to answer it, just familiarity with the steps of the search algorithm you used.
The remaining questions are technical and follow the general formula of "Describe how you implemented the assignment_feature_XYZ. List the advantages and disadvantages of your approach." The following list highlights the most likely features of the assignment you might be questioned on:
Record searching by user-supplied criteria
Record locking
Error and exception handling
Extending or modifying the supplied classes
Deprecated methods in the supplied classes
Design patterns
RMI versus sockets
Network server
GUI design
JTable details
Event handling
GUI-database communication
Multithreading
Future enhancements
Preparation
The best preparation for this essay exam is writing a good design choices document. If you take the time to clearly describe how you handled the previously listed aspects of your project, the essay exam will be quick and easy. You need to restate (from recall) only the key details of the design choices document for your essay answers.
Some candidates write brief README.TXT and DESIGN_CHOICES.TXT documents and still pass. This approach is risky, however, and it won't help you with the essay exam. It is better to take an extra few days so that you can describe your work more thoroughly. You deserve the credit, so make sure you get it. Please see Chapter 5, "Documentation and Javadoc Comments," for more details on these two documents.
I actually typed out short answers to all the questions I thought might appear on the exam, and my efforts paid off. My answers were concise and showed clear thought, and they took just minutes to complete.
The Sample Essay Exam
In this section, you take a sample essay exam. Relax, it is the easiest part of the certification. It took me far less time than the exam allotted, even though I wrote complete answers. Complete answers don't necesarily have to be lengthy answers, however. My RMI versus sockets answer had eight parts, but another answer had only one crisp paragraph.
This exam doesn't intend to test your knowledge as the other certification exams do. Rather, this one simply attempts to make sure you did your own work. The evaluator compares the certification project you uploaded (which could have been completed by you or your guru friend) to the essay answers you provided (which are definitely your own work). If the evaluator finds no discrepancies, all is well. If he or she does, your final score will reflect these discrepancies.
The essay exam is an opportunity to make a good impression. After all, if the evaluators see sterling answers on your essay exam, they will assess your certification project favorably. If you ramble on about unrelated issues (for example, "Can you email me about...?") or simply write poorly, you won't get the benefit of your evaluator's doubt for those subject areas. If your answers are written well, the evaluator is more likely to think you know your stuff and will push your grade up accordingly. Be aware that grammar, syntax, and spelling matter, if only in the evaluator's subconcious. Presentation counts, just as in fine cooking: Haute cuisine never tastes right on a paper plate.
The following guidelines will help you provide convincing answers:
Take time to understand the question before writing the answer.
Provide at least one paragraph for each question.
Each paragraph must contain only one main idea.
Do not use wordy, long sentences; write crisp statements.
Paragraphs should follow one another logically.
Check your spelling, grammar, and syntax before submission.
NOTE
The essay exam is designed to ensure that you are the author of the certification project. If your answers to the essay exam are not consistent with the project you submitted, your project will be suspected of fraud.
There are only five questions on the exam. Three are technical (for example, "Did you chose RMI over sockets, and why?"), and two simply test whether you did your own work on the certification project (for example, "How did you implement the search feature in the GUI?"). The following 13 questions cover all aspects of the assignment that might be on the exam.
CAUTION
You must provide answers on the essay exam that are consistent with what you wrote in your design choices document. The key to doing well on the essay exam is to provide a condensed version of the design choices document.
Prep Questions
The following questions cover the most likely topics for your essay exam. The wording of the question isn't critical, but your familiarity with the topic is.
Question 1
Describe your record-searching approach.
Question 2
Describe your record-locking approach.
Question 3
Describe how your certification project handles errors.
Question 4
Describe whether you extended or modified the supplied classes, and include a justification of that choice.
Question 5
Describe what you did with deprecated methods in the supplied classes.
Question 6
Describe how you used design patterns.
Question 7
Describe your choice between RMI and sockets, and include a justification of that choice.
Question 8
Describe your network server and how you used it in your solution.
Question 9
Describe how you designed the GUI, especially the JTable component.
Question 10
Describe how your GUI handles events.
Question 11
Describe how your GUI communicates with the database.
Question 12
Describe how your design uses multithreading.
Question 13
Describe how your design addresses future modifications.
Answers to the Prep Questions
In this section, you review the answers to the sample essay exam. The order of the questions is not important, and the answers are subjective. There are several ways to approach the answers, so the sample answers presented here are helpful, but not the only way to describe portions of your solution.
Keep in mind that the essay exam has two goals: making sure you did your own work (does it match the design choices document?) and you know what you are doing. (For example, make sure the evaluator wouldn't ask "Why is this candidate using the MVC pattern on a simple task like a search algorithm?) Remember that these answers are another chance to influence the evaluator in your favor. If you don't write these answers out ahead of time, you risk forgetting essential parts and giving incomplete answersones that might be mostly correct, but not impressive.
The answer format illustrated in the following exam answers helps convince the evaluator that you know what you are doing. Using a similar format also helps you remember the material so that you can write it out when you are in the exam roomwithout your design choices document.
TIP
Keep your answers short and factual. Do not wax eloquent about your love of the MVC design pattern. Just give direct answers. That way, the evaluators can get on with their business and award you a great score.
Question 1
For the record-searching approach, the search method is abstracted so that it will search any table. It returns an array of rows in which each row has at least one value matching one value in the search criteria, using the following algorithm:
Parse the criteria string with the StringTokenizer class.
Get a new row of data from the database.
Find a column that matches the criteria field name.
Test for a match between the row value and the criteria value.
If there is a match, save the row of data and go to step 2.
If there is no match for the current criteria, go to the next criteria and then go to step 3.
When the criteria are exhausted, go to step 2.
When the rows are exhausted, return matched rows.
Question 2
The record-locking approach implements a separate LockManager class. A row is locked and unlocked by only one client at a time. The adapter for Database, DatabaseRemote, has a one-to-one relationship with a single client, so the client ID is the reference to DatabaseRemote. In the LockManager class, the client ID is referred to with a WeakReference. That way, should another client try to lock a record previously locked by a client who has died, the LockManager class removes the lock because the garbage collector will have nullified that reference. The responsibility for record locking is kept in the LockManager class, and the responsibility for references to dead objects stays with the JVM, a clean separation of responsibilities. A separate LockManager class is justified for the following reasons:
Allows Insert Row Locking (IRL), which handles multiuser-simultaneous record modification.
Provides consistent and concurrent access to data in a multiuser environment.
Allows the client to ignore IRL in local mode.
Without a good lock manager, users could overwrite each other's seat reservations.
Question 3
Errors are handled through proper try-catch-finally constructs and strong user-informing status messages. Users are kept informed of any problems with the use of clear status updates, such as the one displayed when they type in an impossible seat number.
Question 4
The supplied classes are not modified in any way. New classes subclass the original classes for the following reasons:
To maintain legacy compatibility for the original classes
To isolate new functionality
To cleanly separate changes to the old classes
To use a new name that is more descriptive of the class responsibilities
To override deprecated methods in the supplied classes
Question 5
The deprecated methods in the supplied classes are overridden with methods in a subclass that uses the latest SDK API.
Question 6
The following design patterns are used:
MVC: The Model component is SuperBowlTableModel, the View component is the Swing GUI, and the Controller component consists of event methods and JTable-triggered code.
Business Delegate: Remote interface through RMI.
Value Objects: Database record sent to the GUI.
Connection Factory: Factory class returns the local or remote database based on parameters. Client knows nothing about this.
Data Access Objects: Database class.
Decorator: DatabaseRemote decorates Database.
Question 7
RMI is used instead of sockets for the following reasons:
Thread safety is built into RMI, but you have to handle multithreading manually in sockets.
RMI has a Remote Method Protocol (RMP) communication protocol, but sockets don't.
RMI presents a simpler programming model than sockets do.
RMI supports dynamic class loading.
Method calls are type-safe in RMI.
RMI is built on sockets and is more mature.
It is easy to add new objects with RMI.
RMI is a known standard, so it is easy to share code with other developers.
The Registry acts as a central lookup for finding various remote objects.
Question 8
The network server is a combination of a database system using a binary file and RMI. The project uses RMI to listen to users. It is the RMI that transforms a single-user file manager class into a multiuser database server.
Question 9
The user interface is designed for ease of use, following good Human/Computer Interaction (HCI) principles. Several aspects of the GUI merit explanation. For example, the user can make a reservation in three simple moves: select a seat from the table, type in the number of seats, and click the Reserve button. The search feature is easy to use, with drop-down combo boxes filled with predefined criteria. Only Swing components are used in the GUI. The key components are a JTable, menu bars, buttons, combo boxes, labels, and tool tips. The GUI has a user-friendly look and feel. Additionally, the user can sort the entire table by clicking on any column heading. GUI components are arranged by using the BorderLayout component. These components are automatically repositioned proportionately when the window resizes. Altogether, the components' arrangement and interaction are designed to facilitate easy navigation, according to good HCI principles.
Question 10
The GUI handles events via the event model of MVC. User actions trigger event method invocation in the Controller component (logic code in the GUI), where a response is generated (for example, a seat is reserved).
Question 11
The GUI communicates with the database in two modes, local and remote. A separate DatabaseFactory class returns the local or remote database, based on parameters. The client does not have any lines of code specific to local or remote modes.
Question 12
This design uses multithreading, which comes with RMI. Also, the LockManager class has synchronized lock and unlock methods, so they are thread safe. Finally, public methods of the Database class are synchronized, which allows multithreading in a multiuser environment.
Question 13
This design addresses future modifications by using an architecture mixed with preexisting parts that already lend themselves to modifications and new robust parts. They include RMI (easy-to-add objects), an abstract search algorithm (works with new tables), a separate LockManager class (works on any record on any table in any database), a single interface that defines database methods (whether in local or remote mode), and SDK classes (such as StringTokenizer) instead of custom ones whenever possible.