The HotCiv GUI Instantiating the MiniDraw Framework.

Slides:



Advertisements
Similar presentations
Chapter 13 Application Framework. Outline Definition & anatomy Fulfilling the framework contract Building frameworks Examples.
Advertisements

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Week 8, Class 3: Model-View-Controller Model-View-Controller Why? What? How? Example: Barnyard Simon for the Web Question: Where should we use the command.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
GUIs Part 4 CS221 – 4/17/09. Professional Assignments Assignment #2 – Download and install Visual Studio 2008 Professional Trial Software –
R-Mancala Srinivas Krishnan & Kiranjit Sidhu. Outline Design Details Refactoring Experience Demo.
EXtreme.NET Dr. Neil Roodyn. eXtreme.NET Who is Dr. Neil? MISSION: To increase the value of your Software Business Working with software for way too long.
Graphical User Interface (GUI) Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
DAIMIHenrik Bærbak Christensen1 Mandatory Project Part II Software Reliability and Testing.
DAIMI(c) Henrik Bærbak Christensen1 JUnit A tool for test case management.
CS6320 – MVC L. Grewe THE ISSUE: Separating Implementation from Interface The business logic stays the same regardless of what the presentation is The.
PolymorphismCS-2303, C-Term Polymorphism Hugh C. Lauer Adjunct Professor (Slides include materials from The C Programming Language, 2 nd edition,
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
MVC and MVP. References enter.html enter.html
Workflow and SharePoint Presented by Ben Geers. Overview What is workflow? Windows Workflow Foundation How does workflow apply to SharePoint? WSS v3 vs.
Macros n Macros are little programs that you can create to automate particular tasks that you may want to execute more easily than having to specify all.
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Event Driven Programming
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Luminance.  Major group refactoring.  Development Lead: Stephen Damm.  Project Manager: Martina Nagy.  Test team member: Chet Collins.  A lot of.
CS 350 – Software Design The Observer Pattern – Chapter 18 Let’s expand the case study to include new features: Sending a welcome letter to new customers.
Team Think For You. Outline  Introduction  Process  Requirements Engineering  Architecture  Detailed Design  Testing  Demo  Extensibility  Conclusions.
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
Controls and Events. The Next Step In the first module, we discussed general problem solving In this module, we’ll apply what we learned, from specification.
Henrik Bærbak Christensen1 Frameworks / Product Lines The frame for reuse.
CS 151: Object-Oriented Design October 15 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Test Stubs... getting the world under control. TDD of State Pattern To implement GammaTown requirements I CS, AUHenrik Bærbak Christensen2.
Exam 2 Review Software Engineering CS 561. Outline Requirements Development UML Class Diagrams Design Patterns Users, Usability, and User Interfaces Software.
HotCiv Project Starting up!. Henrik Bærbak Christensen2 HotCiv = Agile development Iterations of –product development –learning increments.
Deriving State…...and an example of combining behaviour.
Mandatory 1 / AlphaCiv … Traps to be aware of …. Warn or not? I once asked Kent Beck the following –I have a lot of students in a course in design patterns.
Applying the Principles Two Examples. Example 1 New Requirement It would be nice with a simple GUI “to see something” instead of just xUnit tests...
Refactoring and Integration Testing or Strategy, introduced reliably by TDD The power of automated tests.
MiniDraw Introducing a Framework... and a few patterns.
Mandatory 1 / AlphaCiv … a few comments…. Overall: Generally – good work – good effort Seems you are generally doing TDD Minor hick-ups –”My own way is.
Patterns are Roles What patterns are and what not…
CS, AUHenrik Bærbak Christensen1 Compositional Design Principles The “GoF” principles Or Principles of Flexible Design.
Mandatory 3 Test Stubs State Abstract Factory. Stubs, Spies, and Fake Objects One Example Making distribution testable... Henrik Bærbak Christensen2.
Observations Week 4. Observe Code Change! Review week plan! Also, a load generator is added to the exercises on Iteration 3 for ‘smoking out’ the exceptions.
Mandatory 3 Test Stubs State Abstract Factory. Do not panic! dSoftArk is about Good analyzable design not about HotCiv! Henrik Bærbak Christensen2.
Strategy in 15 minutes... derived from the principles.
12-Jun-16 Event loops. 2 Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output.
Prepared by: Dr. Abdallah Mohamed, AOU-KW Unit7: Event-driven programming 1.
Instantiating the MiniDraw Framework
Introducing a Framework ... and a few patterns
Reuse And Rapid Prototyping
Integration Testing.
Developer Testing Tricks
Applying the Principles
Goals Give student some idea what this class is about
Exam A few notes and hints….
HotCiv Project Starting up!.
Mandatory 1 / AlphaCiv … Traps to be aware of ….
Compositional Design Principles
The Object-Oriented Thought Process Chapter 08
CS102 – Bilkent University
Polymorphism Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
Event loops 17-Jan-19.
Week 6: Time and triggers!
Advanced ProgramMING Practices
Poul Henriksen Computing Laboratory University of Kent
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Presentation transcript:

The HotCiv GUI Instantiating the MiniDraw Framework

AUHenrik Bærbak Christensen2 [Demo]

The Framework iteration Learning Objectives: –Frameworks: Configure/specialize MiniDraw to support HotCiv GUI See MiniDraw as example of a framework See a lot of patterns in action –TDD and Stubs You will develop the GUI the TDD way –Keep focus & take small steps –No automated testing though... You will develop the GUI based only on stubs –Integration testing Last piece of the puzzle: Integrate into GUI SemiCiv AUHenrik Bærbak Christensen3

The Exercise Sequence Basically TDD iterations –36.37: Observer on Game –36.38: Create a new Drawing that responds to Game state changes using the observer Game → GUI integration [partially solved in CivDrawing!] –36.39: Create a Tool to move units GUI → Game integration –36.40 – 36.44: Create tools to do all the other stuff End of turn, change production, execute unit action,... i.e. Add features in fast focused iterations... AUHenrik Bærbak Christensen4

2014 Additions All boilerplate execution code is part of the provided zip AUHenrik Bærbak Christensen5

Example Test ‘EndOfTurnTool’ AUHenrik Bærbak Christensen6

Make the Tools Context Sensitive Limit the tool’s applicability to the rectangles that actually define what is being clicked –GfxConstants.java AUHenrik Bærbak Christensen7

Patterns for Integration

AUHenrik Bærbak Christensen9 The design Proper design pattern protocols –Facade pattern [GUI inform Domain] –Observer pattern [Domain inform GUI] –only rely on interfaces I can develop the GUI using Stub implementations of the Domain’s Facade and Observer roles –Facade = Interface Game –Observer = Interface GameListener –reuse MiniDraw’s graphical abilities let someone else do the dirty job...

AUHenrik Bærbak Christensen10 GUI Three layers Your production code hotciv.view: HotSpots for figures, tools, drawing and Drawingview etc MiniDraw CivDrawing

AUHenrik Bærbak Christensen11 Exercise: Compositional? How does this look, using a compositional approach? CivDrawing

Present code… AUHenrik Bærbak Christensen12

AUHenrik Bærbak Christensen13 Central Protocol The protocol between GUI and Domain: –GUI  Domain Facade pattern (Game interface) MVC + Adapter: A tool translates mouse clicks to proper method –UnitMoveTool: drag translates into ‘moveUnit’ –EndOfTurnTool: click translates into ‘endOfTurn’… –GUI  Domain Observer pattern (GameObserver interface) Drawing must react upon events from domain –worldChangedAt()

AUHenrik Bærbak Christensen14 Example: Moving Units Moving units means invoking game’s “moveUnit” The special dSoftArk provided code implements this boardIterator worldChangedAt Civ

AUHenrik Bærbak Christensen15 Example: Moving Units Facade Observer GUI  Domain  GUI worldChangedAt

Brute-force Brute redrawing Code View AUHenrik Bærbak Christensen16

AUHenrik Bærbak Christensen17 Testing without production code? The GUI can be completely developed without any real domain production code –no Alpha,..., Delta, nor SemiCiv Why? –Because I program to an interface! –Game g = new MyParticularStubForThisIteration(); –g.moveUnit(... ); –g.endOfTurn();

Example: Goal: Implement CivDrawing –Responsibility: –update graphics upon game state changes A testing tool to trigger game state changes AUHenrik Bærbak Christensen18

Demo: ant update AUHenrik Bærbak Christensen19

AUHenrik Bærbak Christensen20 Test Stubs Game implementation? –Complete façade, has not sub- objects –Units: only three –moveUnit: only moves red archer… Conclusion: simple code But –Sufficient for our sprint goal: to develop the CivDrawing that responds to unit moves, etc.

AUHenrik Bærbak Christensen21 Test Stubs Requirement: –Enough to test all GUI related behaviour –Example Must be able to GUI’s behaviour for illegal moves – therefore some moves must be invalid!

AUHenrik Bærbak Christensen22 What about TDD Can I develop the GUI by TDD? –Yes: Define a test first, like “MapView”: OneStepTest: draw the world… “TestModelUpdate”: see game state changes reflected... and then implement the proper MiniDraw role implementations that makes this happen! –No: I cannot make it automated as I have to visually inspect the result to verify behaviour but manual tests are better than no tests!!! especially when I refactored the damn thing to use MiniDraw instead of JHotDraw !!!