Written Two

Candidate Name:

Date:

 

This test utilises an open source calculator program which you will need to download from the web to analyse. It is available at http://www.eteks.com/jeks/en/. The file of interest to the test is JeksCalculator.java which is a basic calculator application. Below are a set of questions that aim to measure your understanding and interpretation of this application.

 

Question 1:

From the point of view of the calculator application describe what you perceive to be the key roles (conceptual entities) in the system. Give a one or two sentence description of each.

 

Question 2:

A former team member was assigned to code up three implementations of the interface com.eteks.parser.Interpreter to handle Doubles, Java-like Math and our spreadsheet contents.

 

They came up with:

 

You have been asked to review the code based on comments made by the team architect.

a)      She was not too keen on the inheritance hierarchy? Does he have reason to be? Would you structure it differently? Justify your answer.

b)      She disapproves of the public getCommonFunctionValue method in DoubleInterpreter? How might you rework it?

c)      She highlights a potential issue with the constructors: WrapperInterpreter() & JeksInterpreter(). How might you improve the implementation?

 

Question 3:

a)      What is your opinion on the use of public boolean keyDown (Event evt, int key)?

b)      How might the implementaiotn of the class;

private class DigButton extends Button

be improved?

 

Question 4:

The class com.eteks.parser.Syntax has the constant:

 

public final static Integer OPERATOR_BITWISE_NOT = new Integer (1003).

 

Which of the following is thread safe and why?

Integer anInteger;

a)      Syntax. OPERATOR_BITWISE_NOT == anInteger

b)      Syntax. OPERATOR_BITWISE_NOT.equals( anInteger )

 

Question 5:

a)      Your boss has tasked you with the evaluation of how the application might support new calculator types. All answers should be given as a management/architecture level overview (i.e. you should describe classes, roles and relationships).

1.      The first of possibly several variants is a non-scientific calculator that has a restricted subset of the current functionality. Describe your proposed implementation bearing in mind that time is of the essence. You should include some description as to why you have chosen a particular route.

2.      How would the anticipation of more calculator variants alter your design (given more time to accommodate this in your design)? What existing code might you reuse?

3.      You are informed that the requirements for the original scientific calculator are going to change considerably. In particular it will become considerably less dependent on the Jeks framework. This will have no affect on the other calculator types. How does this affect your design? Describe any extra information you may need or questions that you might ask.

Question 6:

When might you utilise a static variable or method? How might this policy tie in to the use of interfaces?