Download Final Report - Chair of Software Engineering

Transcript
Programming principles
The set of deferred classes included in this cluster is designed according with
the following programming principles described in [21]:
• Uniform access principle: services of the classes can be access through
a uniform notation, which does not reveal whether they are implemented
through storage or through computation.
• Single choice principle: the only module who contains an exhaustive
list of all the subclasses of PART is VISITOR.
• Self-Documentation principle: Comments are provided to document
each feature and each class in order to make modules self-documented.
• Command-Query Separation principle
3.2
3.2.1
Protocol Cluster
Foreword
This cluster contains all classes which deal with protocols (“protocol handlers”).
In order to provide a simple and clean interface to the rest of the system we
divide the protocols handlers into two categories:
• Send protocols: protocols of this type are used to introduce e-mail messages into the mail delivery system
• Receive protocols: protocols of this type are used to retrieve e-mail
messages from the mail delivery system
To implement this division we provide two classes: SEND PROTOCOL and
RECEIVE PROTOCOL. Classes implementing send protocols, like SMTP, should
inherit from SEND PROTOCOL and receive protocols, like IMAP, should inherit
from RECEIVE PROTOCOL. This design choice guarantees extensibility: if a new
protocol appears it is possible to integrate it in the system by subtyping one of
this two class and implement the state machine which should deal with it.
The next two sections explain the interface of these two classes.
3.2.2
Sending Protocols
The interface of SEND PROTOCOL offers a few services to provide a simple interface
to introduce instances of class EMAIL MESSAGE into the mail delivery system.
These services are:
• set message takes as parameter the instance of EMAIL MESSAGE which
should be sent.
• send mail tries to send the message
27