Half Object plus Protocol

Introduction

The client and server code given so far is very procedural. In fact, the best way to express the server is as a finite-state machine, and this works well for the client too.

A finite-state machine isn't an O/O representation. How does this fit in with O/O design representations such as UML? It doesn't. So if you want to use UML, you have to hide the finite-state machine.

Standalone FTP application

A simple UML diagram for a standalone FTP application could be

Half Object plus Protocol (HOPP)

To change this to a client/server system, the FTP object needs to be split in two: one half in the client address space, the other half in the server address space. The two half-objects will communicate using a private protocol that is unknown to the rest of the application.

The private protocol will here be "message passing using sockets". Other implementations may use CORBA, RMI, JXTA, etc. This allows the implementation of the HOPP objects to be changed without affecting the rest of the application.

HOPP FTP Server

The server from the lecture on protocols nearly fits this design pattern. The changes are

The server classes are

HOPP FTP Client

The client in the lecture on protocols does not fit this design pattern and does need to be changed. It mixed up UI and protocol calls, and these should be separated.

A revised client, made up of FileTransferClientHOPP and FileTransferClientUI follow. Points to look out for

The client HOPP is

The Client UI is




IP Address

Changing protocols


Jan Newmarch (http://jan.newmarch.name)
jan@newmarch.name
Last modified: Fri Aug 19 11:10:41 EST 2005
Copyright ©Jan Newmarch