2 ms·
Indeed. It's a very common pattern to "has a" something that does some role, and then provide varying implementations. Image::PNG, Image::JPEG; Logger::File,
by jrockway 17y ago
Indeed. It's a very common pattern to "has a" something that does some role, and then provide varying implementations. Image::PNG, Image::JPEG; Logger::File, Logger::Syslog, Logger::Database, Logger::Email, etc.
This may give you millions of combinations, but since the various parts that don't need to interact can't interact, this isn't really a problem. OOP is nice when used by people that know OOP.