16.1. The Context

Spam mail needs no introduction. Everyone has probably received some that has leaked through spam filters. This chapter's case study looks at a program designed to check for and trap incoming spam. Many programs receive mail and many programs analyze mail for spam. So why create another one? This design shows some alternative ways of assigning responsibilities in a system. It demonstrates the guidelines in a different context.

16.1.1. The Environment

Several processes are involved in email delivery. The user agent (e.g., Outlook, Eudora, etc.) interacts with the user to create messages and to display received messages. The user agent sends outgoing messages to a mail server. The mail server (SendingMailServer) transmits the messages to the receiving mail server (ReceivingMailServer). The receiving server queues the received mail for a particular user. The user agent for the recipient picks up the received mail and displays it to the user. Figure 16-1 shows the email delivery process.

Figure 16-1. Process of delivering email

Mail also can be transmitted by programs that send messages to a list of people (e.g., Mailman). These programs, often called list servers, typically send the messages to a SendingMailServer for delivery.

A spamming program acts as a SendingMailServer. It contacts ReceivingMailServers to deliver the spam to the end user. It is not easy ...

Get Prefactoring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.