I am designing an order system and the state design pattern seems appropriate because the order can change its state and thereby the allowed functionalities for the order. Below is my basic class diagram:
I do not like this approach because clients cannot see if a method is supported and violates Liskov principle. I created an alternative below:
I like this better but still the client has to check if a method is supported. But they can still call the unsupported method and get an exception. Does this still violates the Liskov principle?
Is there a better design that is in compliance with Liskov and keeps the user from calling invalid methods for a specific state?