18
Habits Breaking Bad Habits Series

Habits

Embed Size (px)

Citation preview

Page 1: Habits

HabitsBreaking Bad Habits Series

Page 2: Habits

IntroductionWe all fall into habits

Becomes easier to do something a certain way the more we do it

Can you identify your bad and good habits?

2

Page 3: Habits

“We are what we repeatedly do. Excellence, then, is not an act, but a habit.”

- Aristotle

By sticking to good habits and identifying our bad habits - we can become better developers

3

Habits

Page 4: Habits

So...uhmm...how?By identifying the triggers of bad habits

Identifying a bad habit is pretty easy!Identifying the triggers is trickier

We are not born with disciplineSome people will seem to have more willpower Really they have just developed good habits

4

Page 5: Habits

Gaining HabitsThis can take time and will be different for

everyoneThere is no immediate fix for gaining habits“...ranged from 18 to 254 days; indicating considerable

variation in how long it takes people to reach their…”

Lally, P. et al. (2010). How are habits formed: Modelling habit formation in the real world. European Journal of Social Psychology. 40 (6), p998-1009. http://onlinelibrary.wiley.com/doi/10.1002/ejsp.674/abstract

5

Page 6: Habits

Identifying TriggersIdentify the Cue

Let's consider writing a testWhat time is it? Who are you working with? Time?How are you feeling? What are you working on?What does the code look like in front of you?

Identify the RewardThink about the reward you get from writing tests

6

Page 7: Habits

The Habit Loop

7http://charlesduhigg.com/how-habits-work/

Page 8: Habits

Breaking HabitsVery difficult!

Easier if you can control your environment so that you can avoid your cue

Even with the right motivation it is toughPerhaps gaining new stronger habits is easier

8

Page 9: Habits

CravingsThere is one more important aspect to gaining

habitsAfter Identifying Cue and RewardsNeed to start craving the reward

If we can do this then it will become a habit

9

Page 10: Habits

The Habit Loop

10http://charlesduhigg.com/how-habits-work/

Page 11: Habits

Forming New Habits

11http://charlesduhigg.com/how-habits-work/

Page 12: Habits

Forming New HabitsUnfortunately there isn’t a magic formula

Habit change is different for each individual and for each habit

Each person is also driven by different cravings

12

Page 13: Habits

Forming New HabitsCharles Duhigg proposes a framework:

1.Identify the routine2.Experiment with the rewards3.Isolate the cue4.Have a plan

13

Page 14: Habits

Coding HabitsMost of us will write code a certain way out of

habitOften the way we learnt ‘how’ to codeThis can span from naming conventions to more

advanced principles and practices (i.e. SRP)

Can you identify any habits you have formed?

14

Page 15: Habits

Clean CodeElegant, Efficient, Maintainable, Structured

Causes of ‘dirty’ code:- Time Pressure, Lack of Training, Motivation

We should always strive to write Clean Code

15

Page 16: Habits

Habits and Clean CodeSo how can Habits help us write Clean Code?

Or improve other aspects of our day to day work?

16

Page 17: Habits

RecapFocus on good habits

Remembering to think back to today on how we can form these into good habits

Identifying Habits - Both good and bad!Working on good habits

17

Page 18: Habits

ReadingThe Power of Habit: Why We Do What We Do, and How to Change

Charles Duhigg (2013)Short web version: http://charlesduhigg.com/how-habits-work/

How long does it take to form a habit?UCL News (http://www.ucl.ac.uk/news/news-articles/0908/09080401)

18