What design pattern do you use to support graceful fallback on old platforms?
- by JoJo
Let's say I need to add a drop shadow behind a box. Some old platforms do not support drop shadows, so I have to fake it by putting an image behind the box. Here's the pseudo code of how I'm currently handling this fallback:
if (dropShadowsAreSupported) {
box.addDropShadow("black");
} else {
box.putImageBehindIt("gaussianBlur.png");
}
Is this the right way to handle it? It seems too amateur to me. Is there a better design pattern?