SlideShare a Scribd company logo
Put the Tests before the
Code: Coding the Right Way
Mike Clement
@mdclement
mike@softwareontheside.com
http://blog.softwareontheside.com
http://agilecodegames.com
REQUIREMENTS
You will need these files(Windows) to complete the assignment. Details for method constraints are found in these
documents and are still a part of the requirements. (If you downloaded the test driver documents before 8/30
12:00pm you will need to re-download them. An error was fixed.)
Part 1 - Construct the Arena (5 points)
Extend the ArenaInterface provided; the arena is simply a collection of fighters, each with a unique name
For Part 1 only, you may assume all strings passed to the arena's adding method will be of the correct format
For Part 1 only, you may assume all strings passed to the arena's getting and removing methods will be names
already existing in the arena
Part 2 - Let the Battle Begin (8 points)
Extend the FighterInterface provided; details about abilities, stats, and more can be found in the FighterInterface
For Part 3, the test driver will not call your useAbility() or regenerate() methods, so it is possible to receive credit for
Part 3 without these methods being complete
Completion of Part 1 is required to submit Part 2
Part 3 - Fortify the Walls (5 points)
Make adding new fighters to your arena bullet-proof
This involves rejecting any string that is not of the correct format or that would add a duplicate name to the arena
Make getting and removing existing fighters in your arena bullet-proof
Completion of Part 1 is required to submit Part 3
Part 4 - Let Me Show You My True Form... (12 points, 4 points per fighter type)
Add functionality to the useAbility() method and the regenerate() method for each fighter type
The isSimplified() method must return false for each fighter type to be tested to alert the test driver that full testing
should occur for that fighter type
Completion of Part 1 is required to submit Part 4
Clean Code that Works
Plan
Requirements
Design
Coding
Testing
Release
Design
Coding
Testing
Plan
Requirements
Design
Coding
Testing
Release
Design
Coding
Testing
When you actually sit
down to write some code,
you learn things that you
didn’t get from thinking
about them in modeling
terms…there is a feedback
process there that you can
only really get at from
executing some things and
seeing what works
- Martin Fowler
Sample Input
6
1 2
1 3
3 4
3 5
4 6
5 6
2 3
2 4
0 0
4
2 3
3 4
5 1
1 6
7 8
8 9
2 5
5 7
3 1
1 8
4 6
6 9
0 0
Sample Output
CASE 1:
1 2 3 4 6
1 2 3 5 6
1 2 4 3 5 6
1 2 4 6
1 3 2 4 6
1 3 4 6
1 3 5 6
There are 7 routes from the firestation to streetcorner 6.
CASE 2:
1 3 2 5 7 8 9 6 4
1 3 4
1 5 2 3 4
1 5 7 8 9 6 4
1 6 4
1 6 9 8 7 5 2 3 4
1 8 7 5 2 3 4
1 8 9 6 4
There are 8 routes from the firestation to streetcorner 4.
Unit tests
Fail
Pass
Is there more?
How do you know when you’re done?
Sample Input
6
1 2
1 3
3 4
3 5
4 6
5 6
2 3
2 4
0 0
4
2 3
3 4
5 1
1 6
7 8
8 9
2 5
5 7
3 1
1 8
4 6
6 9
0 0
Sample Output
CASE 1:
1 2 3 4 6
1 2 3 5 6
1 2 4 3 5 6
1 2 4 6
1 3 2 4 6
1 3 4 6
1 3 5 6
There are 7 routes from the firestation to streetcorner 6.
CASE 2:
1 3 2 5 7 8 9 6 4
1 3 4
1 5 2 3 4
1 5 7 8 9 6 4
1 6 4
1 6 9 8 7 5 2 3 4
1 8 7 5 2 3 4
1 8 9 6 4
There are 8 routes from the firestation to streetcorner 4.
Design Coding Testing
When you actually sit
down to write some code,
you learn things that you
didn’t get from thinking
about them in modeling
terms…there is a feedback
process there that you can
only really get at from
executing some things and
seeing what works
- Martin Fowler
Design Testing Coding
Testing Coding Design
Test Driven Development: By Example
•Write a failing test = Red
•Make the test pass = Green
•Refactor = Refactor
Red
Green
Refactor
Make the Test Pass?
Uncle Bob’s Three Laws of TDD
• You are not allowed to write any production code unless it is to make
a failing unit test pass.
• You are not allowed to write any more of a unit test than is sufficient
to fail; and compilation failures are failures.
• You are not allowed to write any more production code than is
sufficient to pass the one failing unit test.
Rule of
Perpetual
Inconsequence
FizzBuzz
•If multiple of 3, get “Fizz”
•If multiple of 5, get “Buzz”
•If not, return input int as string
•Rules are in order
Fizz Buzz!
Code!
Clean Code that Works
XP Simple Design
•Passes all tests
•Clear, expressive, consistent
•No duplication
•Minimal
Mike Clement
• @mdclement
• mike@softwareontheside.com
• http://blog.softwareontheside.com
• https://github.com/mdclement
• http://agilecodegames.com
• Greater Sum
• @thegreatersum
• http://www.greatersum.com
• Software Craftsmanship Atlanta
• Find us on meetup.com

More Related Content

What's hot

TDD with Ruby
TDD with RubyTDD with Ruby
TDD with Ruby
Ismael G Marín C
 
Unit testing
Unit testingUnit testing
Unit testing
princezzlove
 
TDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not ImplementationsTDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not Implementations
Harshith Shetty
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
Adam Culp
 
How Many Types of Software Testing Do You Know? Part I
How Many Types of Software Testing Do You Know? Part IHow Many Types of Software Testing Do You Know? Part I
How Many Types of Software Testing Do You Know? Part I
QATestLab
 
Practical unit testing in c & c++
Practical unit testing in c & c++Practical unit testing in c & c++
Practical unit testing in c & c++
Matt Hargett
 
Testing Philosphies
Testing PhilosphiesTesting Philosphies
Testing Philosphies
Rob Kaufman
 
Python Testing Fundamentals
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentals
cbcunc
 
Software quality with Code Contracts and PEX - CodeCamp16oct2010
Software quality with Code Contracts and PEX - CodeCamp16oct2010Software quality with Code Contracts and PEX - CodeCamp16oct2010
Software quality with Code Contracts and PEX - CodeCamp16oct2010Codecamp Romania
 
Test Automation
Test AutomationTest Automation
Test Automation
Rodrigo Paiva
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
Cory Foy
 
Verification and Validation in Manual Testing
Verification and Validation in Manual TestingVerification and Validation in Manual Testing
Verification and Validation in Manual Testing
Bollapalli Vasundhara
 
TDD - survival guide
TDD - survival guide TDD - survival guide
TDD - survival guide vitalipe
 
White box & Black box testing
White box & Black box testingWhite box & Black box testing
White box & Black box testing
NitishMhaske1
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
Shaun Abram
 
Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?Steven Mak
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
James York
 
Junit
JunitJunit
Code Review
Code ReviewCode Review
Code Review
Tu Hoang
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
Dror Helper
 

What's hot (20)

TDD with Ruby
TDD with RubyTDD with Ruby
TDD with Ruby
 
Unit testing
Unit testingUnit testing
Unit testing
 
TDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not ImplementationsTDD - Designing with Expectations, not Implementations
TDD - Designing with Expectations, not Implementations
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
How Many Types of Software Testing Do You Know? Part I
How Many Types of Software Testing Do You Know? Part IHow Many Types of Software Testing Do You Know? Part I
How Many Types of Software Testing Do You Know? Part I
 
Practical unit testing in c & c++
Practical unit testing in c & c++Practical unit testing in c & c++
Practical unit testing in c & c++
 
Testing Philosphies
Testing PhilosphiesTesting Philosphies
Testing Philosphies
 
Python Testing Fundamentals
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentals
 
Software quality with Code Contracts and PEX - CodeCamp16oct2010
Software quality with Code Contracts and PEX - CodeCamp16oct2010Software quality with Code Contracts and PEX - CodeCamp16oct2010
Software quality with Code Contracts and PEX - CodeCamp16oct2010
 
Test Automation
Test AutomationTest Automation
Test Automation
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
Verification and Validation in Manual Testing
Verification and Validation in Manual TestingVerification and Validation in Manual Testing
Verification and Validation in Manual Testing
 
TDD - survival guide
TDD - survival guide TDD - survival guide
TDD - survival guide
 
White box & Black box testing
White box & Black box testingWhite box & Black box testing
White box & Black box testing
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
 
Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
 
Junit
JunitJunit
Junit
 
Code Review
Code ReviewCode Review
Code Review
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 

Viewers also liked

Play to Learn: Agile Games with Cards and Dice
Play to Learn: Agile Games with Cards and DicePlay to Learn: Agile Games with Cards and Dice
Play to Learn: Agile Games with Cards and Dice
Mike Clement
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingMike Clement
 
Thinking in F#
Thinking in F#Thinking in F#
Thinking in F#
Mike Clement
 
Software Craftsmanship and Agile Code Games
Software Craftsmanship and Agile Code GamesSoftware Craftsmanship and Agile Code Games
Software Craftsmanship and Agile Code Games
Mike Clement
 
Power of Patterns: Refactoring to (or away from) Patterns
Power of Patterns: Refactoring to (or away from) PatternsPower of Patterns: Refactoring to (or away from) Patterns
Power of Patterns: Refactoring to (or away from) Patterns
Mike Clement
 
Transformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order MattersTransformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order Matters
Mike Clement
 
FizzBuzz Guided Kata
FizzBuzz Guided KataFizzBuzz Guided Kata
FizzBuzz Guided KataMike Clement
 
The Quest for Continuous Delivery at Pluralsight
The Quest for Continuous Delivery at PluralsightThe Quest for Continuous Delivery at Pluralsight
The Quest for Continuous Delivery at Pluralsight
Mike Clement
 
Mob Programming for Continuous Learning
Mob Programming for Continuous LearningMob Programming for Continuous Learning
Mob Programming for Continuous Learning
Mike Clement
 

Viewers also liked (9)

Play to Learn: Agile Games with Cards and Dice
Play to Learn: Agile Games with Cards and DicePlay to Learn: Agile Games with Cards and Dice
Play to Learn: Agile Games with Cards and Dice
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit Testing
 
Thinking in F#
Thinking in F#Thinking in F#
Thinking in F#
 
Software Craftsmanship and Agile Code Games
Software Craftsmanship and Agile Code GamesSoftware Craftsmanship and Agile Code Games
Software Craftsmanship and Agile Code Games
 
Power of Patterns: Refactoring to (or away from) Patterns
Power of Patterns: Refactoring to (or away from) PatternsPower of Patterns: Refactoring to (or away from) Patterns
Power of Patterns: Refactoring to (or away from) Patterns
 
Transformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order MattersTransformation Priority Premise: TDD Test Order Matters
Transformation Priority Premise: TDD Test Order Matters
 
FizzBuzz Guided Kata
FizzBuzz Guided KataFizzBuzz Guided Kata
FizzBuzz Guided Kata
 
The Quest for Continuous Delivery at Pluralsight
The Quest for Continuous Delivery at PluralsightThe Quest for Continuous Delivery at Pluralsight
The Quest for Continuous Delivery at Pluralsight
 
Mob Programming for Continuous Learning
Mob Programming for Continuous LearningMob Programming for Continuous Learning
Mob Programming for Continuous Learning
 

Similar to Put the Tests Before the Code

2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
Christian Hujer
 
Lessons learned on software testing automation
Lessons learned on software testing automationLessons learned on software testing automation
Lessons learned on software testing automation
gaoliang641
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
Attila Bertók
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
JWORKS powered by Ordina
 
Basics of Automation & Manual Software Testing
Basics of Automation & Manual Software TestingBasics of Automation & Manual Software Testing
Basics of Automation & Manual Software Testing
Gusani Tech Ideation
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Kumaresh Chandra Baruri
 
Istqb advanced practioner_level_practice_exam_1
Istqb advanced practioner_level_practice_exam_1Istqb advanced practioner_level_practice_exam_1
Istqb advanced practioner_level_practice_exam_1fkhry
 
Slides chapters 13-14
Slides chapters 13-14Slides chapters 13-14
Slides chapters 13-14
Priyanka Shetty
 
Test Script Sample- Spry Congressional Managment System
Test Script Sample- Spry Congressional Managment SystemTest Script Sample- Spry Congressional Managment System
Test Script Sample- Spry Congressional Managment SystemVictoria Conroy
 
10 Ways To Improve Your Code( Neal Ford)
10  Ways To  Improve  Your  Code( Neal  Ford)10  Ways To  Improve  Your  Code( Neal  Ford)
10 Ways To Improve Your Code( Neal Ford)guestebde
 
Continuous Testing in Vegas
Continuous Testing in VegasContinuous Testing in Vegas
Continuous Testing in Vegas
jaredrrichardson
 
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
TelecomValley
 
Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)
Peter Kofler
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
michael.labriola
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
Peter Kofler
 
Case Studies in Terrible Testing
Case Studies in Terrible TestingCase Studies in Terrible Testing
Case Studies in Terrible Testing
Todd Gardner
 
QA and scrum
QA and scrumQA and scrum
QA and scrum
clintonbosch
 

Similar to Put the Tests Before the Code (20)

2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
Lessons learned on software testing automation
Lessons learned on software testing automationLessons learned on software testing automation
Lessons learned on software testing automation
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
White box
White boxWhite box
White box
 
White box
White boxWhite box
White box
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
 
Basics of Automation & Manual Software Testing
Basics of Automation & Manual Software TestingBasics of Automation & Manual Software Testing
Basics of Automation & Manual Software Testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Istqb advanced practioner_level_practice_exam_1
Istqb advanced practioner_level_practice_exam_1Istqb advanced practioner_level_practice_exam_1
Istqb advanced practioner_level_practice_exam_1
 
Slides chapters 13-14
Slides chapters 13-14Slides chapters 13-14
Slides chapters 13-14
 
Test Script Sample- Spry Congressional Managment System
Test Script Sample- Spry Congressional Managment SystemTest Script Sample- Spry Congressional Managment System
Test Script Sample- Spry Congressional Managment System
 
10 Ways To Improve Your Code( Neal Ford)
10  Ways To  Improve  Your  Code( Neal  Ford)10  Ways To  Improve  Your  Code( Neal  Ford)
10 Ways To Improve Your Code( Neal Ford)
 
Continuous Testing in Vegas
Continuous Testing in VegasContinuous Testing in Vegas
Continuous Testing in Vegas
 
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
 
Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Case Studies in Terrible Testing
Case Studies in Terrible TestingCase Studies in Terrible Testing
Case Studies in Terrible Testing
 
QA and scrum
QA and scrumQA and scrum
QA and scrum
 

More from Mike Clement

Collaboration Principles from Mob Programming
Collaboration Principles from Mob ProgrammingCollaboration Principles from Mob Programming
Collaboration Principles from Mob Programming
Mike Clement
 
Focus on Flow: Lean Principles in Action
Focus on Flow: Lean Principles in ActionFocus on Flow: Lean Principles in Action
Focus on Flow: Lean Principles in Action
Mike Clement
 
Taming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touchTaming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touch
Mike Clement
 
Develop your sense of code smell
Develop your sense of code smellDevelop your sense of code smell
Develop your sense of code smell
Mike Clement
 
Maps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big PictureMaps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big Picture
Mike Clement
 
Escaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product DevelopmentEscaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product Development
Mike Clement
 
Code Katas Spring 2012
Code Katas Spring 2012Code Katas Spring 2012
Code Katas Spring 2012Mike Clement
 
Linq (from the inside)
Linq (from the inside)Linq (from the inside)
Linq (from the inside)
Mike Clement
 
Bowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedBowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedMike Clement
 
Code Katas: Practicing Your Craft
Code Katas: Practicing Your CraftCode Katas: Practicing Your Craft
Code Katas: Practicing Your Craft
Mike Clement
 
Software Craftsmanship
Software CraftsmanshipSoftware Craftsmanship
Software CraftsmanshipMike Clement
 

More from Mike Clement (11)

Collaboration Principles from Mob Programming
Collaboration Principles from Mob ProgrammingCollaboration Principles from Mob Programming
Collaboration Principles from Mob Programming
 
Focus on Flow: Lean Principles in Action
Focus on Flow: Lean Principles in ActionFocus on Flow: Lean Principles in Action
Focus on Flow: Lean Principles in Action
 
Taming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touchTaming scary production code that nobody wants to touch
Taming scary production code that nobody wants to touch
 
Develop your sense of code smell
Develop your sense of code smellDevelop your sense of code smell
Develop your sense of code smell
 
Maps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big PictureMaps over Backlogs: User Story Mapping to Share the Big Picture
Maps over Backlogs: User Story Mapping to Share the Big Picture
 
Escaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product DevelopmentEscaping the Pitfalls of Software Product Development
Escaping the Pitfalls of Software Product Development
 
Code Katas Spring 2012
Code Katas Spring 2012Code Katas Spring 2012
Code Katas Spring 2012
 
Linq (from the inside)
Linq (from the inside)Linq (from the inside)
Linq (from the inside)
 
Bowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedBowling Game Kata in C# Adapted
Bowling Game Kata in C# Adapted
 
Code Katas: Practicing Your Craft
Code Katas: Practicing Your CraftCode Katas: Practicing Your Craft
Code Katas: Practicing Your Craft
 
Software Craftsmanship
Software CraftsmanshipSoftware Craftsmanship
Software Craftsmanship
 

Recently uploaded

Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 

Recently uploaded (20)

Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 

Put the Tests Before the Code

  • 1. Put the Tests before the Code: Coding the Right Way Mike Clement @mdclement mike@softwareontheside.com http://blog.softwareontheside.com http://agilecodegames.com
  • 2. REQUIREMENTS You will need these files(Windows) to complete the assignment. Details for method constraints are found in these documents and are still a part of the requirements. (If you downloaded the test driver documents before 8/30 12:00pm you will need to re-download them. An error was fixed.) Part 1 - Construct the Arena (5 points) Extend the ArenaInterface provided; the arena is simply a collection of fighters, each with a unique name For Part 1 only, you may assume all strings passed to the arena's adding method will be of the correct format For Part 1 only, you may assume all strings passed to the arena's getting and removing methods will be names already existing in the arena Part 2 - Let the Battle Begin (8 points) Extend the FighterInterface provided; details about abilities, stats, and more can be found in the FighterInterface For Part 3, the test driver will not call your useAbility() or regenerate() methods, so it is possible to receive credit for Part 3 without these methods being complete Completion of Part 1 is required to submit Part 2 Part 3 - Fortify the Walls (5 points) Make adding new fighters to your arena bullet-proof This involves rejecting any string that is not of the correct format or that would add a duplicate name to the arena Make getting and removing existing fighters in your arena bullet-proof Completion of Part 1 is required to submit Part 3 Part 4 - Let Me Show You My True Form... (12 points, 4 points per fighter type) Add functionality to the useAbility() method and the regenerate() method for each fighter type The isSimplified() method must return false for each fighter type to be tested to alert the test driver that full testing should occur for that fighter type Completion of Part 1 is required to submit Part 4
  • 6.
  • 8.
  • 9.
  • 11. When you actually sit down to write some code, you learn things that you didn’t get from thinking about them in modeling terms…there is a feedback process there that you can only really get at from executing some things and seeing what works - Martin Fowler
  • 12. Sample Input 6 1 2 1 3 3 4 3 5 4 6 5 6 2 3 2 4 0 0 4 2 3 3 4 5 1 1 6 7 8 8 9 2 5 5 7 3 1 1 8 4 6 6 9 0 0 Sample Output CASE 1: 1 2 3 4 6 1 2 3 5 6 1 2 4 3 5 6 1 2 4 6 1 3 2 4 6 1 3 4 6 1 3 5 6 There are 7 routes from the firestation to streetcorner 6. CASE 2: 1 3 2 5 7 8 9 6 4 1 3 4 1 5 2 3 4 1 5 7 8 9 6 4 1 6 4 1 6 9 8 7 5 2 3 4 1 8 7 5 2 3 4 1 8 9 6 4 There are 8 routes from the firestation to streetcorner 4.
  • 15.
  • 16.
  • 17. Is there more? How do you know when you’re done?
  • 18. Sample Input 6 1 2 1 3 3 4 3 5 4 6 5 6 2 3 2 4 0 0 4 2 3 3 4 5 1 1 6 7 8 8 9 2 5 5 7 3 1 1 8 4 6 6 9 0 0 Sample Output CASE 1: 1 2 3 4 6 1 2 3 5 6 1 2 4 3 5 6 1 2 4 6 1 3 2 4 6 1 3 4 6 1 3 5 6 There are 7 routes from the firestation to streetcorner 6. CASE 2: 1 3 2 5 7 8 9 6 4 1 3 4 1 5 2 3 4 1 5 7 8 9 6 4 1 6 4 1 6 9 8 7 5 2 3 4 1 8 7 5 2 3 4 1 8 9 6 4 There are 8 routes from the firestation to streetcorner 4.
  • 20. When you actually sit down to write some code, you learn things that you didn’t get from thinking about them in modeling terms…there is a feedback process there that you can only really get at from executing some things and seeing what works - Martin Fowler
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. •Write a failing test = Red •Make the test pass = Green •Refactor = Refactor
  • 30. Make the Test Pass?
  • 31. Uncle Bob’s Three Laws of TDD • You are not allowed to write any production code unless it is to make a failing unit test pass. • You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures. • You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
  • 33.
  • 34. FizzBuzz •If multiple of 3, get “Fizz” •If multiple of 5, get “Buzz” •If not, return input int as string •Rules are in order
  • 37. XP Simple Design •Passes all tests •Clear, expressive, consistent •No duplication •Minimal
  • 38.
  • 39. Mike Clement • @mdclement • mike@softwareontheside.com • http://blog.softwareontheside.com • https://github.com/mdclement • http://agilecodegames.com • Greater Sum • @thegreatersum • http://www.greatersum.com • Software Craftsmanship Atlanta • Find us on meetup.com

Editor's Notes

  1. How do you get this? How do we know that it works?
  2. Old school software development lifecycle How I learned it in school
  3. In reality, when coding you’ll have to adjust the design and then in testing will need to “fix bugs” in the code.
  4. This Phased or Waterfall approach leads to silos “Independent QA”
  5. Old school software development lifecycle
  6. The problem with language and just talking about things is that it is imprecise
  7. Not mind readers – language is imperfect
  8. In reality, when coding you’ll have to adjust the design and then in testing will need to “fix bugs” in the code.
  9. ACM programming contest sample input and output These are test cases! Did I automate them? No, not usually, but I could do it pretty easily.
  10. automatically verifies a single behavior of a single object
  11. I could do most of my testing by pushing a button or running a script!
  12. ACM programming contest sample input and output These are test cases! Did I automate them? No, not usually, but I could do it pretty easily.
  13. Changes in the course of the Mississippi over time. How fast are your requirements, needs changing?
  14. Clean Code?
  15. “Working” is just the beginning