Jim Dong

Greenhorn
+ Follow
since Jul 09, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jim Dong

Alan,
since you are here, can you share your list of recommended
pattern/OO books?
Thanks.
It looks good. How do we qualify for the give-away? Just to post messages?
Regards.
Thanks Arvind! Now I understand what you are trying to do.
Thanks again.
Hi,
I am not able to put the real "less than" or "greater than" sign in the code segment I wanted to show in the message.
You may find the following code strange, but it is correctly written, but incorrectly shown!
for ( int i = 0; i < 10; i++) Sytstem.out.println(i);
If you have any clue, please help.
Thanks.
23 years ago
Hi,
I believe that your code has little problem.
The following code

for (int j=0;j System.out.println(" values "+j+" = "+values[j]);
}catch(Exception e){}

should probably be:
for (int j=0; j less than values.length; j++) {
System.out.println(" values "+j+" = "+values[j]);
}catch(Exception e){}
Hope this helps.
(Sorry I can't put the real "less than" sign there )

[This message has been edited by Jim Dong (edited July 31, 2001).]
Hi Arvind,
thanks for the reply. Maybe I didn't make myself clear. Please see my renewed explanation/question below.
You wrote:

Hi Jim,
Database interface just has lock,unlock and criteriaFind method definitions along with other public method
definitions of the Data class. And DatabaseImpl class extend Data class and implement Database interface:
public class DatabaseImpl extends Data implements Database {
}
-Arvind


My question is: Does Data class implement Database interface? I guess in your design it doesn't.
So your Data class would be like:
class Data {
...
void lock(int recordID);
void unlock(int recordID);
...
}
And your Database interface would have the redundant methods defined:
interface Database {
...
void lock(int recordID);
void unlock(int recordID);
...
}
When it comes to define DatabaseImpl class, you have following:
public class DatabaseImpl extends Data implements Database {
...
void lock(int recordID);
void unlock(int recorID);
}
Do the methods lock, unlock in DatabaseImpl implement the mothods in Database interface or do they override the methods defined in Data class?
If you removed lock, unlock and other methods from Data class that are defined in the Database interface, the it would be no confusions.
Please correct me if you think I miss something here.
Thanks.

[This message has been edited by Jim Dong (edited July 31, 2001).]
Bitwas,
you need to call up SUN, pay for about $250 (depending on the country you are in). Then SUN will give you the web address to download your assignment -- That is what is meant as purchasing the assignment -- I guess.
Arvind,
in your message, your design is:
<bold>
- DATABASE functionality: (database operations)
*Database interface -> which has definitions of all the public methods of the Data Class along with lock, unlock and criteriaFind method definitions.
*DatabaseImpl Class -> extends Data class and implements the Database interface. Overrides lock, unlock methods and implements the criteriaFind method. (so basically I do not change anything in the Data class).
</bold>
I have a question:
Since your Database interface AND Data class both have lock/unlock and criteriaFind methods, how do you extend Data class and implement Database interface at the same time for DatabaseImpl class? Please clarify a little bit.
Thanks in advance.
[This message has been edited by Jim Dong (edited July 30, 2001).]
Thanks. So it looks like almost all Java objects are first-class objects. Do you have any example(s) showing non-first-class objects?
Thanks.
scoring 6/10 doesn't make me feel good, since I missed #1,3 and 4, which should be relatively easy. :-(
23 years ago
Hi there,
I have encountered the term "First class object" in the GoF book "Design Pattern", when it comes to Command pattern. Since I have not seen this term before, I searched around and did not find anything satisfying. So I would like to ask for some help here. Does anybody know what "First class object" mean?
Thanks,
Jim
Peter,
do you mean that people rip the original Data class and put it into a class and an interface? Please clarify a bit.
Thanks.
[This message has been edited by Jim Dong (edited July 10, 2001).]