8

Is it bad practice to name classes after the façade pattern?

public class OrderFacade {}
public class InvoiceFacade {}
public class ThingFacade {} ...

These classes do follow the Façade pattern.

3
  • Are these classes implementing the facade pattern?
    – Ixrec
    Apr 26, 2016 at 18:34
  • In some contexts it can make sense, in others not. Who knows your context if not you?
    – Doc Brown
    Apr 26, 2016 at 18:46
  • @Ixrec good question. Yes. Apr 26, 2016 at 19:04

1 Answer 1

16

I would name them based on what the facade does for consumers, or what it needs to "look like" to the outside world. The fact that it is a facade is an implementation-detail.

So instead of, say, BillingSystemFacade, I'd present it as a BillingService. Heck, perhaps someday I can get rid of whatever clunky API is behind it, and rewrite it from scratch, but the consumers don't need to know whether it is/isn't a facade, only what it promises to do for them.

2
  • 1
    Agree. Your consumers don't care whether it's a facade or not. Apr 26, 2016 at 18:58
  • I made an SDK, and some facades class to consume its functionality. For example ‘class ConvertorFacade’, and I provided its singleton instance that named convertor. So, consumer just have to use ‘sdk.convertor.bitmap2jpg’. Jun 10, 2022 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.