dice.jsl
rollable.jsl
dicefactory.jsl
app.jsl 是客戶端(引用 dice.dll)。
骰子的“實際”表示對于客戶端而言不再是(而且也不需要是)“可見”的?蛻舳撕服務器之間的耦合被限制為 dicefactory.jsl 和接口 rollable.jsl。
我們已經將客戶端與服務器隔離!
清單 4.
// File: dice.jsl
// this represents a die
public class Dice implements Rollable
{
public Dice(int i)
{
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/