SCJP 1.4, SCJD
Originally posted by mike acre:
If you extend the supplied interface (DB) and have your Data class implement that, is that in any way penalised?
I know I will still comply with my spec, because I my data class will still be implementing DB. I'm just worried about Sun's dreaded testing software.
I was proposing to extend Suns interface and add some schema retrieval methods. And use objects of this type in my business layer.
Do the old hands know of any cases where this has been penalised?
Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Originally posted by Anton Golovin:
If you use a DataCache class, it would serve as the perfect place for schema-retrieval methods.
It is not permitted to extend the DB class. It must remain completely the same and named the same, because the specification says that even a minute deviation from the correct spelling may cause automatic failure. I think they check the spelling.
SCJP 1.4, SCJD
Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:
As for exnteding the DB interface for use with a different class, I thought about that, too, but then what would I do with the lock methods? Instead I am making a DBClient interface.
but it goes looks at the class name
SCJP 1.4, SCJD
Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Originally posted by mike acre:
I was proposing to extend Suns interface and add some schema retrieval methods. And use objects of this type in my business layer.
Originally posted by mike acre:
I have a feeling that the 'old hands' don't take so much notice of threads with replies.
Originally posted by Satish Avadhanam:
Not advisable. I think a couple of guys did, not sure though.
["Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface: "]
They write that wherever a "must" is seen, an absolute requirement is being described.
In my design I have:
DBCache class contains DBParser(read/write records) contains DBSchema(the schema.) DBSchema is build using DBSchemaBuilder. DBCache is the cached database.
If you happen to confirm this with someone else, please feel free to use this design: it abstracts away quite nicely all the "low-level" details from your Data class. In this design, it is the DBParser which needs the DBSchema, so your Data class never even has to know a schema exists. It only knows it is dealing with a DBCache object.
Again, sorry, I did not mean to subtract from your valuable time.
SCJP 1.4, SCJD
If you extend the supplied interface (DB) and have your Data class implement that, is that in any way penalised?
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Originally posted by Hanna Habashy:
mike,
Personnaly, I think it is fine. Here is the reason.
The tester will check for the type, not the exact name.
...
The polymorphism works its magic here. I believe that is how they check to see if you follow the interface contract or not. If you don't feel comforible doing this. Make your data class implements two different interface- the interface given to you, and your own interface.
SCJP 1.4, SCJD
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |