Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Break Off SunPHP20

Omni Adams
February 07, 2020

Break Off SunPHP20

Most of the PHP that still exists today was written long ago by developers lost to the sands of time. It was written in an era where we didn't have the tools we do today such as Composer, type safety, unit testing, and code standards. Even code that was written recently frequently ignores best practices in order to "get things done". You've been tasked with maintaining a legacy application and would like to modernize it, but the powers that be won't let you rewrite it. This talk will discuss strategies for bringing ancient codebases into the modern age piece-by-piece.

Omni Adams

February 07, 2020
Tweet

More Decks by Omni Adams

Other Decks in Programming

Transcript

  1. Break Off A Piece of That Mono Omni Adams —

    When I Work — Sunshine PHP 2020 lith
  2. –DHH “You don’t want to hear that the reason your

    monolith is a spaghetti monster is because you let it become that way, one commit at the time, due to weak habits, pressurized deadlines, or simply sheer lack of competence.” https://m.signalvnoise.com/integrated-systems-for-integrated-programmers/
  3. PHPUnit 8.5.0 by Sebastian Bergmann and contributors. ............................................................... 63 /

    281 ( 22%) ............................................................... 126 / 281 ( 44%) ............................................................... 189 / 281 ( 67%) ............................................................... 252 / 281 ( 89%) ............................. 281 / 281 (100%) Time: 2.83 seconds, Memory: 24.00 MB OK (281 tests, 6 assertions) Code Coverage Report: Summary: Classes: 51.72% (15/29) Methods: 75.83% (91/120) Lines: 55.95% (941/1682)
  4. FILE: /home/omni/code/object/src/Nether/Object/Datastore.php --------------------------------------------------------------------------------------------------------- FOUND 891 ERRORS AND 2 WARNINGS AFFECTING

    569 LINES --------------------------------------------------------------------------------------------------------- 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n" 3 | ERROR | [x] Header blocks must be separated by a single blank line 4 | ERROR | [ ] Import statements must not begin with a leading backslash 4 | ERROR | [x] Header blocks must not contain blank lines 6 | ERROR | [ ] Import statements must not begin with a leading backslash 7 | ERROR | [ ] Import statements must not begin with a leading backslash 8 | ERROR | [ ] Import statements must not begin with a leading backslash 11 | ERROR | [x] The implements keyword must be on the same line as the class name 11 | ERROR | [x] Opening brace of a class must be on the line after the definition 13 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed 13 | ERROR | [x] Scope keyword "protected" must be followed by a single space; found newline 14 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed 15 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed 16 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
  5. ------ ---------------------------------------------------------------------- Line requisition.edit.php ------ ---------------------------------------------------------------------- 21 Class Error referenced

    with incorrect case: error. 24 Instantiated class requisition not found. 25 Call to method load_from_database() on an unknown class requisition. 27 Class Error referenced with incorrect case: error. 28 Constant ERR_RECORD_NOT_FOUND not found. 29 Call to an undefined method Error::new_error(). 36 Constant APP_ROOT not found. 199 Constant REQ_TERM_FULL_TIME not found.
  6. Refactoring Breaking up big pieces of code Pulling procedural code

    out to objects Pulling large pieces of functionality out