Home Segments Top Top Previous Next

1021: Mainline

At the time that the RatingServer class is compiled, on the server computer, all that the compiler needs to know about the Movie class is that there are various methods with various signatures, and obtaining that knowledge requires access to only a modified version of the MovieInterface defined in Segment 765.

The modification specifies that implementers, such as the Movie class, are serializable, as explained in Chapter 34. The reason for introducing serializability is that the server needs access to the actual compiled definitions of Movie methods, at run time, rather than to just definition signatures, because the RatingServer method, serverRating, calls Movie methods. To enable that access, the compiled Movie class is shipped off to the server, from the client, at run time, in serialized form, and we say that the client and server, at this point, are tightly coupled.

import java.io.*;
public interface MovieInterface extends Serializable {  
 // Setters 
 public abstract void setScript (int i) ; 
 public abstract void setActing (int i) ; 
 public abstract void setDirection (int i) ; 
 // Getters 
 public abstract int getScript () ; 
 public abstract int getActing () ; 
 public abstract int getDirection () ; 
 public abstract String getTitle () ; 
 public abstract String getPoster () ; 
 // Miscellaneous methods 
 public abstract int rating () ; 
 public abstract void changed () ; 
}