140 likes | 271 Vues
Discover how the Kinematic Simulator project utilizes various design patterns in Java for better object-oriented architecture. This project, led by Steve and Helena, emphasizes the Model-View-Controller (MVC) framework, improving data flow and allowing for the addition of new entities, physics models, and views. Learn about the implementation of Strategy and Observer patterns, as well as the Abstract Factory pattern for entity creation. Compare the old and new designs to see how larger classes and complexity were reduced for a more modular and extendable simulator. Play with the simulator at http://minutillo.com/steve/ks/.
E N D
Design Patterns in Java Kinematic Simulator
Kinematic Simulator • Hello, I’m Steve • Here’s our project
Kinematic Simulator • Hello, I’m Helena • Here’s our design
Patterns Used:Model View Controller SimulatorModel SimulatorViewer SimulatorController
Patterns Used:Strategy SimulatorController (Context) PhysicsStrategy (Abstract Strategy) NewtonianPhysicsStrategy (Concrete Strategy)
Patterns Used:Observer observes ViewerListener SimulatorController SimulatorViewer
Patterns Used:Abstract Factory EntityFactory (Abstract Factory) Entity (Abstract Product) Ball Factory (Concrete Factory) Ball (Concrete Product)
Comparison of Old vs. New • Old: • Works • Everything has reference to everything else • Only simulates Balls • Few, big classes • Physics hard to find • AWT
Comparison of Old vs. New • New • Works • MVC cleans up data flow • Can add new Entities! I want to add squares. • Can add new Physics! • Can add new Views! • Great! • It don’t mean a thing if it ain’t got that Swing • Faster!
Questions? You can play at http://minutillo.com/steve/ks/ Thanks!