code retreat @agileworks bucharest 7 september 2013

Download Code retreat @AgileWorks Bucharest 7 September 2013

If you can't read please download the document

Upload: adi-bolboaca

Post on 16-Apr-2017

439 views

Category:

Technology


0 download

TRANSCRIPT

Bucharest, 7 September 2013

Code retreat

www.mozaicworks.com

www.mozaicworks.com

Me

Adi BolboacaOrganizational & TechnicalTrainer & Coach

Why?

Learn through pairingExtend your comfort zonePracticeExperimentLearn new practices

www.mozaicworks.com

How?

1 day of codingChoose a simple problem6 pairing partnersOn average 135 minutes of coding6 different constraintsA lot of fun!

www.mozaicworks.com

How it started

CodeMash conference 2009

Gary BernhardtPatrick WelshNayan HajratwalaCorey Haines

www.mozaicworks.com

How it started

RepeatableDay-long Practice the fundamentals of programmingIntense day of coding

www.mozaicworks.com

Day structure

15' introduction3 sessions of 45' coding + 15' retro&break1h lunch3 sessions of 45' coding + 15' retro&break15' closing circle

www.mozaicworks.com

Principles

Language agnosticDo not try to finish the problemDelete the code after each sessionFocus on practicingExperiment each sessionHave fun!

www.mozaicworks.com

Prerequisites

ComputerCoding environmentTesting frameworkSource control (git, svn, etc)

www.mozaicworks.com

The four elements of simple design

Passes its tests

Minimizes duplication

Maximizes clarity

Has fewer elements

www.mozaicworks.com

Poker

A deck of 52 cardsMinimum 2 playersA dealer handles the cardsCards are dealt clockwise around the poker tableEach player bets, adding it clockwise to the potPlayers can change cards, (see game variant)One player with the best cards wins all the potIf no player wins, we have a drawFor draw the winning players split the pot

www.mozaicworks.com

First session

Find a pairChoose a programming languageSetup the environmentChoose an entry point for the problemStart in 5 min

www.mozaicworks.com

Conway's game of life

A deck of 52 cardsMinimum 2 playersA dealer handles the cardsCards are dealt clockwise around the poker tableEach player bets, adding it clockwise to the potPlayers can change cards, (see game variant)One player with the best cards wins all the potIf no player wins, we have a drawFor draw the winning players split the pot

www.mozaicworks.com

Full Test Coverage

100% test coverage during the whole session

When test is below 100% the facilitator stops you from adding functionalities until the coverage is back at 100% All your tests must contain the assert

You need to install a code coverage tool

www.mozaicworks.com

Code retreat

1 hour Lunch

www.mozaicworks.com

Taking Baby Steps

Initialize source control repository

Start a timer for 2 minutes

Write exactly one test Timer rings, the test is red, then revert and go to 2)

The test is green before the timer rings, then commit

Restart timer

Refactor Timer rings, the refactoring is not complete then revert and restart

The refactoring is complete before the timer rings, commit and go to 2)

Obs.The timers must run continuously, don't stop to talk!

www.mozaicworks.com

Single Responsibility Principle

A method has more functionalities add all in the methods name with use or/and to separate them The method name has and/or then split the method No conditionals: if, switch, etc No try/catch Exactly one assert per test Test one behaviour per test

www.mozaicworks.com

No primitives

You have to encapsulate the:

ArraysOther data structures

IntegerStringBooleanOther primitives

www.mozaicworks.com

Focus on refactoring

Use naming that reveals intentRename concepts to improve naming (use domain language)Extract duplicate identical chunks of codeExtract methods having the same noun into their classSplit methods containing Or, And in their names

www.mozaicworks.com

Closing circle

How did you feel?

What did you learn today?

What will you do differently tomorrow?

www.mozaicworks.com

Code retreat

Why?

Learn through pairingExtend your comfort zonePracticeExperimentLearn new practices

www.mozaicworks.com

Contact me

Remote pair-programming

Unit testing workshop

Test driven development workshop

Clean code workshop

Refactoring workshop

Legacy code retreat

Working FAST and Safe with existing code

Code retreat

www.mozaicworks.com

Code retreat

Extend your mentoring & training capacityAccelerate learning through communities of practiceGrow your functional leaders and top talents

http://[email protected]@adibolb