Timeline for Which design (pattern) would be suitable to abstract logging platforms?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 13, 2015 at 19:29 | comment | added | AK_ | @amon the Adapter pattern talks about adjusting one interface to suite another. Abstract factory talks about on interface, different implementations. this is much closer to Abstract factory. also you are probably going to need different factories to create the Logger (at least if you want to support various loggers), and then take the logger you created and inject it into the system (probably using DI). which means another factory for the DI.... | |
Feb 13, 2015 at 19:20 | comment | added | amon |
@AK_ We do have a factory here, but not every factory is an abstract factory. In an abstract factory, we have an interface for creating objects. Then, we have different concrete factory classes for different product families. But there are no abstract factories here, unless we introduce an ILoggerFactory and then concrete NLogAdapterFactory and Log4NetAdapterFactory classes … which is overkill, and doesn't solve the problem of injecting the dependency in the first place.
|
|
Feb 13, 2015 at 19:12 | comment | added | AK_ | This is much more similar to the Abstract Factory pattern... | |
Feb 13, 2015 at 19:02 | comment | added | t3chb0t | You're right. Now when I take another look a it the adapter pattern describes exacly what I'm trying to do. I thought so that there was something obvious that I missed. Thanks. | |
Feb 13, 2015 at 19:00 | vote | accept | t3chb0t | ||
Feb 13, 2015 at 18:55 | history | answered | amon | CC BY-SA 3.0 |