Working with legacy code

Preview:

Citation preview

Working with legacy codeGUNNAR PEIPMAN, ASP.NET/IIS MVP

About me

Name: Gunnar Peipman

Job: Chief Everything Officer

Company: Peipman Consult Ltd

Hobbies: Coding, reading, travelling, beers

In family: boyfriend, step father and father

Animals: white fluffy bunny

Me & MS: ASP.NET/IIS MVP, blogger, speaker

Community: ENETA (www.eneta.ee)

http://weblogs.asp.net/gunnarpeipman/

E-mail: me@gunnarpeipman.com

Agenda

What is legacy code and where it comes from?

How to fight back?

Tools and techniques

Examples

Questions and answers

Essentials of legacy code

What is legacy code?

The code we already released to users

Code covered with no tests

Messy code

LEGACY CODE

messy

confusingbad dependencies

hard to read spaghetti

untestable

ugly

don‘t touch it

in production

undocumented

tricky

problematic

just works

Where legacy code comes from?

Death march projects Unskilled developers Impossible dead-lines Bleeding-edge technologies Complex technologies Silver-bullet tools Digital slavery

Dynamics of legacy code

All problems happen every day with small steps under our own eyes

War plan

How to fight back?

Write readable code

Write testable code

Refactor

Avoid hacks

Look how others have solved similar problems

Study different patterns

Improve your coding skills

If you find mess then clean it up

Process for single developers

Find mess

Investigate

RefactorRedesign

Validate

Process for teams

Code review

Detect problems

Agree on solutions

Redesign code

Validate

Winning the battle

Refactoring

Refactoring - making changes that doesn’t change code functionality

Different tools provided by IDE-s

Patterns

Design patterns

Unit testing patterns

Analysis patterns

Enterprise applications architecture patterns

Enterprise integration patterns

SOA patterns

Universal data models

Testing

Unit tests

Integration tests

Stress tests

Performance tests

User Interface tests

Database tests

Acceptance tests

Tracer bullet tests

Quality assurance

Automated and manual testing

Code reviews

Paired programming

Set up goals for developers

Examples

Thank you!

Q&A