Slide 23
Slide 23 text
public class EmailMessage {
private String sendTo;
private String subject;
private String message;
private String username;
public EmailMessage(String to, String sbj, String m) {
this.sendTo = to;
this.subject = sbj;
this.message = m;
}
public void sendMessage() {
// send message using sendTo, subject, message
}
public void authenticate(String username, String pass) {
this.username = username;
// code to login
}
}
A cohesive module performs
a single task within a
so!ware procedure, requiring
li#le interaction with the
procedures being performed
in other parts of the program
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
example of
low cohesion