androides y mazmorras. part i (dungeons & robots)

Post on 06-Aug-2015

174 Views

Category:

Engineering

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Androides y mazmorras. Part I(dungeons & robots)Jorge Juan Barroso Carmona

jorge@karumi.com@flipper83+JorgeJBarroso

Android expert

We embark on every project with a commitment to create something elegant, enduring and effective. That is our heartbeat.

Our approach is uniquely simple and honest, we are a small dedicated software studio, delivering outstanding work.

Karumi is the Rock Solid code software development studio.

Why go down the stairs

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.”

Refactor is not destroy all your code

Refactor is not an Arcade Fire album.

Refactor is change the code and works on the same way

Timing is part of the development process

Programming is problem-solving. And human problem-solving requires a certain degree of experimentation

Architecture decay and code entropy

Ignorance and bad developers

Pedro Ureña

“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.”

Explore the dungeon

“I wrote that about aesthetics in discussing when you apply refactorings. To some extent, the situations I describe in the refactoring guidelines are fairly vague notions of aesthetics.

But I try to provide more guidance than just saying, "Refactor when the code looks ugly." I say, for instance, that duplicated code is a bad smell. I say that long methods are a bad smell.

Big classes are a bad smell. ”

Martin Fowler

Run away from intuition

Run away from trendy styles

Run away from me

Take decisions based on data

Searching for hotspots

number-of-commits,79 number-of-entities,2601 number-of-entities-changed,4582 number-of-authors,27

App Google IO 2014

Code-maat

Class sizes. Less size ~= Less

responsibilities

File blank comment code ./android/src/main/java/com/google/samples/apps/iosched/ui/BaseActivity.java 203 175 1185 ./android/src/main/java/com/google/samples/apps/iosched/ui/SessionDetailActivity.java 178 111 995 ./third_party/disklrucache/src/test/java/com/jakewharton/disklrucache/DiskLruCacheTest.java 113 37 881 ./android/src/main/java/com/google/samples/apps/iosched/ui/SessionsFragment.java 147 106 875 ./android/src/main/java/com/google/samples/apps/iosched/provider/ScheduleProvider.java 78 128 842 ./android/src/main/java/com/google/samples/apps/iosched/ui/SessionLivestreamActivity.java 124 125 808 ./android/src/main/java/com/google/samples/apps/iosched/ui/MapFragment.java 181 166 635 ./third_party/disklrucache/src/main/java/com/jakewharton/disklrucache/DiskLruCache.java 92 215 623 ./android/src/main/java/com/google/samples/apps/iosched/provider/ScheduleContract.java 145 277 590 ./android/src/main/assets/licenses.html 85 12 583

Cloc

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

File n-revs entity,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

Code complexity

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

Temporal coupling

Search getInstances()

File 1 File2 % couple average-rev SocialStreamFragment.java ImageFetcher.java 100 2 SocialStreamFragment.java ImageCache.java 100 2 ImageCache.java ImageFetcher.java 100 2

Code paths

Duplicated code

DRY

Be careful with eternal changes

The dungeon master

Listens to everybody before making decisions

Echo effect

Adjust the team and the communication process for

the refactor

Ask for opinions from outside (external or other teams)

Ask for opinions from outside (external or other teams)

“If you point of me, remember you have 3 fingers pointing at you”

Pedro Vicente Gómez

BibliographyThey’re the cracks!

Your Code as a crime scene. Adam TornhillWorking Effectively with legacy code. Michael FeathersRefactoring: 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.

Find meI am very social!

jorge@karumi.com@flipper83+JorgeJBarroso

Questions?

top related