Refactoring in PHP While Going Open Source. A Case Study

32
© 2009 OXID eSales Refactoring in PHP While Going Open Source A Case Study .. OXID eSales AG Berlin, 26. June 2009 Erik Kort Chief Software Architect

description

When OXID eSales decided in early 2008 to open source its then 5 years old ecommerce system, they knew that it needed to be refactored before releasing it to the public. The reason being that only a refactored system would allow for shorter release cycles and attract new developers due to higher code quality.

Transcript of Refactoring in PHP While Going Open Source. A Case Study

Page 1: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Refactoring in PHP While Going Open Source

A Case Study ..

OXID eSales AGBerlin, 26. June 2009

Erik KortChief Software Architect

Page 2: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

OXID eSales AG

eCommerce Software… nothing else!

Located in Freiburg, Halle and Kaunas (Lithuania)

50+ employees… more than half PHP-Developers

Page 3: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

About Me

Key facts

OXID eSales AG Chief Software Architect

15+ Years of experience in Software Development

Wide field:

– from Petrochemical industries to eCommerce– From mobile devices to large servers

Passion: Architecture and Object Oriented Design

Page 4: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

OXID eShop 4 Open Source

what does this exactly mean?

OXID eShop Professional Edition is available also as OXID eShop Community Edition

Licensed under GPLv3

Page 5: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

The Past

Page 6: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Page 7: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Page 8: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Module snap in

Multiple inheritance possible

Best prepared for extension due to small and atomic functions

Prepared for multilanguage usage

eShop Extensions

ES

EN

DE

Page 9: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Connecting OXID eShop

Various connectors to ERP already exist

– Microsoft Dynamics NAV– Büroware– SAP– Generic SOAP interface– Generic CSV interface– and many more

Also connectors to various CRM systems exist

– Drupal– Typo3– and many more

350+ third party extensions in existence

Page 10: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Time to change

Page 11: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

XP – eXtreme Programming

Page 12: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

eXtreme Programming in OXID

Iteration length: 1 week

Only useful elements of XP are taken (e.g. pair programming only if needed/wanted)

Iteration planning at the beginning of each week

Change of plans possible every time – even late in development process

Monitoring release by using burndown charts

Team velocity is constant

Leads to predictable schedules

– Release dates are fixed in advance and kept

Page 13: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Doing the XP - Goals

Porting to PHP 5

Common code base

Significantly improve quality of source code

Remove „Big Ball of Mudd“ elements

Reduce release efforts

Automatic build system

Measure code quality (code metrics)

Page 14: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Tools

Page 15: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Risks …

Page 16: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Lessons learned

Page 17: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Psychology ! – „the Gap“

Page 18: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Narural Cleaner Architecture

Model-View-Controller pattern (MVC)

Page 19: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Results

Page 20: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Memory consumption CE/PE

Page 21: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Memory consumption EE

Page 22: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Response Time CE/PE

Page 23: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Load

Scales well under high load

Page 24: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Performance under load

Page 25: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Unit tests

Page 26: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Source Code dispersion

Page 27: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Code coverage

Page 28: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Cyclomatic Complexity

Page 29: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

If you are not developing with an agile methodology today, be warned.

It is not about deciding if you want it or not, only about when

Conclusion

Page 30: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Questions?

Page 31: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Press comments

„Der eShop überzeugt durch seinen schlanken Aufbau mit sehr guter Performance, ohne diese mit zu wenig Out-Of-The-Box-Funktionen oder mangelnder Erweiterbarkeit kompensieren zu müssen.“ t3n, 12/ 2008

Die Software überzeugt v.a. durch Usability auf Shop-nutzerseite.ix, 01/2009

„Der OXID eShop bringt von Haus aus alle für einen Online-Shop wichtigen Features mit: SEO URLs, Crossselling, Produktvarianten, beliebig verschachtelbare Kategorien, Mehrsprachigkeit, Web 2.0 Features etc.“„Wer ein flexibles Shop-System für höchste Ansprüche sucht, sollte sich den OXID eShop genauer ansehen.“PHP Journal 1/2009

Page 32: Refactoring in PHP While Going Open Source. A Case Study

© 2009 OXID eSales

Let‘s eCommerce…

Thank‘s for joining me!

Erik Kort ([email protected])

together!