Richard Roehl

Greenhorn
+ Follow
since Apr 29, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Richard Roehl

Sorry, no that change won't work for two reasons: 1) the wait has to be on the locked object and not the current thread. 2) The wait has to be implemented on the server side code and not the client. Ask Andrew Monkhouse (the moderator) if his book on SCJD will be enough for you to get a clear idea of what Sun is expecting.

Richard
So I got my results today (July 14th, took the test on June 18) and got the dreaded auto-failure. The comments were: "When I started your app in non-networked mode, I got a frame with 3 menus: Database, Search, and Help. The Database->Connect... menu item was disabled, so I couldn't continue. "

My GUI has a menu bar with 3 items on it:

Connect - Sub items are: connect, disconnect, exit.
Search - No sub items, click it and a search frame pops up.
Help - Sub items are: "General Help" and "Help on Current Screen"

In non-networked mode the connect, and disconnect items are disabled by design but the search item is fully functional. So what I think happened is that they clicked on Connect, saw that they couldn't do anything there and then ran their mouse over "search" expecting to get a sub-menu of search items. But instead it appeared to be an empty menu under search so they never clicked it (The thing to understand here is that once you click a menu to activate the pull down, all of the other menus automatically pull down as you run the mouse over them until you click again to turn that feature off).

So how could I avoided this? Better documentation! I put 99% of my documentation on-line. I think I could have avoided this if I wrote some offline documentation that EXPLICITLY said, click-here, expect this, click-here, expect this, click here, expect this, etc.

So to all of those wondering what to document... tell them exactly what you want them to do or you might be unpleasantly surprised! Now excuse me while I go beg for them to re-evaluate.

Richard
What you have implemented falls more into the category of "spin-lock". What they want you to use is the Object.wait(), notify() and notifyAll() methods. These methods put your method call to sleep for you and don't use any CPU whatsoever as they are held in a queue that requires a notify() interupt to release them. Your code uses CPU every 100ms. This concept is covered in undergrad computer science programs so if you are not a C.S. student you probably won't run into this unless you've specifically read some advanced books on multi-threaded programming. I haven't read the Monkhouse book but I imagine he probably has layman's explanation of the concept. Someone correct me if I'm wrong.
On your client side:



Sleeping for 100 ms and then checking to see if the record is still locked violates the spec.

On the server side you need to tell us what the "lock" object is. It appears to be some kind of Collection object but what it really needs to be is a ReaderWriter lock.
In the U.S. the prometric voucher is a separate purchase from the SCJD assignment. When I purchased my SCJD assignment I did not recieve a Prometric voucher number, I only recieved an email with instructions on downloading the assignment. When I was done with the assignment, I went to the sun site and paid a different amount for "Part 2" which then emailed me the prometric voucher number.

So if it is the same in India, then yes you need to pay an additional 12,000.

Richard
In the U.S. the prometric voucher is a separate purchase from the SCJD assignment. When I purchased my SCJD assignment I did not recieve a Prometric voucher number, I only recieved an email with instructions on downloading the assignment. When I was done with the assignment, I went to the sun site and paid a different amount for "Part 2" which then emailed me the prometric voucher number.

Hope this helps.
Richard
Ewan-

Stop stressing!

1) The padding issue has been discussed before. You can either do as the spec says or argue that you followed what was given to you. Either way document it. They can't secretly pick the way they want it and then fail you if you choose the opposite.

2) Javadoc'ing the interface is probably a good idea. I don't see them performing a diff on the file they gave you and then blindly failing you if it doesn't match character for character. If anything I would imagine they have a pre-written test case that calls your COMPILED implementation and if that throws an error then it would be an auto-fail situation.

3) Your additional interface doesn't sound controversial to me. I personally chose to extend the interface but I did also contemplate writing a second one too. Just document your reasoning in the choices.txt file you are going to provide.


Richard
Unfortunately the answer is "it depends". They give you a client/server type project and then it will be based upon your experience as to how fast you get it done. Somewhere in the forum someone claimes it took them 3 weeks of full time work to do the project from start to finish. My guess is that they were probably a pretty experienced programmer in terms of DB, network/RMI and GUI coding to get it done that fast.

You will also find posts of people realizing how long it would take to complete and then they went ahead and started one of the other certifications first because they wanted to build their resume fast and this wasn't the project to do it.

I received my assignment at the end of January and it's now the 3rd week of May and I expect to be done within a week. So 12 weeks of at least 12 hours a week spent on it puts me at 144+ hours. I had experience with ReaderWriter locks and I chose Socket networking (as opposed to RMI) because I had implemented that type of logic at least twice before. So I completed those parts of the project very quickly, but because I had never done more than a single panel on any GUI app I've ever written, I spent most of my time learning how to program a complex multi-pane GUI.

Hope that helps.

Richard
[ May 25, 2008: Message edited by: Richard Roehl ]
There is a little discussion of "what's the difference between automated code and hand code?" here link.

Okay, I've worked on this over the last couple of weeks, finalized my GUI and then converted my code into what I feel comfortable submitting.

Here is what I did:

1) NetBeans creates external ".form" files along side your java code when you use it for GUI creation. That's obviously not "my own work" and it's not useful outside of NetBeans so I deleted them.
2) It puts comment tags into the source that tells the editor not to allow user edits on the auto-generated code. I got rid of all of those.
3) It likes to use fully qualified package references (e.g. new javax.swing.JPanel()) instead of imports. I stripped out the fully qualified references and used import statements.
4) It puts class scoped component references at the bottom of the source file and I like them at the top, so I moved them there.

At that point the only "evidence" that I used a code generator was in the initComponents() method. So I went through the classes one by one and did the following:


- I found that NetBeans likes to use the default contructor and then modifies the component one method at a time. For example instead of saying 'new JButton("my button"') it would generate 'b = new JButton(); b.setText("my button");' So I consolidated everywhere I could.
- For real small classes, like my online help that simply displays HTML, I got rid of the initComponents() method and put the GUI code directly in the class initializer.
- The order in which components are initialized and added appeared random, so I rearranged the code and commented it so that someone reading it could follow along in a left/right and top/down order initialization path.
- Where I used GridBag I noted in the comments the number of rows and number of columns and then ordered the initComponents code by rows and columns.

If your sitting there thinking, "He just re-ordered code that his IDE generated and it's not his own work" then so be it. I came up with the overal GUI design, I tweaked the screens so that they looked good, I put the logic in the methods that were called when the GUI was "clicked", I simplified the generated code where reasonable and I rearranged and documented the generated code so that it would "be readily understood by junior programmers". That's exactly what I would do in the real world.


So, I guess in the end I'm arguing that I truly don't believe you have to code this project entirely from scratch and you shouldn't be afraid to use NetBeans or any other IDE to help you achieve your goal.

Richard
On the JFrame you want to ignore the close button, call:

setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

I take it one step furthur and re-map the closing of the window to be equivalent to them selecting "Exit" from the menu bar with this code:

I pondered that myself and here are my thoughts...

I am using NetBeans 6.0 which allows you to build GUIs via a GUI and then it re-generates the code every time you change something. The generated code gets put in one big method called initComponents() and then that is called that from the constructor. So if you respect NetBeans' opinion then you should not put component builder code in the constructor but it's okay to have it all in a single long method.

Regarding documentation... Because NetBeans auomatically generates code you can't easily just jump in their and add comments. I'm probably going to argue that since it was generated automagically and that I used appropriatly named variables to reference the GUI parts, any additional documentation would violate their their mandate that states, "do not provide comments that do not add to the comprehensibility of the code."

So I would agree that you should keep it all in one method and not add anything more than the one line headers to logically break up the sections.

Richard