Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Coding Dojo: Data Munging (2016)

375 views

Published on

Coding Dojo with constraint Cyclomatic Complexity One, which is suited as exercise for functional programming with computational chains (aka streams).

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Coding Dojo: Data Munging (2016)

  1. 1. Coding Dojo: Data Munging (without control structures) Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  2. 2. Peter Kofler • Ph.D. (Appl. Math.) • Professional Software Developer for 15+ years • “fanatic about code quality” • Freelance Code Mentor PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  3. 3. I help development teams with PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY ● Professionalism ● Quality and Productivity ● Continuous Improvement
  4. 4. Mentoring PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY ● Pair Programming ● Programming Workshops ● Deliberate Practice, e.g. Coding Dojos
  5. 5. Developing Quality Software Developers
  6. 6. Dojo Structure ● Introduction 15' ● Coding 60' ● Retrospective 15' ● Break 15' ● Coding 60' ● Retrospective 15' PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  7. 7. 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
  8. 8. Coding Dojo Rules PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  9. 9. Pair Programming & TDD ● regular Pair Programming ● do not talk for too long ● do not interrupt the other ● no “keyboard hugging“ ● use TDD (or at least “sort of” TDD) ● write a test before you write code ● refactor mercilessly ● no debugger PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  10. 10. Constraints ● Challenges during a dojo or coderetreat ● Moving to the extreme is a way of learning ● Examples ● Missing Tool (No Mouse, …) ● Missing Feature (No IFs, …) PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  11. 11. Constraint: Complexity One PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  12. 12. Cyclomatic Complexity One ● No conditional statements (if, switch, ?:) ● No loops (for, while, loop, etc.) ● Technically no control structures. ● Use Optional or Maybe type. ● Use higher order functions like map, filter and reduce instead. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  13. 13. Assignment Part 1 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  14. 14. Weather “Data Munging“ ● weather.dat contains daily weather data for a month. ● Find the day number (column one) ● with the smallest temperature spread. (Max temperature is second column, min temperature is third column.) PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  15. 15. Prepare ● Find a pair. ● Choose a programming language. ● Set up the environment. ● Create new project. ● Add testing framework. ● Check part1/requirements.txt. ● Implement Data Munging. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  16. 16. Don't Focus on Getting it Done. F0cus on Doing It Perfectly.
  17. 17. →Practice
  18. 18. Assignment Part 2 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  19. 19. Soccer “Data Munging“ ● football.dat contains the results from the English Soccer League. ● The columns 'F' and 'A' contain the total number of goals scored for and against each team. ● Find the name of the team ● with the smallest difference in 'for' (F) and 'against' (A) goals. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  20. 20. →Practice
  21. 21. Assignment Part 3 PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  22. 22. DRY Fusion ● Take the two programs written, ● factor out as much common code as possible, ● leaving you with two smaller programs ● and some kind of shared functionality. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  23. 23. →Practice
  24. 24. 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
  25. 25. Peter Kofler @codecopkofler www.code-cop.org Kata by Dave Thomas @pragdave http://codekata.com/kata/kata04-data-munging/ PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
  26. 26. CC Images ● Bruce http://www.flickr.com/photos/sherpas428/4350620602/ ● pairing http://www.flickr.com/photos/dav/94735395/ ● agenda http://www.flickr.com/photos/24293932@N00/2752221871/ ● dojo http://www.flickr.com/photos/49715404@N00/3267627038/ ● rules http://www.flickr.com/photos/phunk/4188827473 x ● maze https://www.flickr.com/photos/cyberslayer/952953634 ● weather https://www.flickr.com/photos/enki22/8255595370/ ● stadium https://www.flickr.com/photos/113417287@N08/13994724156/ ● DRY https://www.flickr.com/photos/draconianrain/896834248/ ● wants you http://www.flickr.com/photos/shutter/105497713/ PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY

×