Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Supplied interface and its implementing class

 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After this declaration: class Data implements DBAccess
is it assumed that I will strictly reference Data this way: DBAccess data = new Data();
Or I may create instance of Data this way: Data data = new Data(); in order to invoke methods not declared in DBAccess? Or cast it to (Data) only in those methods where I need methods in Data class?
Thank you very much!
Seid
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Seid,
Or I may create instance of Data this way: Data data = new Data(); in order to invoke methods not declared in DBAccess?

IMO, this is perfect.
Best,
Phil.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the way I'm doing it too. There's no need to be able to interact with separate types of database (or rather, DBAccess objects) in my specs. It's probably the same with your specs too.
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Philippe and Nathaniel, thank you again for your replies -- I am more certain about my design now!
Seid
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic