DEV Community

Discussion on: Casting stinks. Generic classes are worse.

Collapse
rrconstantin profile image
rrconstantin

That is exactly how I would approach the problem. This approach is a combination of SOLID principles (interface segregation and dependency inversion mostly) and Bridge pattern (decouple an abstraction from its implementation so that the two can vary independently). Also,

"if you have functionality that you're wrapping, that's fine too.",

we can use Template pattern here.