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.

Slides:



Advertisements
Similar presentations
Problem Solving and Algorithm Design
Advertisements

November 1, 2004Introduction to Computer Security ©2004 Matt Bishop Slide #12-1 Chapter 12: Design Principles Overview Principles –Least Privilege –Fail-Safe.
What is Unit Testing? How TDD Works? Tsvyatko Konov Telerik Corporation
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
Test-Driven Development and Refactoring Project 3 Lecture 1 CPSC 315 – Programming Studio Fall 2009.
Bridge The decoupling of abstraction and implementation.
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.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Design Patterns: someone has already.
Prototype Creational Design Pattern By Brian Cavanaugh September 22, 2003 Software, Design and Documentation.
Red-Green-Refactor! EclipseCon 2008 Kevin P. Taylor, Nicolaus Malnick Test-Driven Development (TDD) for Eclipse RCP.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
Polymorphism, Inheritance Pt. 1 COMP 401, Fall 2014 Lecture 7 9/9/2014.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 1 Test-Driven Development An introduction for C# developers.
CSC 211 Introduction to Design Patterns. Intro to the course Syllabus About the textbook – Read the introduction and Chapter 1 Good attendance is the.
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
The Factory Patterns SE-2811 Dr. Mark L. Hornick 1.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Chapter 21 Test-Driven Development 1CS6359 Fall 2011 John Cole.
FacadeDesign Pattern Provide a unified interface to a set of interfaces in a subsystem. Defines a high level interface that makes the subsystem easier.
The HotCiv GUI Instantiating the MiniDraw Framework.
Refactoring - 1 CS494: Intro. to Refactoring Readings: –Refactoring for everyone: How and why to use Eclipse's automated refactoring features. By David.
Test Stubs... getting the world under control. TDD of State Pattern To implement GammaTown requirements I CS, AUHenrik Bærbak Christensen2.
Test Driven Development Daniel Brown dxb17u. Introduction Originates from Extreme Programming (XP) Proposed by Kent Beck in Test Driven Development.
CS 350 – Software Design Expanding Our Horizons – Chapter 8 The traditional view of objects is that they are data with methods. Sometimes objects could.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Henrik Bærbak Christensen1 Test Driven Development “TDD” Summary.
HotCiv Project Starting up!. Henrik Bærbak Christensen2 HotCiv = Agile development Iterations of –product development –learning increments.
AU CSHenrik Bærbak Christensen1 dSoftArk E2015 Software Architecture Programming in the Large.
June 1, 2004Computer Security: Art and Science © Matt Bishop Slide #13-1 Chapter 13: Design Principles Overview Principles –Least Privilege –Fail-Safe.
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Lecture Model View Controller s/w architecture AND general tips on structuring classes.
Outsourcing, subcontracting and COTS Tor Stålhane.
Hints - Mandatory 2 / Strategies. Learning... life-a-curve.html B Christensen2 Jeg fatter ikke.
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.
AU CSHenrik Bærbak Christensen1 dSoftArk Software Architecture Programming in the Large.
MiniDraw Introducing a Framework... and a few patterns.
Mandatory 2 / Strategies Note: I publish this presentation at the week plan for week 4.
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.
AU CSHenrik Bærbak Christensen1 dSoftArk E2014 Software Architecture Programming in the Large.
Safety methods within Agile and RUP methods TORGRIM LAURITSEN BUCS project.
Deriving Abstract Factory Loosening the coupling when creating objects...
Mandatory 3 Test Stubs State Abstract Factory. Stubs, Spies, and Fake Objects One Example Making distribution testable... Henrik Bærbak Christensen2.
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.
AU CSHenrik Bærbak Christensen1 dSoftArk E2013 Software Architecture Programming in the Large.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Instantiating the MiniDraw Framework
Introducing a Framework ... and a few patterns
Factory Patterns 1.
Applying the Principles
Behavioral Design Patterns
HotCiv Project Starting up!.
Mandatory 1 / AlphaCiv … Traps to be aware of ….
Recursive Thinking Chapter 9 introduces the technique of recursive programming. As you have seen, recursive programming involves spotting smaller occurrences.
Strategy Design Pattern
Recursive Thinking Chapter 9 introduces the technique of recursive programming. As you have seen, recursive programming involves spotting smaller occurrences.
Review of Previous Lesson
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Design Principles Thanks to Matt Bishop 2006 CS 395: Computer Security.
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Presentation transcript:

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. How can I best teach them the benefits? A) Give them a problem to solve, make them solve it, and then show a brilliantly simple solution using pattern X? B) Give them a problem and ask them to solve it using pattern X? Kent’s answer was:(To be given at lecture )

Doing TDD Evident Tests Exercise: What is focus here? –Test that everything works? Or –Drive production code into existence?

What is TDD??? Traditional tests = Quality Assurance Technique –Success: test cases that show absence of defects TDD tests = Implementation Technique –Success: test cases that drive implementation –Perhaps a few more to show absense of defects –Not a comprehensive quality assurance technique

An example Iteration 1: Fake it using anonymous tile class Iteration 2: Intro datastructure, intro StandardTile, fill all with plains Productioncode driver Reliability

Evident tests again Why do you not think all CityImpl are the same? –Just test the production code on one instance! Exercise:Is it OK to use CityImpl here –Answer: Yes indeed. Why?

Production and Test Code Separate test and production code as best possible! Morale: No test code in the production code Seen in GameImpl:

Misunderstood subclassing Class MountainTile implements Tile ? Why is the ratio liabilities/benefits so askewed that it is wrong to introduce MountainTile? Sorry, these are older slides. The getPosition() method was removed from the Tile interface in 2014.

When to use subclassing! Only use subclasses if you get a distinct behavioural advantage –Otherwise it is a lot of typing just to define some constant –Similar for units: cost, defense, attack,.... Parameterization is run-time changeable, cheap, easy to overview...

Regarding Units Unit types are behavioural distinct! So: SettlerUnit extends AbstractUnit Impl. Unit ? Polymorphic design and it will work –With some not-so-nice hacks ala How does a settler unit kill itself as part of its action? But the learning goal in dSoftArk is compositional design –Make a UnitImpl, and delegate actions to a Strategy! –See if you can get through... Tricky with Archers though

Keeping the facade Since I wrote the book I have become more strict in my understanding of mutation... Exercise: a)How is a city created? b)What happens when it does? b) How is production set? And how many ways can we set it? And how to ensure consistency?

Design Issues Read-only interfaces for City, Tile, Unit – Why? –Otherwise two ways of changing state in a game Through Game which will enforce consistency Through City which will NOT enforce consistency –If there are two ways Bjarne will use the wrong one! Morale: Only Game has mutator methods! But how to change state? –Only CityImpl has mutators; GameImpl only use CityImpl? –ModifiableCity interface; GameImpl only use that –GameImpl takes on all responsibility?

Sketches Knowing the Implementation type in Game Liabilities –Fails if we must allow external clients to configure our Game with new City implementations  Dependency injection and stuff... ()

Sketches Using an ”modifiable interface” Now the Game can get any class that implements ModifiableCity injected and handle it... ModifiableCity

My opinion It is fully OK for GameImpl to –Operate through CityImpl, UnitImpl, etc. –Do a cast ala (CityImpl) this.getCityAt(p) –Why: Because we are developing the internal production code The GUI guys only use Game interface The Domain guys (= us) use the internals

My opinion ”More beautiful” to use a ‘ModifiableCity’ interface? Simplicity: maximize work not done –We do not need it at the moment –It introduces more complexity –If need arise, easy to refactor CityImpl -> ModifiableCity

Easter Eggs ?

... And this What does this code do? War stories –Microsoft and easter eggs... –DSE and dead code springing to life...