0

Take for example the Servlet Specification (version does not matter). It comes with a large PDF file describing the spec. Its API (the interfaces and classes) fall under the javax.servlet.* package structure, and we as programmers use these. For example when writing Servlets we frequently extends javax.servlet.http.HttpServlet.

My questions: the API classes and interfaces (javax.servlet.*) , are these "vendor specific" (implemented by each vendor of a servlet container) OR are these part of the specification itself (and thus just used by each servlet container vendor)?

Or, does the specification practically always come with a Reference Implementation (RI), wich is created by the spec members and free to use (and at some places -like method implementations in abstract classes- free to modify)?

1 Answers1

2

The packages are part of the specification and hence not vendor specific. The benefit of this is that you can write code that is implementation agnostic, i.e. it can be run in whatever container that implements the specification. If one implementation is buggy, you can move to a new one without any changes to your source code.

Have a look at this question.

Community
  • 1
  • 1
Janus Varmarken
  • 2,306
  • 3
  • 20
  • 42
  • Thanks. The question you refer to is related to mine. I have the same question, that is: does a specification mention the package names and Interfaces we as programmers can use, I mean: "The real API with it's JavaDoc" Of course a specification does not determine the implementation, but to be useable in code a coder needs concrete and complete Interface and Class names. – Stephan van Hoof Sep 03 '16 at 15:51
  • @StephanvanHoof I think Jörg W Mittag provides a very elaborate answer. A specification is what you want it to be. You choose if it is going to be very open-ended or very precise. In Java-land, a specification often includes package/interface/class names. – Janus Varmarken Sep 13 '16 at 00:02