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:

Slides:



Advertisements
Similar presentations
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Advertisements

Procedures in more detail. CMPE12cGabriel Hugh Elkaim 2 Why use procedures? –Code reuse –More readable code –Less code Microprocessors (and assembly languages)
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Database Systems A 1. 2  Project goal: to tackle and resolve real-life DB related development issues  So what do we need to do:  Design.
 Draft timetable has the same times as this semester: - ◦ Monday 9:00 am to 12:00 noon, 1:00 pm to 3:00 pm. ◦ Tuesday 9:00 am to 12:00 noon, 1:00 pm.
Chapter 10 THINKING IN OBJECTS 1 Object Oriented programming Instructor: Dr. Essam H. Houssein.
Topics in Programming Reactive Systems Prof. Ronen Brafman and Dr. Gera Weiss.
MN Space Grant Community College Quadcopter Competition General advice about giving the team oral presentation at the competition, from Professor.
What Happens Next? Financial Aid 101 Mila Tappan, FAME Outreach Representative October 10, 2008.
Lists Introduction to Computing Science and Programming I.
CS 106 Introduction to Computer Science I 12 / 04 / 2006 Instructor: Michael Eckmann.
Procedures in more detail. CMPE12cCyrus Bazeghi 2 Procedures Why use procedures? Reuse of code More readable Less code Microprocessors (and assembly languages)
Building Memory… Day 5 – November 27, Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the.
Alice Variables Pepper. Set to Java look Edit / preferences restart.
Lecture 5 of Computer Science II Arrays Instructor: Mr.Ahmed Al Astal.
Chapter 4 Sec. 4.1, 4.2, 4.4 Procedures (User-defined)
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
Tutorial -01. Objective In this session we will discuss about : 1.What is MVC? 2.Why MVC? 3.Advantages of MVC over ASP.NET 4.ASP.NET development models.
EVALUATION David Kauchak CS 451 – Fall Admin Assignment 3 - change constructor to take zero parameters - instead, in the train method, call getFeatureIndices()
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
(c) , University of Washington
Conditional & Joint Probability A brief digression back to joint probability: i.e. both events O and H occur Again, we can express joint probability in.
Cursor and Exception Handling By Nidhi Bhatnagar.
Database testing Prepared by Saurabh sinha. Database testing mainly focus on: Data integrity test Data integrity test Stored procedures test Stored procedures.
1 -Defined Functions 1. Goals of this Chapter 2. General Concept 3. Advantages 4. How it works Programmer.
Have a Customer Focus Understand the selling process and the importance of customer service.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
CSC 221: Computer Programming I Fall 2001  top-down design  approach to problem solving, program design  focus on tasks, subtasks, …  reference parameters.
Plan Design Analyze Develop Test Implement Maintain Systems Development Life Cycle MAT Dirtbikes.
Procedures and Functions Computing Module 1. What is modular programming? Most programs written for companies will have thousands of lines of code. Most.
Passing Other Objects Strings are called immutable which means that once a String object stores a value, it never changes –recall when we passed a message.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CIT 590 Intro to Programming Lecture 4. Agenda Doubts from HW1 and HW2 Main function Break, quit, exit Function argument names, scope What is modularity!
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Understanding Randomness.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
SE: CHAPTER 7 Writing The Program
Chapter 2 – Fundamental Simulation ConceptsSlide 1 of 46 Chapter 2 Fundamental Simulation Concepts.
10/18: Lecture topics Memory Hierarchy –Why it works: Locality –Levels in the hierarchy Cache access –Mapping strategies Cache performance Replacement.
1 Advanced Issues on Classes Part 3 Reference variables (Tapestry pp.581, Horton 176 – 178) Const-reference variables (Horton 176 – 178) object sharing:
Making Decisions uCode: October Review What are the differences between: o BlueJ o Java Computer objects represent some thing or idea in the real.
Recursion Review: A recursive function calls itself, but with a smaller problem – at least one of the parameters must decrease. The function uses the results.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
IUIE Admissions Reports Digging Deeper University Graduate School.
Exceptions, cont’d. Factory Design Pattern COMP 401 Fall 2014 Lecture 12 9/30/2014.
Test-Driven Development Eduard Miric ă. The problem.
Working With Objects Tonga Institute of Higher Education.
Ch. 17 – Probability Models (Day 1 – The Geometric Model) Part IV –Randomness and Probability.
1. FINISHING FUNCTIONS 2. INTRODUCING PLOTTING 1.
CPSC 252 Hashing Page 1 Hashing We have already seen that we can search for a key item in an array using either linear or binary search. It would be better.
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
CMSC 150 METHODS AND CLASSES CS 150: Wed 25 Jan 2012.
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
Unit Testing LEVEL GAME.  A student has pointed out that there’s a slight chance for our random tests to fail. RANDOMNESS probability our test will fail.
Physics 218 towards a set of guidelines. Why guidelines for 218 ?  This guidelines need to be created for several purposes: 1.to be as fair as possible.
Unit 4: Gathering Data LESSON 4-4 – EXPERIMENTAL STUDIES ESSENTIAL QUESTION: WHAT ARE GOOD WAYS AND POOR WAYS TO EXPERIMENT?
LLVM Simone Campanoni
CONDITIONALS CITS1001. Scope of this lecture if statements switch statements Source ppts: Objects First with Java - A Practical Introduction using BlueJ,
What is an object?. What Makes an Object? An object has identity (it acts as a single whole). Every object has a name that identifies what it is. Ex.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Lecture 8: Collections, Comparisons and Conversions. Svetla Boytcheva AUBG, Spring COS 240 Object-Oriented Languages.
Agility Video Good technique: Overall, it is visible the athlete already has quick feet and coordination- the technique just needs to be worked on. COM.
Andrew(amwallis) Classes!
Lecture 5 of Computer Science II
ENEE150 Discussion 02 Section 0101 Adam Wang.
Lecture 25 More Synchronized Data and Producer/Consumer Relationship
Decomposition.
CSE 143 Lecture 2 ArrayIntList, binary search
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
Presentation transcript:

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: Just enough  Why? We aren’t good at planning entire systems at once.  Is it possible to test without knowing the entire program structure?  Yes! But it can feel uncomfortable at first.  Benefit: it can make us produce code that is more modular, because we need to define/test individual pieces. TDD IS HARD! BUT GOOD…

Specification.  Computer needs to make a suggestion which includes a room, a weapon, and a person.  Do we need to know all the details of how the game operates? No, if we can define what this method must do, we can focus on that.  Room must match the location of the player. This method is ONLY concerned with making a suggestion… so we don’t care how the method is called. All we need to know is that the method will take a BoardCell location as a parameter, to enable us to get the room. EXAMPLE: MAKE SUGGESTION Advantage: May lead to more modular code – which is more testable and maintainable!

 Weapon must be selected. Should be randomly chosen from all weapons that are not in my hand (myCards) and have not previously been seen (seenCards).  Do we care how cards were dealt? No, this method assumes myCards is already set up.  Do we care when/how we “see” cards? No, this method assumes seenCards is already set up.  Similar considerations for Person MAKE SUGGESTION, CONT.

 Should we return the “suggestion” or store it?  It seems likely that we’ll want to return it, so that it can be “handled” – i.e., disproved  But it’s a quick/easy change between returning vs storing in an instance variable and providing a getter. So either option is valid for now. MAKE SUGGESTION, CONT.

 What if we decide later to pass the room as a String, rather than a BoardCell?  Takes about 2 minutes to update the test from something like:  makeSuggestion(board.getCellAt(5,7); to  makeSuggestion(“Kitchen”);  Then update the code  remove “lookup” of room  replace with parameter  Run the tests ONCE THEY PASS, TESTS SHOULD ALWAYS PASS