let’s get ready · other recommendations for getting ready for drupal 9 what the talk is about....

27

Upload: others

Post on 06-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes
Page 2: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

Let’s get ready

alexpott

Drupal 9 is coming

Page 3: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

ABOUT ME➤ Contributing to Drupal for >9 years ➤ Drupal 8 core-committer ➤ Testing subsystem maintainer

➤ Consulting at Acro Media and Thunder ➤ alexpott on the internet

Page 4: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

➤ When Drupal 9 will be released ➤ Technical debt ➤ Using Drupal’s deprecation policy

➤ Detecting deprecations ➤ How to deprecate code ➤ Other recommendations for getting ready for Drupal 9

WHAT THE TALK IS ABOUT

Page 5: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021

Page 6: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

TECHNICAL DEBT

➤ When software changes you accumulate technical debt ➤ Drupal 8 made a lot of changes very fast. ➤ Therefore introduced a lot of technical debt

Page 7: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

“Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite…

Ward Cunningham, 1992

Page 8: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

“The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still

Ward Cunningham, 1992

Page 9: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

DRUPAL’S DEPRECATION POLICY

➤ Deprecated code must trigger a silenced E_USER_DEPRECATION error.

➤ Deprecated functions and methods must have an @deprecated PHPdoc tag

➤ Deprecations must have a change record

➤ Deprecated code should not be used during regular runtime

➤ All code deprecated will be removed in Drupal 9

Page 10: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes
Page 11: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

DETECTING DEPRECATIONS

Page 12: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes
Page 13: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

➤ IDE support. For example, PHPStorm will cross out any usage of deprecated code.

➤ Static analysis tools like @mglaman’s drupal-check

➤ Future support in the Devel module via the Symfony debug toolbar

➤ Using Symfony’s PHPUnit Bridge during automated testing

DETECTING DEPRECATIONS

Page 14: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes
Page 15: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

LIVE CODING

Page 16: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

➤ Add @deprecation PHPdoc tag - the format of this is about to change - https://www.drupal.org/project/coding_standards/issues/3024461

➤ Add @trigger_error ➤ Use @group legacy

➤ Use @expectedDeprecation ➤ Straight replacement is not always the way to go

LIVE CODING SUMMARY

Page 17: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

ADVANCED CASES

➤ Dynamic deprecation messages can use the ExpectedDeprecationTrait to make testing easier

➤ Method parameters, return values, Drupal hooks, code paths and plugins all have special forms of deprecation

➤ For more see https://www.drupal.org/core/deprecation

Page 18: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

CONTRIBUTED/CUSTOM MODULES AND YOUR CODEBASE➤ Use @mglaman’s drupal-check

➤ Using @trigger_error testing is tricky at the moment

➤ Run tests locally or your own CI

➤ Target the minimum version of Drupal core you want to support.

➤ Deprecation testing can be disabled

➤ Run-tests.sh: —suppress-deprecations

➤ Env var: SYMFONY_DEPRECATIONS_HELPER

➤ See https://www.drupal.org/node/3002148

➤ See https://github.com/mglaman/drupal-check/wiki/Drupal-9-Readiness

Page 19: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

OTHER RECOMMENDATIONS

➤ Test against multiple PHP versions ➤ (Once it is possible) Test against multiple dependency

versions ➤ Create Drupal 8 migration sources and destinations

➤ Try not to mix refactoring with functional change ➤ Be very very careful with sub-classes and overriding

constructors

Page 20: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes
Page 21: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

Inspired by @larowlan and @drunken_monkey

Page 22: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

➤ Drupal 9 will be released in 2020 ➤ Use Drupal’s deprecation policy to deprecate code ➤ Test for deprecate code usage

➤ Jump in and help core and contrib to get ready ➤ https://www.drupal.org/project/drupal/issues/2959269 ➤ https://www.drupal.org/project/issues/search?

issue_tags_op=all+of&issue_tags=Drupal+9+compatibility

➤ #d9readiness in slack

IN SUMMARY

Page 23: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

THANKS

➤ Symfony for the idea of using @trigger_error() and PHPUnit Bridge component

➤ DrupalCI maintainers @mixlogic and @mile23 ➤ @mglaman for drupal-check

➤ @Gábor Hojtsy for all Drupal 9 readiness coordination work

➤ The many contributors ➤ Dries Buytaert for the Drupal release date images

Page 24: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

Sorry for all the 8.6.x releases

Page 25: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

Thank you

Page 26: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

Join us forcontribution opportunities

Friday, April 12, 2019

Mentored Contributions

9:00-18:00Room: 602

First Time Contributor Workshop

GeneralContributions

9:00-12:00Room: 606

9:00-18:00Room: 6A

#DrupalContributions

Page 27: Let’s get ready · Other recommendations for getting ready for Drupal 9 WHAT THE TALK IS ABOUT. DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021. TECHNICAL DEBT When software changes

What did you think?

Locate this session at the DrupalCon Seattle website:https://events.drupal.org/seattle2019/sessions/drupal-9-coming-getting-your-code-ready

Take the Survey!https://www.surveymonkey.com/r/DrupalConSeattle