mardi 22 novembre 2016

Pattern like Bridge but can add primitive method?

Suppose two abstract class:

  Log:
   property:timestamp;
   property:message;

  LogFormatter:
   (String *)formatlog:(Log)log;

This look like a bridge, Log behave like Abstraction and LogFormatter like Implementor. In my opinion, bridge can't add primitive method to Implementor. But I want to dynamic add property to log in the future, and use a subclass of LogFormatter to format it. This will break Liskov Substitution principle.

Anyone has any suggestion?

Aucun commentaire:

Enregistrer un commentaire