From my assignment instructions:
Clarity and Maintainability
A clear design, such as will be readily understood by junior programmers, will be preferred to a complex one, even if the complex one is a little more efficient. Code complexity, including nesting depth, argument passing, and the number of classes and interfaces, should be reasonable.
from Sun Certified Programmer & Developer for Java 2: Study Guide (Exam 310-035), Third Edition
by Kathy Sierra and Bert Bates
Write your code as if the person who maintains it
is a homicidal maniac who knows where you live.
And:
The exam assessors aren't thinking like my-algorithm-is-bigger-than-yours code mavericks. They aren't looking for the next great breakthrough in record-locking. They aren't even looking for new, creative implementations. They are looking for development that says, "I'm a thoughtful programmer. I care about maintainability. Readability is very important to me. I want everyone to understand what's going on with the least amount of effort. I write careful, correct code. My code might not be the snappiest, and it might even incur an extra few bytes in order to make something less complex, but my logic is simple, my code and my design are clear and implement the specification perfectly, I didn't reinvent the wheel anywhere, and gosh, wouldn't you just love to have me on your team? If your project submission says all that about you, you're in great shape.
from http://suned.sun.com/US/catalog/courses/CX-310-252A.html
Nature of the assignment
The assignment requires that you write working code for a small but plausible business system. To keep the amount of work involved to a reasonable level, the programs you create will be much more restricted in capability, and much cruder in overall presentation, than anything you would actually create for a paying customer. However, the essence of the problem will be the same. You will be graded on correctly solving the technical requirements, not on the "polish" of the finished product. Note however, that some aspects of ease of use, for example how easily the program may be started or configured, will be part of the scoring criteria. Pay careful attention to any such requirements and be sure to adhere to them.
Scale of the assignment
Obviously, the amount of time taken by a candidate to create a working solution to the assignment varies greatly. Brooks, in "The Mythical Man Month," noted years ago that programmer productivity varies by at least ten-to-one. However, a fast programmer might create a solution in about twenty hours. A more typical expectation of a time requirement might be in the order of a working week. If you spend a lot more than two weeks on the project, you might well be creating something that is more detailed than is really required, and you might want to review the scoring criteria and problem statement provided in the assignment.
Perhaps a more consistent measure of the scale of the assignment might be derived from the average number of lines of code submitted in typical passing assignments. Again, this is subject to substantial variation, but as a guide, 3500 lines of code is a reasonable estimate of the mean size of passing assignments.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Javini Javono:
Hi,
George, as always, thanks for your comments now and the many comments and
suggestions you have made in the past.
Here is my current design diagram with comments:
The above is an outline.
I'm not showing, for instance, that DBMainPlus extends DBMain and that Data
implements DBMainPlus, as this adds more clutter to the picture, but let it be assumed that this is the only way to add new, more powerful methods to Data that were not originally specified within DBMain.
George, based upon your last suggestions, where I had previously said that I would not allow the examiner to instantiate Data directly, but after your good ideas, I decided that I would allow the examiner to instantiate Data and manipulate Data through the DBMain interface, we arrive at the above figure.
Javini, are you not using adapter here? I mean, in the local mode it seems you want to send the Data as DBMain as stated in point 1 below. Can you tell me how this is good than using an adapter or if you could point out to George's links where he explained you that would be great.
There are, of course, three paths the client can use when manipulating the
database:
1. Local: instantiate Data and reference it through DBMain.
2. Local: instantiate Data and reference it through VersatileDataInterface.
3. Remote: instantiate DataImpl (which delegates to Data) and reference it through VersatileDataInterface.
Thanks,
Javini Javono
P.S.
Concerning the line of code count, which is a nice, ball-park figure that Sun has provided, I have 9687 lines of code, but this figure--based upon my tabs remover application--is over stated since it includes any .java file, including design ideas that are .java files only with comments, and utility code I wrote when I first started and which will not appear in the final project, as well as 400 lines of JUnit testing code which will quite easily rise to 1,000 or more lines (JUnit really keeps me moving quickly, and solving issues; I'm quite happy about this new tool).
[ March 06, 2004: Message edited by: Javini Javono ]
Originally posted by Javini Javono:
Hi,
Whether Data internally carries out all its work, or delegates its work does not alter the design. For instance, in my design, Data delegates all its work to other objects, which I represent symbolically as one MyDataWorker object.
I'm also thinking about using an internal class in Data as it has almost 30 methods and about 1100+ lines. I think the number of lines should'nt be a problem as Sun says upto 2000 is OK.
But, perhaps I have not answered your question correctly? So, let me ramble on a little bit more here.
Let us, for simplicity, say that an adapter pattern is one where much delegation is going on. Where, I believe, you mostly here about delegation is when DataImpl delegates it's work to Data (which occurs in my design above).
DataImpl is a distinct server object, but it contains a unique server-side
Data object. I don't want to place code in two places, so DataImpl delegates everything to Data on the server.
Am also doing something same. But let me tell you about my design in brief.
I have introduced new interface DataAccess which has only two business specific methods required for client. DataImpl implements this interface and has reference to Data. At the server, RemoteDataAccess extends DataAccess and Remote. RemoteDataImpl implements this remote interface and UnicastServerObject. Also there is connection factory logic going on...
So as yours, client has reference to DataAccess only. He don't know whether he is making local or remote calls.
If you see anything doubtful or wrong in my design, please let me know.
Concerning a couple other points:
I expose Data via DBMain in case the examiner wants to test it directly,
and, as George said, it is, afterall, a must condition.
Is this a MUST condition. I could'nt see in requirements. Maybe is it because the grader has to test all the other functinality that we provided in Data as they are not used in GUI? Am I right? To say, it is provided so as the grader has to test it whether all our Data methods can really work or not?
The reason that I have the VersatileDataInterface, is so that client code
can be the same regardless of whether or not the connection is local or remote:
wherein the client code is identical for both cases.
A similar situation emerges when I, using JUnit, become the client. I want
to test to the interface, but there is no grand interface to test all three
points of entry. So, I introduce DBMainSuper, and set up the test of all
three branches like this (for testing conditions that don't throw remote
exception):
Thanks for sharing the way you are testing.
Thanks,
Javini Javono
[ March 06, 2004: Message edited by: Javini Javono ]
Originally posted by Satish Avadhanam:
To add to Javini's coding concerns, I got a couple more.
1. My Data class is about 1200 lines. Is it ok?
2. Am using many(to say, given interface's methods + 24 more) methods. You
think its not advisable? Or shall I use any helper class to abstract some of the methods. If so, are inner class is advisable for the exam?
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Javini Javono:
If at this stage you consider
things already too complicated and getting out of hand, please let me know.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |