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

Code as a crime scene

Karumi
June 21, 2016

Code as a crime scene

When you need to refactor your code you need be careful about three areas: first found the code to be refactored, secondly be careful with the scope and last but not least, take considerations about your team. During this talk we review these three key points and describe the different approaches a developers can use.

Karumi

June 21, 2016
Tweet

More Decks by Karumi

Other Decks in Technology

Transcript

  1. Code as a crime scene Jorge Juan Barroso Carmona [email protected]

    @flipper83 +JorgeJBarroso Android Expert Android GDE
  2. Adam Tornhill “When you see that I committed a bunch

    of buggy spaghetti last week, you know it’s because I’m a bad programmer, irresponsible and perhaps even a tad stupid. When you, on the other hand, deliver scrappy code (yes, I know - it’s a hypothetical scenario) you know it’s because you were close to a deadline, had to save the project or just intended it to be a prototype.” Adam Tornhill
  3. “La deuda técnica es como tener una tarjeta de crédito.

    Tienes que devolver el dinero y los intereses. Si tiras siempre de la tarjeta de crédito, no vas a poder pagar los intereses y estarás en bancarrota.” Pedro Ureña
  4. File blank comment code …/iosched/ui/BaseActivity.java 203 175 1185 …/iosched/ui/SessionDetailActivity.java 178

    111 995 …arton/disklrucache/DiskLruCacheTest.java 113 37 881 …/iosched/ui/SessionsFragment.java 147 106 875 …/iosched/provider/ScheduleProvider.java 78 128 842
  5. Watch out for classes that change frequently, it might be

    possible that a lot of people are working on it or it has too much responsibility
  6. File n-revs android/build.gradle, 14 doc/BUILDING.md, 13 README.md, 9 .travis.yml 9

    Wearable/build.gradle, 6 build.gradle 6 android/src/com/google/android/apps/iosched/util/ImageWorker.java, 5 gradle/wrapper/gradle-wrapper.properties, 5 android/src/main/java/com/google/samples/apps/iosched/ui/BaseActivity.java, 5 android/src/main/res/values-it/strings.xml, 5
  7. File num-lines total media max BaseActivity.java 1360 3332 2.45 8

    SessionDetailActivity.java 1106 2898 2.62 9 MapInfoWindowAdapter.java 142 221 1.56 5
  8. File 1 File2 % couple average-rev SocialStreamFragment.java ImageFetcher.java 100 2

    SocialStreamFragment.java ImageCache.java 100 2 ImageCache.java ImageFetcher.java 100 2
  9. Tests are the only way to make sure that everything

    keeps working after doing a refactor
  10. “If you point of me, remember you have 3 fingers

    pointing at you” Pedro Vicente Gómez
  11. Bibliography They’re the cracks! Your Code as a crime scene.

    Adam Tornhill Working Effectively with legacy code. Michael Feathers Refactoring: Improving the Design of Existing Code. Martin Fowler. Workflows of Refactoring. Martin Fowler. OOP2014. Refactorizar a patrones. Xavi Gost. Refactoring: Where Do I start?. J. B. Rainsberger. Your android app as a crime scene. Pedro Vicente Gomez