• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about Denny's DVD on the Connector class  RSS feed

 
Ed Tse
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the advantage of having the connector class with 2 static method to choose between local db or network connection? What does it provide over loading it directly on the Controller's constructor (or the initiate method, I forgot what the method is call since I don't have the book+code with me at this moment).
 
Jason Moors
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got one ConnectionFactory class which returns the local or remote connection.

I could be wrong but my understanding of the code was that there are different static methods because the example has been written to support Local, RMI and also Sockets. In the example both the RMI and Socket connections require a hostname and port so it wouldn't be possible to overload (Without adding another parameter).

Jason
 
Ed Tse
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, ic so it's a factory. It make more sense to me now, thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!