• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adapter for supplied Interface to DB Implementation OR how strict is sun?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there.

I am a little bit unsettled: In the B&S assignment I got that not so nice interface with a lot of String[] arrays in it. Naturally I don't like untyped information, so I am going to eliminate them as soon as I get them.

Solution:
My (dirty) interface --> Adapter(Design Pattern) --> nice Interface (without String[] arrays) --> DB

Now the reason for my unsettled feelings: Sun defines in my assignment "Your data access class must called "Data.java", must be in a package called "suncertify.db", and must implementt following interface:"

In my clean design (I guess) my Implementation of the specified interface would be my adapter (I could call the Adapter Data.java). Normally I wouldn't even think about that, but I don't want to fail in any automatic tests, Sun is going to run after my uploading.

Has anyone had similar thoughts before me and had no problem during validation?? I would like to keep my design clean, but I am not sure how strict sun is going to evaluate all the 'MUSTs' in the assignment.

Any tips?

Best Regrads,
R

PS: I am not talking about an adapter, so that the client don't see the lock/unlock methods. I am talking about the upper tier to the used DB.
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Sun treats any must statements very seriously. I think with this design you would probably fail as Data must implement the interface no matter how much you dislike it. I am confused as to why you would want a clean interface to the DB and then expose the supplied interface to the client via the Adapter class. Surely the otherway around would the better solution.

I thing the DB interface is quite a good generic interface (stupid Exceptions and find method apart). My data class accepts any String[] once it contains ASCII charchters with the correct number of fields of the proper length, according to the schema. It is up to higher layers to apply the application specific data validation.

Mark.
 
Rudolph Jen
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, thanks for the wakeup ;-)
To be sure I am going to follow you advice. No Adapter in that way.

>It is up to higher layers to apply the application specific data validation.

That a good idea. So I can use my design almost as wanted, but still have a validation tier. I like it.

Tanks.

Best Regards,
R
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic