aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question from Max Book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question from Max Book" Watch "Question from Max Book" New topic
Author

Question from Max Book

Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
I am reading Max book.
There is class DVDDatabaseImpl. Page no. 175.
public class DVDDatabaseImpl extends UnicastRemoteObject implements DVDDatabaseRemote {

private DVDDatabase dvdDatabase = new DVDDatabase();
public DVDDatabaseImpl() throws RemoteException {
}
..
..
}

In explanation about this class. One of the reason is given as :

"We wanted to create a level of seperation from the application logic and the two networking approaches : RMI and sockets. With the preceding design
, we will able to easily use the socket or the RMI code depending on our preferences. We have eleminated any dependices between networking package
and db package."
Questions:
1. Can this class be used as it is, if network server is socket based ?
2. How will it compile, if it does not import DVDDatabase, which is in db package (I assume)?
3. How does this class eleminate dependices between networking package and db package ?
My question may be silly. I tried to understand this , but could not understand. Please help me out.

Regards,
Akash
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Akash,
I will take a stab at it:
You asked:

1. Can this class be used as it is, if network server is socket based ?

I don't think Max is referring to DVDDatabaseImpl class. This class is extending the UnicastRemoteObject class that is RMI specific. He is talking about the DVDDatabase class which can be used by both RMI and Socket techniques.
You asked:

How will it compile, if it does not import DVDDatabase, which is in db package (I assume)?

He doesn't show the import statements in his book for since he doesn't want to clutter up to code. If you download the codebase from his book's website and print it out, you will see that the db package is being imported. He does mention in his text "Most of the code has been omitted for brevity, but the unexpurgated verion can be viewed in the project download from the Apress Web site."
My advise is to download the project code and print it out. When I was learning from his book initially, I would keep the full-source code handy and whenever I had doubts or desire to "dig" into working code, I would refer to it
You asked:

3. How does this class eleminate dependices between networking package and db package ?

This does not eliminate the dependencies between networking package and the db package, rather it "contains" it. By the way, there is a problem in Max's book in the source code shown on page 175 (at least in the version that I have). It shows:

If you go through the code that you download, you will see that it is as follows:

Make sure that you notice how the private instance variable is being instantiated. It is being given an instance of DVDAdapter!
It is the DataAdapter class that wraps the database layer in a wrapper or adapts it for the network layer. In better designed systems, major sub-system interact with each other through well-defined narrow channels such as the DVDAdapter class, but it doesn't eliminate the dependency between them.
Hope this helps.
Regards.
Bharat


SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
Thanks, Bharat Ruparel. Yeah, i see that when i downloaded zip files.
It means, DVDDatabaseAdapter class is key here. If network server protocol needs to get change, DVDDatabaseAdapter can be used as it is.
Regards, and Thank You Very Much.
Akash.
Karthik Balasubramanian
Ranch Hand

Joined: Dec 13, 2002
Posts: 43
Hi Guys,
I see there are lot of discussions on "Max Book"...what is this book? who is the author? I went to SCJD FAQs page and I dont find any books on that author's name...by looking at the level of discussion, it seems like a good book? Is it worth buying..I am struggling on where to start my project...
please give me the book info, so that I can buy then?
Please reply me...
Karthik
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
The Book of Max. (Max is actually "Mehran", but he likes to confuse people by changing his name at random.) Max was a bartender in this forum until recently; he had to take some time off. But you may see him now and then anyway. His book is highly recommended, probably the single best source for the SCJD exam.
[ September 29, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
If it was just by changing his name at random ...
Now seriously, it's the best investment you can do before starting the project.
Till Andrew writes his own one.
Best,
Phil.
PS: Why cannot I be serious more than one line out of two ? I should edit this post and clear the smiley on the third one ... Oops ! Again !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question from Max Book