Finishing the Project

It's not just stopping

Readings

Deployment

Your Number One Goal

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Update Libraries

Clean Your Code

  • Fix or document all remaining bugs
  • Clean up the UI
  • Delete unused files and commented out code
  • Uninstall unused libraries
  • Re-test everything

Don't Forget the Cloud

  • Replace all developer-owned cloud service accounts with
    • clearly marked dummy account info
    • instructions for getting valid accounts
  • Secret keys in files on github? Yikes!! Immediately:
    • Remove files.
    • Update .gitignore on all dev machines
    • Generate new keys

Document

How Code Cleanup Should Be Done

The Agile Samurai, Chapter 13

Technical Debt

Technical debt is the continuous accumulation of shortcuts, hacks, duplication, and other sins we regularly commit against our code base in the name of speed and schedule.
The Agile Samurai, Chapter 13

Technical Debt: Not Just Code

I was once part of a large-scale rewrite for a back-end system where a city name was spelled two different ways. The cost of this seemingly small difference was huge. Instead of not caring how the city was spelled, they had to write and carry this extra code and complexity for as long as that system remained in production, which for mainframe systems can be a very long time.
The Agile Samurai, Chapter 13

Refactoring

  • Small incremental code improvements with no change in external behavior
  • Many possible operations: Rename method, Extract method, Inline temp, ...
  • Martin Fowler's catalog
  • Only do with a robust regression test suite
  • Don't stop and do a mass refactoring of all code!

Refactoring

The Agile Samurai, Chapter 13

How To Refactor Continuously

  • Write tests for a new user story
  • Verify the tests fail as expected
  • Write code until the tests pass
    • Focus on function over aesthetics
  • Refactor
  • Commit

Refactoring: DRY

  • DRY: don't repeat yourself
  • Replace local repeated calculation with variable
  • Replace global repeated calculation with method
  • Move repeated operations on method result inside method

Refactoring: SWYM

  • SWYM: say what you mean
  • Meaningful names, e.g., var average;
  • Standardized names, e.g., for (var i = 0; ...
  • Named constants, e.g., numItems / CARTON_COUNT
  • Well-named methods, e.g.,
    function roundToCents(n) { return round(100 * n) / 100; }

Thanks to Hakim El Hattab for RevealJS