Sarah Archer

Greenhorn
+ Follow
since Jul 25, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sarah Archer

The last stage for me was the essay, which I completed on the 12 June meaning a delay of almost 4 months! I have also achieved 366 (presumably out of 400) which sounds much better as 92%.
8 years ago

Dmitri Cherkas wrote:
... But if you used java.lang.IllegalStateException to handle this situation ... and pass with famous score i will use this construct too...



That's such a bad reason to use an IllegalStateException - and you can hardly put it in your choices.txt If you have a good reason for doing something different, and you have, then you should go with it.

Ixus See wrote:the lesser experience you have, the easier it is for you to pass this exams ... for old birds, ... is going to be hard ...



I am not following your logic that the more experience you have the harder it is to pass the exam. Surely the more experience you have with programming in general and J2SE in particular, the easier it is to build the application to the specification given in the assignment - which should be the key to passing the exam.

I have got plenty of experience, but I have never used Swing or NIO before [my exam allows NIO], and only had a little experience with RMI. Therefore, there was plenty for me to learn.
The properties that you are persisting sounds about right, but will depend on how you have coded your app. You state that you have not provided a GUI to modify these settings. If there is no GUI how are they changed?

It should not be necessary to have to modify your /etc/hosts to get the application to work correctly. Most people only seem to test all the components running on one machine - i.e. localhost. I doubt many people try to get the app to work correctly across a LAN. It is up to you to decide if running across a LAN is part of the requirements.

I would be very wary about putting in the User Guide and choices.txt that the user needs to modify the external environment. The design of the assignment, no command-line params other those specified, no configuration except via a GUI, is designed to make life easy for the examiners.

If you do choose to make the app run across a LAN, then there is a RMI solution to the issue that avoids the need to change /etc/hosts.


Wow - I am starting to see why throwing a RNFE is so contentious

@Ixus I agree that the behaviour you suggest will occur; however, I do not think this a normal flow. Once the record is deleted, then in my view it no longer exists and therefore can no longer be unlocked. In order to be able to call unlock() on a deleted record the record would have to become some kind of zombie.

@Roel I accept that it is possible to write a client that can still function correctly even without unlock() throwing, but I would not consider this good practice. For example imagine a client with a bug calls unlock() for record number 1000 and cookie 0 and record 1000 does not exist and has never existed. What should the behaviour of unlock be

  • pretend to unlock the record, but do nothing
  • throw SecurityException even though this is inconsistent with update()
  • throw RNFE


  • I know there are many different versions of URLyBird out there, but my instructions state:

    "Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file."

    To me it is pretty clear that a RNFE exception should be thrown by unlock.

    Roel De Nijs wrote: I passed with a perfect score



    Congratulations!

    Would love to see your choices.txt though, but alas that can never be...
    I implemented the RNFE on unlock() as it is part of the DB interface I was given and this interface "MUST" be implemented. It is possible that some versions of URLyBird do not declare the exception for unlock() in which case it would then be a matter of personal preference

    It also made sense to me to implement this exception. If the record you are trying to unlock() does not exist throw RNFE. If the cookie is wrong then throw SecurityException. If your code is correct then this exception should never be thrown - and neither should the SecurityException - which appears not to be as controversial. The point of the exception is argument validation and Sun recommends that exceptions should be thrown when validating arguments on public interfaces.

    That people have not implemented the RNFE and still passed may indicate that it is not an instant fail, but it is by no means certain that points won't be deducted.

    To my mind not implementing the RNFE is a very brave decision.
    Monkhouse/Camerlengo - I have mixed feelings.

    They sketch out a general solution which is helpful, but their scenario differs quite a bit from URLyBird so you still need to do a lot of work yourself.

    They take a fat client approach but leave dealing with the possibility that the client will crash holding locks as an exercise for the reader.

    I was planning to design a "zero cpu" lock manager, but before I had fully worked out the design I decided that it was overkill. They offer a really neat "zero cpu" lock manager - which would certainly have helped me if I had gone that route - but they have only coded half the class - anyone who can finish it does not need the book.

    Their code is stuffed full of read/write locks, re-entrant locks, and conditionals - all quite unnecessary. And finally their example code is not thread-safe unless I have misunderstood it [e.g. DVDFileAccess line 360 no locks are held allowing a record to be deleted in the middle of being modified]

    As to how much assistance should be provided? Having thought about it, I think it is up to the candidate. The candidate has to decide how much help they will accept and still feel they have done an honest job on the exam.

    The assignment element of the OCMJD is the critical part of the qualification. I think it is therefore important to ask how much help and assistance can be given without making the exam meaningless.

    When I worked on my submission I designed and coded it before heading over to the JavaRanch. I then checked the main themes of the discussions to see if I had missed any important issues. Based on the discussions I made some minor modifications but the overall design and code remained the same. The forum was most helpful in allowing me to understand unconscious design decisions. e.g. the 48 hour rule was background information, not a requirement, and hence I did not implement it - it never occurred to met that other people may choose to code it.
    I also enjoyed the social aspect of it - other people working on the same challenge as myself.

    A lot of people seem to take a different approach. They head over the forum, find that simplest approach that is known to pass is a thin client big hashmap and start implementing it. They struggle to write code that reads the file format, but example code is at hand to help them with that. They also struggle to write proper multi-threaded code, but an excellent test harness is available. They still struggle, so they ask questions - often many questions.

    This forum has helped me to think more clearly about the assignment but it not likely to have made a material difference whether I pass or fail. However, I get the impression that many people would not get through the exam without this forum.

    I like the forum, many people are giving their time for free, and doing a great job helping others - but I do wonder whether they are doing too good a job.
    You need to start to simplify the situation until you can track down the problem.

  • I second the comment to take Eclipse out of the loop and run from the command line
  • Are you setting the memory explicitly using Xmx? It may be that your jvm has a very low default value
  • It has been suggested that threads may not be closing. You can find this out by adding logging when the thread is created and logging when the thread is destroyed. If all the threads that you create are shutdown then you an eliminate this as a cause.
  • Run it in the debugger and in the middle of the run pause all the threads. Then look at the threads and see if any are blocking. By analysing the stack traces of the threads you will be able to determine if you have any deadlocks or other locking problems


  • My instructions contained the following text:

    Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface ... interface DB


    I interpreted this to mean that I had to implement all the methods in the interface irrespective of whether they are used by the GUI.

    I took a different view on this.

    I didn't check my magic cookie because the instructions did specify which values were valid. It seemed to be more a version number, in hex 0x101, and perhaps compatibility is maintained for minor version number increments - you don't know.

    I did check though that the record length = sum of field lengths - sizeof (deleted flag). We have enough information from the specification to know this must hold. You don't have to do it because it is not in the spec, but it is a simple check that will catch a lot of errors including bugs in reading the data file or a corrupt schema.

    Finally, I wrote the code in a similar manner to the way I would write production code - lots of logging etc.
    Interesting post. A few comments:

  • In my opinion Andrew's book uses a factory because his DB interface does not use a lock cookie and he used a fat client approach with his remote interface similar to his local interface. Therefore, the database needs to "know" which client has locked the DVD
  • I went for a fat client approach which meant I risked dropping locks if the client crashed. I therefore used a factory to track the client, the locks allocated, and if the client had crashed.
  • I think attempting to prevent a second call to a lock-method is flawed as it changes the behaviour of the Data class. The risk of lock up is an inherent feature of the specification
  • I think the implementation you propose is very risky. If an automated test harness were connected your data object, it would not know to call setClient() as this method is not in the spec. If the test harness attempted to lock an already locked record on a second thread it would throw an exception. And as you state a client can get round the logic in the business class by calling the Data object direct.
  • I get nervous about code that assumes that hashCode() is unique() but this is easily remedied


  • Regards
    Sarah
    It is looking like the new deadline is going to be 30 Sept. There is a post in the comments section from Brandye Barrington on the Oracle Certification blog at http://blogs.oracle.com/certification/entry/0582.

    Sarah
    Hi,

    I have a similar issue...

    I saved my web page containing the instructions in pdf format as the web page was complicated (it contained buttons and boxes etc).

    Does anyone know if providing the instructions in pdf format will lead to an automatic fail? I will email Oracle but I am not sure I will get a reply.

    BTW the pre-instructions were merely to "print the project", not to retain the instructions in a specific electronic format. The instructions themselves require that they are included in the submission jar but do not specify a filename or format.


    Regards
    Sarah