5 § Design patterns are solutions to software design problems you find again and again in real-world application development. § Patterns are about reusable designs and interactions between objects. § The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns (Gamma, Helm, Johnson, and Vlissides). Definition
13 class Teacher { private String question; public String getQuestion() { return question; } public void createQuestion () { question = // AI to create a question here } } Teacher
18 class Teacher extends Observable { private String question; public String getQuestion() { return question; } public void createQuestion () { question = // AI to create a question here notifying(); } } Teacher as Observable
19 public class Main { public static void main(String[]a) { Teacher teacher = new Teacher(); Student s1 = new Student(); Student s2 = new Student(); teacher.addObserver(s1); teacher.addObserver(s2); // Teaching teacher.createQuestion(); // More Teaching teacher.createQuestion(); } } Main
Winter 2024 Copyright. These slides can only be used as study material for the class CSC 308 at Cal Poly. They cannot be distributed or used for another purpose.