Introduction to 492 and Decoupling
Reporter
around could be a
pain. public class StaticReporter { static Reporter r; static void setReporter (Reporter r){ this.r =r; } static void report (String msg){ r.report (msg); } }
//at the start of the program StaticReporter.setReporter (new StandardOutReporter ()); //later on... void download (...){ StaticReporter.report ( Starting downloading ); ....};
34 of 34