Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Git Driven Refactoring

Git Driven Refactoring

Often we know that our code needs refactoring, but we have no idea where to start. Maybe we studied some common code smells and learned about the things that we should be avoiding, but memorizing the rules doesn’t automatically lead to fixing all problems. In this talk, we explore how you can use Git to recognize and address violations to each of the SOLID principles. Using diffs, commit history and pull requests you can learn to recognize patterns in code that point to problems. These same tools can help you correct those issues and write more maintainable code.

Ashley Ellis Pierce

November 15, 2017
Tweet

More Decks by Ashley Ellis Pierce

Other Decks in Programming

Transcript

  1. You should be able to call the same method on

    a subclass as you could on a parent and get a compatible result
  2. Use the git log to group commits into topics and

    recognize when a class is doing more than one thing
  3. Keep an eye out for red in the diff when

    you're adding functionality, this could indicate a violation of the Open/Closed principle
  4. Integrate tools like automatic style linters with your GitHub account

    to make code cleaner and easier to recognize problems
  5. Use git log and git blame to find how often

    classes or methods have had to change. This tells you where your worst offenders most in need of refactor are.