• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javadoc for SUN interface

 
Axel Leucht
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got my SCJD assignment today and found that the interface given by SUN doesn't have any javadoc comments in it.

Am I supposed to change the interface appropriately or should I refrain from doing so?

I got the impression that the interface should be not changed. But is this also true (just) for javadoc comments?

Any opinions are appreciated.

/Axel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey my buddy, welcome to JavaRanch!

Take a look here. I think it might be helpful!
 
Balaji kkk
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we can't change the interface we should implement the all the method whatever in the interface..
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and from where did you get that impression? I'm even adding extra methods to the interface.

my instructions tell me:
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must
implement the following interface


IMHO nowhere is said that the interface should stay unchanged. it's only required to not change its name and it should be in the db-package and the implementor-class should be called Data.java
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well... it's true, it's never mentioned that we cannot alter the provided interface. But, if I make no mistake, I read another thread where someone emailed Sun (that is, who2contact@sun.com), asking about this, and the reply said that this is not allowed (I searched, but couldn't find this thread).
However, I found another very interesting thread about it: Interface provided by Sun.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it all depends in how they test the code for automatic failure.

a) if they just do test (Data instanceof SunsInterface) then you can alter your interface as you want because that test will always be true if data implements SunsInterface (which is a must), so no automatic failure

b) doing a) + some checks via reflection: number of methods, names, parameters, exceptions thrown --> each modification will result in automatic failure

c) if they put your Data-class + your interface in an existing app with a class like Data2 (also implementing the required interface) every modification (new method, different method signature,...) of the provided interface will result in not compiling of Data2 and thus in automatic failure



 
Axel Leucht
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for you're input, but...

What I understand from it, was:

Don't change the interface provided by SUN.
Put the javadoc comments in Data.java.

This is what I did, though my instructions clearly require to write javadoc style comments for each element of the public interface of each class. Which to be honest is vital with the central interface of the project, isn't it?

I do have
suncertify.db.DBAccess (SUN interface - no javadoc comments)
suncertify.db.Data (my implementation - with javadoc comments)

The generated javadoc looks weird to me as it only listens the signature of the methods in SUN's interface with no dpcumentation.

Is this what you suggested or did I miss anything?

 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can inherit the comments of Sun's interface by adding /** {@inheritDoc} */ on each method of the Data class. For instance:

/** {@inheritDoc} */
public int create(final String [] data) throws DuplicateKeyException { ... }
 
Axel Leucht
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you missed the point here.

I'm trying to evaluate whether I can add javadoc comments to the interface provided by SUN as there are only implementation comments in it but my instructions clearly states to write javadoc style comments for each element of the public interface of each class.

This requires me to change it, right?, though as many members here propose not to touch the interface at all.

What should I do?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Axel,

if you interprete that sentence very strict, then you don't have to add javadoc style comments to every interface you use, because you only must add it to "public interface of each class" and an interface is an interface, not a class

Kind regards
Roel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Axel Leucht wrote:I think you missed the point here.


Oh, sorry. Please try to be more clear next time.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I asked Sun a question on this and i'll share the answers with you.

The question:
The instructions tell me: "Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface" and then the interface.

Can you alter the given interface (change method signatures, add new methods, add javadoc to methods,...) or will this lead to automatic failure? Because nothing is said about this in the instructions. It's not a must to not change it, but (depending on the automatic failure tests used) altering the given interface could lead to automatic failure

Could you clarify on this please?


Their answer:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic