10.1. The Messenger

The messenger's user interface is shown in Figure 10.1. Three main components make up the interface: a login window, a main console, and one or more message windows. The login window (at the top right of Figure 10.1) appears when the application is first started and asks the user for a username and password. If the username and password are registered with the service, the user is logged in. If the password is incorrect, the user is prompted again. In the case where the user does not yet have an account, and a unique username was entered, then a new account is created automatically and the user is logged in.

Figure 10.1. The Messenger console, login window, and message window.


Once the user has successfully logged in, the main console is displayed (shown at the left of Figure 10.1). Near the bottom of the console, an “Add” button and a corresponding text field allow the user to enter usernames and add them to a list of friends. Whenever friends in this list sign into the service, their usernames appear in the “Online Friends” text area at the top of the console. When they log off by closing the application (or are disconnected by some form of partial failure), their names disappear from the list of online friends.

At any time the user can send a private message to a friend by clicking on a name in the list of friends; this causes a message window to open (see Figure 10.1). By typing a message and clicking on the “Send” button, the message is sent to the remote friend's messenger, where a message window will open on the screen. Likewise, if a message is received from a friend, a new window automatically appears (if one for that friend isn't already open). Each conversation with a friend gets its own message window.

When the user is finished using the messenger service, the user can close the main console. Any remote users monitoring that user will see the name disappear from their list of online friends.

From this description of the messenger, you'll notice that we have omitted several features that you would be likely to find in a full-fledged commercial version. For instance, we provide no way to conveniently manage your list of friends (you can add as many friends as you'd like, but you can't view the friends list or remove anyone from it). We skimp on such user features, because our main focus is on the distributed aspects of the application. As simple as it is, this messenger service presents many challenges to the distributed application designer, especially in the face of partial failure. As you will see, our primary concern is not usability, but designing a correct and robust distributed application.

Now that we have an overview of the messenger, we'll spend the rest of the chapter examining its design and implementation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset