Information Hiding Example

Slides:



Advertisements
Similar presentations
NON - zero sum games.
Advertisements

30-Apr-15 Extreme Programming. 2 Software engineering methodologies A methodology is a formalized process or set of practices for creating software An.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Scientific Method What is the Scientific Method?
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
13-Jun-15 Extreme Programming. 2 Software engineering methodologies A methodology is a formalized process or set of practices for creating software An.
23-Jun-15 Unit Testing in Ruby. Programming methodologies The grim facts: The majority of large programming projects fail Projects that succeed are usually.
By: Taylor Helsper.  Introduction  Test Driven Development  JUnit  Testing Private Methods  TDD Example  Conclusion.
By: Taylor Helsper.  Introduction  Test Driven Development  JUnit  TDD Example  Conclusion.
By for Test Driven Development: Industry practice and teaching tool Robert Vanderwall, Ph.D. 1 WISTPC-15.
1 CSC 221: Computer Programming I Spring 2010 interaction & design  modular design: roulette game  constants, static fields  % operator, string equals.
Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/6/08.
28-Oct-15 Information Hiding A very short talk. Modularization Whenever a program is broken into two parts, there comes into being an interface between.
Updating Student Support Codes Before updating codes, please install the Student Support Template in Report Manager The complete list of Student Support.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
A little something to warm up. Using 2 cards, take any number of elements from each card and use these to create a new object or idea. Make it better.
CompSci 44.1 Game Package Introduction to Jam’s Video Game Package.
25-Feb-16 Extreme Programming. 2 Software engineering methodologies A methodology is a formalized process or set of practices for creating software An.
Unit Testing CLUE PLAYERS.  How much design do we do before we begin to code?  Waterfall: Design it all! (slight exaggeration… but not much)  Agile:
Hello, my name is Inigo Montoya Sophie Houlden. And I'm going to talk to you about...
PLUS.
You can do these things with Roku app. We no need to tell the amazing functionality and aspect of this streaming device but if you’re new to Roku then.
Investigation : Card games
Name 8/29/17.
PARKLANDS PRIMARY SCHOOL
Programming paradigms
Contacts: Intro to game programming in Java (with almost-drawingpanel)
User-Written Functions
Help Out with Maths in the Evening.
Everyone Can Win Game Directions
Exploring Computer Science Lesson 4-14
The Ethics of Video Games (and Computer Games)
Elements of Non-Fiction
Ms. Reed’s Health Class Routines
Information Hiding Example
Talk With An Astronaut Fifth Grade Unit 5 Week3.
Talk With An Astronaut Fifth Grade Unit 5 Week3.
Written Description of Algorithms
Prof. Todd Neller Gettysburg College
JUnit 28-Nov-18.
What I Learned from Teaching Online in Canvas
Test-driven development (TDD)
Extreme Programming 7-Dec-18.
ALCOHOL Learning objectives Learning outcomes
Decentralized Distributed Processing
Medications Utilities – Mass Void Medications
Test Driven Development
Topic 1: Problem Solving
Another Example Consider a very popular computer game played by millions of people all over the world. The average score of the game is known to be
Consulting 2.0.
Unit Testing in Ruby 22-Feb-19.
Franklin Township Elementary School Career Day: Computer Science
Communication.
The first number is posted telling what random number was selected, I did this for testing purposes, in the real thing it would not be there. Since the.
Computer games rely on game rules being written
Test Driven Development
Carmen Pasca and John Hey
Exploring Computer Science Lesson 4-14
A Thoughtful Expectation (OK, an educated guess….grrrr)
Remember – You MUST write in PARAGRAPHS
Everyone Can Win Game Directions
Talk With An Astronaut Fifth Grade Unit 5 Week 6.
Statistics and Probability-Part 6
Hint idea 2 Split into shorter tasks like this.
Helping Symmes/D’Arcy Partner #1 Recommend a great place for your partner to visit over Summer Break.
? ? What if? ? What if? ? ? What if? What if? ? ? ?
Calculate 81 ÷ 3 = 27 3 x 3 x 3 3 x 3 x 3 x 3 ÷ 3 = This could be written as
Views Base Relation View
Odds and Evens Here is a set of numbered balls used for a game:
Functions and Abstraction
Presentation transcript:

Information Hiding Example A very short talk 10-Apr-19

A reasonably good program void play() { setup(); player = who_goes_first(); do { if (player == HUMAN) { do { move = get_humans_move(); } while !legal(move); game_over = make_move(HUMAN, move); player = COMPUTER; } else { /* player == COMPUTER */ move = choose_computers_move(); game_over = make_move(COMPUTER, move); player = HUMAN; } } while(!game_over); }

A not-so-good program What routine or routines update player? Do they do it in such a way that the main program works? If the human's move is not ok, has player already been updated? How does make() know whose move to make? Who sets ok? When does the game end? Who's responsible for deciding this? Is movecounter being initialized properly? Computed properly? What is it anyway, and who uses it? void play() { setup(); player = who_goes_first(); do { if (player == HUMAN) { do { move = get_humans_move(); check_if_legal(move); movecounter++; } while(!ok); make_move(move); } else { /* player == COMPUTER */ move = choose_computers_move(); make_move(move); } } while (!game_over); }

Test-Driven Development (TDD) It is difficult to add JUnit tests to an existing program The program probably wasn’t written with testing in mind It’s actually better to write the tests before writing the code you want to test When tests are written first, you have a clearer idea what to do when you write the methods Because the tests are written first, the methods are necessarily written to be testable Writing tests first encourages you to write simpler, single-purpose methods Because the methods will be called from more than one environment (the “real” one, plus your test class), they tend to be more independent of the environment

The End