Coding Dojo: 
Bank OCR 
Austrian Institute of Technology 
September 2014 
Peter Kofler, ‘Code Cop’ 
@codecopkofler 
www.code-cop.org 
Copyright Peter Kofler, licensed under CC-BY.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Peter Kofler 
• Ph.D. (Appl. Math.) 
• Professional Software 
Developer for 15 years 
• “fanatic about code quality” 
• I help development teams
Coding Dojo? 
Expectations?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Coding Dojo Mindset 
● Safe place outside 
work 
● We are here to learn 
● Need to slow down 
● Focus on doing it right 
● Collaborative Game
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Dojo Structure 
● Introduction 15' 
● Coding 45' 
● Interim (Retrospective) 15' 
● Break 10' 
● Coding 45' 
● Retrospective 15'
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Assignment
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Bank OCR 
● You work for a bank, which has a machine to assist in 
reading letters. The machine scans the paper 
documents, and produces a file with a number of 
entries which each look like this: 
····_··_·····_··_··_··_··_· 
··|·_|·_||_||_·|_···||_||_| 
··||_··_|··|·_||_|··||_|·_| 
··························· 
● Each entry is 4 lines long, each line has 27 characters. 
The first 3 lines contain an account number written 
using pipes and underscores, and the fourth line 
is blank. Each account number should have 9 digits, 
all of which should be in the range 1-9.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Bank OCR 
● Write a program that can take this file 
and parse it into actual account 
numbers. 
● Find a pair. 
● Choose a programming language. 
● Set up the environment. 
● Start with creating a test.
Don't Focus on 
Getting it Done. 
F0cus on Doing 
It Perfectly.
→ Practice
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Bank OCR considerations 
● Which algorithm did you chose? 
● How readable are your test cases? (Can you 
look at them and easily see which digits are being parsed?) 
● How do you match digits? (Are you using low 
level Ifs or high level patterns to match?) 
● Functional or imperative? (Do you use 
iteration or recursion?) 
● What if the input changes? (What about the 
style of digits, number of digits, ...)
→ Practice
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Closing Circle 
● What did you learn today? 
● What surprised you today? 
● What will you do 
differently in the 
future?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
Peter Kofler 
@codecopkofler 
www.code-cop.org
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY 
CC Images 
● Bank https://www.flickr.com/photos/bigmacsc99/4325336251 
● Dojo 
http://www.flickr.com/photos/49715404@N00/3267627038/ 
● Todos 
http://www.flickr.com/photos/kylesteeddesign/3724074594/ 
● Wants you http://www.flickr.com/photos/shutter/105497713/

Coding Dojo: Bank OCR (2014)

  • 1.
    Coding Dojo: BankOCR Austrian Institute of Technology September 2014 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  • 2.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Peter Kofler • Ph.D. (Appl. Math.) • Professional Software Developer for 15 years • “fanatic about code quality” • I help development teams
  • 3.
  • 4.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Coding Dojo Mindset ● Safe place outside work ● We are here to learn ● Need to slow down ● Focus on doing it right ● Collaborative Game
  • 5.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Dojo Structure ● Introduction 15' ● Coding 45' ● Interim (Retrospective) 15' ● Break 10' ● Coding 45' ● Retrospective 15'
  • 6.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Assignment
  • 7.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Bank OCR ● You work for a bank, which has a machine to assist in reading letters. The machine scans the paper documents, and produces a file with a number of entries which each look like this: ····_··_·····_··_··_··_··_· ··|·_|·_||_||_·|_···||_||_| ··||_··_|··|·_||_|··||_|·_| ··························· ● Each entry is 4 lines long, each line has 27 characters. The first 3 lines contain an account number written using pipes and underscores, and the fourth line is blank. Each account number should have 9 digits, all of which should be in the range 1-9.
  • 8.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Bank OCR ● Write a program that can take this file and parse it into actual account numbers. ● Find a pair. ● Choose a programming language. ● Set up the environment. ● Start with creating a test.
  • 9.
    Don't Focus on Getting it Done. F0cus on Doing It Perfectly.
  • 10.
  • 11.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Bank OCR considerations ● Which algorithm did you chose? ● How readable are your test cases? (Can you look at them and easily see which digits are being parsed?) ● How do you match digits? (Are you using low level Ifs or high level patterns to match?) ● Functional or imperative? (Do you use iteration or recursion?) ● What if the input changes? (What about the style of digits, number of digits, ...)
  • 12.
  • 13.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Closing Circle ● What did you learn today? ● What surprised you today? ● What will you do differently in the future?
  • 14.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY Peter Kofler @codecopkofler www.code-cop.org
  • 15.
    PETER KOFLER, CODE-COP.ORGFANATIC ABOUT CODE QUALITY CC Images ● Bank https://www.flickr.com/photos/bigmacsc99/4325336251 ● Dojo http://www.flickr.com/photos/49715404@N00/3267627038/ ● Todos http://www.flickr.com/photos/kylesteeddesign/3724074594/ ● Wants you http://www.flickr.com/photos/shutter/105497713/