33
XP?

xTreme Programming by Sejo Ćesić and Enis Zeherović

Embed Size (px)

DESCRIPTION

Introduction to eXtreme Programming (XP) with interactive and practical examples of one of its main practices: Test Driven Development (TDD). In the first part, we will lead you through the practices of XP and make you understand why XP has been revolutionary for the software development. After that, we will provide a more in-depth view of TDD. By sharing the best practices we will give you concrete guidelines on how to apply TDD on your projects. The session is expected to be highly interactive, you are all welcome to bring your own ideas, questions and suggestions.

Citation preview

Page 1: xTreme Programming by Sejo Ćesić and Enis Zeherović

XP?

Page 2: xTreme Programming by Sejo Ćesić and Enis Zeherović

eXtreme Programming

Sejo Ćesić[email protected]

be.linkedin.com/in/sejocesic/

Enis Zeherović[email protected]

ba.linkedin.com/in/eniszeherovic

Page 3: xTreme Programming by Sejo Ćesić and Enis Zeherović

eXtreme Programming

Formulated in 1999 by Kent Beck, Ward Cunningham and Ron Jeffries

AGILE software development methodology

Developed in reaction to high ceremony methodologies (e.g. Rational Unified Process - RUP)

Page 4: xTreme Programming by Sejo Ćesić and Enis Zeherović

XP Goal

Organize people

to produce

higher-quality software

more productively

Page 5: xTreme Programming by Sejo Ćesić and Enis Zeherović

XP Activities

Coding

Testing

Listening

Designing

Page 6: xTreme Programming by Sejo Ćesić and Enis Zeherović

XP Values

Communication

Simplicity (YAGNI)

Feedback

"Optimism is an occupational hazard of programming. Feedback is the treatment.“

Courage

refactor/remove code, be persistent

Respect

Page 7: xTreme Programming by Sejo Ćesić and Enis Zeherović

XP Practices

1. Pair programming

2. Planning game

3. Test driven development

4. Whole team - customer is in the team

5. Continuous process (integration, refactoring, small releases)

6. Shared understanding (coding, collective ownership, simple design)

7. Sustainable pace

Page 8: xTreme Programming by Sejo Ćesić and Enis Zeherović

Pair programming

Page 9: xTreme Programming by Sejo Ćesić and Enis Zeherović

Pair programming

Driver & Navigator metaphor improving:

- Economics

Errors avoided, zero cost to fix them later

- Design quality

Second opinion constantly questioning yours

- Satisfaction - Great confidence in code

- Learning - Constant exchange of knowledge

- Team building - Communication improves exponentially

Page 10: xTreme Programming by Sejo Ćesić and Enis Zeherović

Resistance to XP

2 programmers cost 2 times more than 1 programmer!

Place full of people never shutting their mouth will drive you insane!

When do I get to surf the web? Or chat online?

Page 11: xTreme Programming by Sejo Ćesić and Enis Zeherović

Resistance to XP (cont.)

Mistakes of a single person cost much much more!

Once you are working with your pair, you don't hear anyone else anymore.

In fact, smart manager knows:

No noise -> something is wrong!

Page 12: xTreme Programming by Sejo Ćesić and Enis Zeherović

Planning game

Page 13: xTreme Programming by Sejo Ćesić and Enis Zeherović

Planning game

Release plan

Iteration plan

Acceptance test

Stand Up Meeting

Pair Negotiation

Unit Test

Pair Programming

Page 14: xTreme Programming by Sejo Ćesić and Enis Zeherović

Planning game

Page 15: xTreme Programming by Sejo Ćesić and Enis Zeherović

Burndown and velocity

How much work is getting done on your project?

Burndown keeps track of iteration progres

Calculate velocity on the end of iteration

=(estimated hours - remaining hours) / nr. of

days

Page 16: xTreme Programming by Sejo Ćesić and Enis Zeherović

PG - Burndown and velocity

Page 17: xTreme Programming by Sejo Ćesić and Enis Zeherović

Test driven development

… will be presented soon

Page 18: xTreme Programming by Sejo Ćesić and Enis Zeherović

Whole team

Customer is “on site” and used for:

writing user stories

release and iteration planning

complete programming tasks

functional testing

Alternative: “proxy customer”

Page 19: xTreme Programming by Sejo Ćesić and Enis Zeherović

Continuous process

Continuous integration

Design improvement, refactorings

Small releases, shippable products, demonstration per iteration

Page 20: xTreme Programming by Sejo Ćesić and Enis Zeherović

Shared understanding

Coding standard

Collective code ownership

Simple design

System metaphor

Page 21: xTreme Programming by Sejo Ćesić and Enis Zeherović

Sustainable pace

Frequent code merge

&

always executable

&

test covered high quality code

---> fresh and alert minds

40 hours week

Page 22: xTreme Programming by Sejo Ćesić and Enis Zeherović
Page 23: xTreme Programming by Sejo Ćesić and Enis Zeherović

Test driven development

Page 24: xTreme Programming by Sejo Ćesić and Enis Zeherović

Test driven development

Add a test

Run all tests and see if the new one fails

Write some code

Run tests

Refactor code

Repeat

Page 25: xTreme Programming by Sejo Ćesić and Enis Zeherović

Test driven development

Page 26: xTreme Programming by Sejo Ćesić and Enis Zeherović

Test driven development

Apply F.I.R.S.T. properties of unit tests:

Fastmany hundreds or thousands per second

Isolatesfailure reason become obvious

Repeatablerun repeatedly in any order any time

Self-validatingno manual evaluation required

Timelywritten before the code

Page 27: xTreme Programming by Sejo Ćesić and Enis Zeherović

Test driven development

One assert per test

Descriptive names of tests

Test code is important as production code (maybe more)

Recognize test code as documentation you arealways missing

The quality of a test is how good it points you on the failure in your system if it fails

Page 28: xTreme Programming by Sejo Ćesić and Enis Zeherović

TDD - practical introduction

Two parts:

Java TDD Kata in Eclipse

User interface TDD testing

Page 29: xTreme Programming by Sejo Ćesić and Enis Zeherović

TDD Kata

String Calculator:

Set of requirements

Develop one task at a time

Test only positive cases

Page 30: xTreme Programming by Sejo Ćesić and Enis Zeherović

TDD Kata – String Calculator

Requirements:1. Empty string returns zero

2. String with single digit returns that digit

3. String with 2 digits separated with a ‘,‘ retuns sum of these 2 numbers ()

4. Unknown number of digits separated by ‘,‘ must be possible

5. A new line can be used as a separator

6. Custom delimiter must be supported (//[delimiter]\n[numbers])

Page 31: xTreme Programming by Sejo Ćesić and Enis Zeherović

User interface TDD testing

New page development in TDD

Tools: Eclipse, Selenium, TestNG

Free tool: testeditor.org

Page 32: xTreme Programming by Sejo Ćesić and Enis Zeherović

Q&A

Page 33: xTreme Programming by Sejo Ćesić and Enis Zeherović

THANK YOU