31. Example of Control Coupling public routineX(String command) { if (command.equals("drawCircle") { drawCircle(); } else { drawRectangle(); } } Object-Oriented Software Engineering (www.lloseng.com)
32.
33. Example of Stamp Coupling public class Emailer { public void sendEmail(Employee e, String text) {...} ... } public class Emailer { public void sendEmail(String name, String email, String text) {...} ... } Using simple data types to avoid it: Object-Oriented Software Engineering (www.lloseng.com)
34. Example of Stamp Coupling public interface Addressee { public abstract String getName(); public abstract String getEmail(); } public class Employee implements Addressee {…} public class Emailer { public void sendEmail(Addressee e, String text) {...} ... } Using an interface to avoid it: Object-Oriented Software Engineering (www.lloseng.com)
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
Hinweis der Redaktion
Pfleeger, 2nd Ed p 159 -161
Good & Bad (Sommervile, 5th Ed p 226 Rapid Development, p 143 Code Complete, p 35 )