Make legacy great again! @ PHP Benelux 2017

Make legacy great again! @ PHP Benelux 2017

This talk was happening at PHP Benelux 2017!

Working with legacy code is one of more important skills for a developer. But it’s frightening, messy, hard to untangle and basically “magic” all around. Though it doesn’t have to be this way! Let me show you how to start loving legacy and apply some tricks to make it a much greater experience for you and your fellow developers. With this talk I want to share my knowledge on how to start dealing with legacy, how to break less things and be more confident in changing it, how to embrace and start enjoying your adventure with legacy, examples and tips/tricks on how to deal with day to day situations and how to apply modern day principles on legacy code.

This won’t be a silver bullet, but should put you on good track to start enjoying legacy code and reap nice fruits from it. This also won’t be a talk which spends more time explaining that principles and tests are good for you, I think we all know that and when hearing “legacy code” in the talk title developers expect more.. concrete and actionable help with their daily life.

77981e65e1b57e65e3d53f3eacb3e049?s=128

Donatas Aleksandravičius

January 27, 2017
Tweet

Transcript

  1. MAKE LEGACY GREAT AGAIN. It’ll be totally awesome. It’s the

    best. It’s true.
  2. DONATAS. Aleksandravičius

  3. None
  4. None
  5. AGENDA.

  6. NOT A SILVER BULLET.

  7. EVERYTHING. is legacy.

  8. DIVING INTO LEGACY.

  9. CODE FOR SILENT PSYCHOPATH WHO KNOWS WHERE YOU LIVE.

  10. S.O.L.I.D. LEGACY = GOOD LEGACY.

  11. LEGACY MAKES YOUR MONEY.

  12. OLDEST PIECE OF CODE. 2004. PHP4.

  13. WE ARE DETECTIVES.

  14. POKE IT.

  15. FIDDLE AROUND.

  16. TAME THE BEAST.

  17. ROUTING MESS.

  18. None
  19. UNDERSTANDING HOW LEGACY WORKS = PATH TO WIN.

  20. DELETE YOUR CODE.

  21. HALF A YEAR TO MAKE RATIONAL CHOICES.

  22. D-DAY - SO SMOOTH.

  23. 100% IS NEVER WORTH IT.

  24. WRITE NEW CODE. you must

  25. DON’T WRITE MORE LEGACY.

  26. SIMPLE START:
 PSR, S.O.L.I.D., TESTS AFTER.

  27. MIX OLD AND NEW, 
 SPREAD WIDELY.

  28. MAIN(), INIT(), LOAD(), __CALL().

  29. METHOD WITH INPUT/OUTPUT IS CLEAN AND TESTABLE CODE.

  30. TEMPLATES. BUSINESS LOGIC, DB CALLS, UNTESTED LOGIC.

  31. WHY REPEAT THE SAME MISTAKES?

  32. DON’T BREAK MORE WINDOWS.

  33. MINDSET IS HARDEST THING TO CHANGE.

  34. EMBRACE THE FAILURE.

  35. BAD LEGACY ALWAYS BREAKS.

  36. BETTER DETECTIVES CREATE LESS BROKEN BUILDS.

  37. SECRET INGREDIENT 1/2: 
 BREAK PRODUCTION.

  38. SECRET INGREDIENT 2/2: 
 LEARN FROM MISTAKES.

  39. THE WHEEL. Already invented.

  40. EVERYTHING IS CUSTOM IN LEGACY CODE.

  41. S.O.L.I.D. LEGACY = GOOD LEGACY.

  42. DO YOU CREATE NEW FUNCTIONALITY IN BAD LEGACY?

  43. STAND ON THE SHOULDERS OF GIANTS.

  44. FOCUS ON VALUE FOR THE CUSTOMERS.

  45. FOCUS ON BUSINESS PROBLEMS WHICH ARE NOT IN PACKAGIST.

  46. TOOLS. Automate all the things.

  47. AUTOMATIC REFACTORING WITH PHPSTORM.

  48. None
  49. • PHP_CodeSniffer • PHPMetrics • PHPMD • PHP Depend •

    https://github.com/exakat/php-static-analysis-tools • Php Inspections (EA Extended) for PhpStorm TOOLS.
  50. AWARENESS AND VISIBILITY HELPS TO IMPROVE.

  51. PREVENTING BAD LEGACY.

  52. WHAT IS THE MOST IMPORTANT SKILL FOR DEVELOPER?

  53. None
  54. REWIRING AND UNDERSTANDING.

  55. EXERCISE OF MIND, 
 NOT BODY.

  56. REFACTORING.

  57. None
  58. REFACTORING - IMPROVING CODE WITHOUT CHANGING BEHAVIOUR.

  59. REFACTORING - AN ART FORM.

  60. COMMUNICATION IS IMPORTANT.

  61. FAIL, READ, LEARN.
 RINSE AND REPEAT.

  62. HOW DID YOU IMPROVE CODE TODAY?

  63. THERE IS NO “I” IN THE TEAM.

  64. GRUMPY CATS. They’re always everywhere and grumpy

  65. DEVELOPERS WANT TO BUILD QUALITY CODE.

  66. YOU DECIDE YOUR LEGACY.

  67. CUSTOMERS DEPEND ON YOU.

  68. SHARE THE BENEFITS.
 VISUALISE THE PROBLEMS.

  69. GRUMPY = LOST OR DEFENSIVE.
 HELP THEM. 
 DON’T SCOLD.

  70. OUTRO. Yes, I’m finally shutting up.

  71. REFACTORING IS A BIG TOPIC.

  72. NOT A SILVER BULLET.

  73. SOURCES FOR INSPIRATION.

  74. I WANT YOU TO EMBRACE IT.

  75. SOFTWARE IS ALIVE.
 FOCUS ON TODAY.

  76. ITS YOUR LEGACY.

  77. THANK YOU. Questions? Feedback? Tweet @donis_plays https://joind.in/talk/2ff38 Contact donis@gildija.lt