Jonathan Liu

Greenhorn
+ Follow
since Aug 21, 2003
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 Jonathan Liu

No. 36
Jonathan Liu
Toronto, Canada
But I only got the passing score, so lucky!
Hi Long
I believe what George said is very clear, you should do this way:
long lockCookie = data.lockRecord(long recNo);
data.updateRecord(recNo, data, lockCookie);
data.unlock(recNo, lockCookie)
maybe you can tell what and how would you do if you don't call the sequence.
A lot people use Random as it is suggested, but there is still some arguements about it, so I guess ues Random or self incremented are both ok.
I don't know if it's possible to use others voucher
I live in Toronto too
Complain to Sun, maybe they can rectify it for you
Good Luck!
I can't tell you which part is hard because I am new to J2ME
I believe these questions are not tricky and if you have good memory, you can get a high score
Hey, after 4 hours exam, I am exhausted and I have the same feelings as Vedhas Pitkar because I am a novice too.
Good Luck to all of you!
Think it this way
because most people don't have enough time prepare this test
so it maybe a little bit easier to pass
Good luck to all of us!
Hi Mark, thank you for pointing out the Hook pattern, but use this kind of method, does it make your code more difficult to read ? Or would you please make some suggestions about this? If a junor programmer like me don't know much about MVC before, he may take a long time to understand your code
Eugene, if I "combine View and Controller into one entity", could this still be called a "Framework" which is stated in the requirements
Thank you both very much!
From book Java� 2 Developer Exam Cram� 2 (Exam CX-310-252A and CX-310-027)
it states this:


The following describes how the MVC pattern was used in this application:
* Model--SuperBowlTableModel, which extends AbstractTableModel.
* View--Swing GUI, including menus, buttons, combo boxes, and a JTable.
* Controller--Event methods and JTable-triggered code.
The JTable is set up to allow only row selection. Cell editing is forbidden to avoid confusion. Tool tips and a status bar keep the user informed.


To my understanding, JTable has already used MVC pattern and I wonder if I just create a class which extends AbstractTableModel, and combine View and Controller in a single class, is this still an acceptable "framework" ?
From thread:Confused with MVC ,Eugene Kononov gave an example how to implement MVC. Following his aproach, I found it more cumbersome than I was expecting.
For example, View has to expose every parameters Controller needs , which doesn't seem so elegant, like this:

and I need to think about how to deal with exceptions in Controller and show messages in View.
If follow the Java� 2 Developer Exam Cram� 2's instructions and example is enough to pass the exam, I would like to choose a simple way.
Your advices highly needed.
Thank you
Since multiple tables are not required in the assignment, I personaly don't prefer to touch that part of design
Using FileChannel, I don't need to synchronized anything.
in my readRecord method, I use the codes:

you see, to read a record, I just read once without moving the file pointer, plus read methos is atomic, so I think this is enough
If you don't mind, I would like to add something.
I think use FileChannel is simpler than using synchronized RAF if you are not sure your solution is perfect.
use methods:

you are guaranteed that file pointer will not be moved and also you get safe atomic file operation.
I have a question about your isValidRecord method. In this method, you check 1. the record is invalid. 2. the record is deleted already. However, look at the code in Lock method:

after isValidRecord is called and before synchronized(lockedRecords), there is a possibility that another thread using cpu cycle and delete this record and set the deleteflag to 1. In my design, I just check the record number is in the right range in the Lock method, even if this record is already deleted.
[ January 23, 2004: Message edited by: Jonathan Liu ]