• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Interface Pattern for Database abstraction

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm busy working on the design of the project and was wondering if people could comment on my design for Database abstraction.
I'm thinking of implementing three interfaces, DatabaseIf, FieldIf and RecordIf. These interfaces will be implemented by the Data, FieldInfo and DataInfo classes respectively. This provides a layer of abstraction/indirection for the Database services to avoid a tight coupling. Thus, the Data, FieldInfo and DataInfo classes could be swapped for other classes implementing the interfaces and the rest of the application would not need to change.
I think this is a strong design principal but I'm worried as I will need to change some of the method signatures in the db classes to return instances of the interface rather than the class as before.
Will I be penalised for changing the method signatures of the db classes? Has anyone else implemented this sort of design? Should these interfaces be part of the db package or should they be in a separate package?
Cheers,
Steve
[ February 10, 2002: Message edited by: Steve Granton ]
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,
Take a look at this article if you haven’t seen it before.
http://www.javaworld.com/javaworld/jw-05-1999/jw-05-networked.html
I just used an interface for the Data class!
/Enrico
 
Steve Granton
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Enrico
That article looks the business. I might have to change my design slightly.
Cheers,
Steve
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic