What are the best practice design patterns/architectures for vector graphic applications like PowerPoint or Illustrator? Specifically for structuring tool-user interaction and action on complex graphical objects (parent-child relationship, geometrical constraints on shape and layout).
Any thoughts about or experiences with the following:
Behavior - Adorner - Behavior Stack/Service - View - View Model Microsoft
EditPolicy - EditPart - View - Model GEF
Vector artwork is art that's made up of vector graphics. These graphics are points, lines, curves and shapes that are based on mathematical formulas. When you scale a vector image file, it isn't low resolution and there's no loss of quality, so it can be sized to however large or small you need it to be.
Adobe CC is the industry standard and it's also what I recommend using. Adobe Illustrator is perfect for surface pattern design and it comes with many tools that will help you make beautiful patterns. You can also use Photoshop for pattern design. I love using it with watercolors.
The Singleton Design Pattern is a Creational pattern, whose objective is to create only one instance of a class and to provide only one global access point to that object. One commonly used example of such a class in Java is Calendar, where you cannot make an instance of that class.
Nested finite state machines for controllers. Separation of view from controllers (MVC or similar). It always worked for me.
Update: I had some time to read up on your links. Some background: I have been studying and working on these types of editors for 25 years. My advice, nested FSMs as controllers, MVC or similar, might be called a super design pattern, because you can see these design components appearing many times over the years, in different designs, each time using different names for the different components. The absurdity of the Microsoft patent is that the ideas are very old, just given new names. If you look at the other link you provided, you can see there are a lot of similarities (EditPart == Behavior == Finite State Machine).
So the super pattern is as follows: nested finite state machines, as in a Harel state chart. Super states handle common behaviors across many sub states; sub states handle more specific behaviors. A super state can be implemented as a super class, or as a separate object instance. In either case, in the overall application, abstractly you have a current state, which is the sub state. If the sub state cannot handle an input message, it goes to the super state (either just using inheritance or by passing the message to another object in a stack).
State transitions are triggered by input messages. An input message might be a user action on an adornment (and an adornment might be decorated the name of a sub state to invoke). Or it might be a keyboard event. You may see an input message called a command.
Every state will have an entry method, whereby it performs initialization, and an exit method, whereby it reverses any changes not committed. Changes are typically committed using transactions, and a stack of committed transactions forms the undo stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With