In class we have studied the concepts of binding, stubbing, and deferred development. Let's explore a bit more about these concepts.
public class PersistentThingServiceImpl extends RemoteServiceServlet implements PersistentThingService { static final long serialVersionUID=1; @Override public String getThing(); @Override public String setThing(String s); @Override public String clearThing(); }Give a reasonable set of stubs for this class, and explain why using these stubs as temporary definitions of the methods allows debugging other classes before writing this one.
public class PersistentThingServiceImpl extends RemoteServiceServlet implements PersistentThingService { static final long serialVersionUID=1; @Override public String getThing() { // TODO: write getThing() return "gotten"; } @Override public String setThing(String s) { // TODO: write setThing(String) return s; } @Override public String clearThing() { // TODO: write clearThing() return "cleared"; } }
The reason for wanting to represent a service by multiple names has several uses. First, one can write a service that in one module implements two kinds of service, by reacting to the name. This is done sometimes when the two kinds of service are interrelated.
A more subtle reason for wanting to be able to have a service by two names comes from wanting to change a name of a service while the service is running. If one makes it available by two names, and then replaces the references to the older name, one can then safely make it known only by the new name without even stopping the service!