First Do No Harm - Droidcon Boston
-
Upload
annyce-davis -
Category
Technology
-
view
389 -
download
1
Transcript of First Do No Harm - Droidcon Boston
7 to 9 years
@brwngrldev
What’s Involved:• Major in Math/Science
• Take the MCAT
• Go to Medical School
• Take the USMLE Step 1
• Do Rotations
• Take the USMLE Step 2@brwngrldev
What’s Involved:• Major in Math/Science
• Take the MCAT
• Go to Medical School
• Take the USMLE Step 1
• Do Rotations
• Take the USMLE Step 2
• Complete Internship
• Do Residency
• Take the USMLE Step 3
• Take the Board Exams
• Do a Fellowship
@brwngrldev
How can I become
an Android
Developer?@brwngrldev
How can I become a
great Android
Developer?@brwngrldev
Newsletters
Podcasts
Online Courses• At your own pace
• All aspects of development
• Different perspectives
Online Courses - Udacity
Online Courses - Caster.IO
“If you associate
with eagles, you will
learn how to soar…”
- Ojo Michael E.
Conferences• Hear from the Experts
• Grow your Network
• Learn new Techniques
Conferences
Open Source
• Countless Examples
• Learn by Doing
• Design Patterns in Action
Open Source
@brwngrldev
Open Source
@brwngrldev
Open Source
Study• Newsletters
• Podcasts
• Online Courses
• Conferences
• Open Source@brwngrldev
Prevention• Static Code Analysis
• Code Reviews
• Leak Canary
• Automated Testing
• API Testing@brwngrldev
Static Code Analysis
Lint
Checkstyle
FindBugs
PMD
@brwngrldev
Static Code Analysis
0
40
80
120
160
Checkstyle FindBugs PMD Error Prone Lint
@brwngrldev
Static Code Analysis - FindBugs
Static Code Analysis - FindBugs
Code Reviews
Code Reviews
Code Reviews
Code Reviews• Catch Issues
• Gain Exposure to New Ideas
• Promotes Consistent Design
• Ensures Maintainability
Code Reviews
Leak Canary
debugCompile “…:leakcanary-android:$leak” releaseCompile “…:leakcanary-android-no-op:$leak” testCompile “…:leakcanary-android-no-op:$leak”
@brwngrldev
Leak Canary
private BooksAdapter booksAdapter; @Bind(R.id.recyclerView) RecyclerView recyclerView; private static Toolbar toolbar; private BooksPresenter booksPresenter;
@brwngrldev
Leak Canary
@brwngrldev
Architecture
Architecture
Foo Foo Bar
Baz
MVP + Dagger
@brwngrldev
Clean Architecture
@brwngrldev
Automated Testing
https://martinfowler.com/bliki/TestPyramid.html
@brwngrldev
Continuous Integration
@brwngrldev
API Testing
API Testing - Postman
API Testing - Postman
1.Send Requests
2.Receive Response
3.Run Test Scripts
Sending Requests
API Response[ { "userId": 1, "id": 1, "title": "sunt aut facere repellat", "body": "quia et suscipit\nsuscipit recusandae" }, { "userId": 1, "id": 2, "title": "qui est esse", "body": "est rerum tempore vitae\nsequi sint" } ] https://jsonplaceholder.typicode.com
Test - Status Code
tests["Status code is 200"] = responseCode.code === 200;
@brwngrldev
Test - Schema
var schema = { "type": [“array”, “null”] };
var jsonData = JSON.parse(responseBody);
tests["Valid Schema"] = tv4.validate(jsonData, schema);
@brwngrldev
IT GETS
BETTER@brwngrldev
Test - Schema
@brwngrldev
{ "userId": 1, "id": 1, "title": "sunt aut facere repellat provident", "body": "quia et suscipit\nsuscipit recusandae" }
Test - Schema
var postSchema = { "type" : "object", "properties" : { "userId": { "type" : "integer" }, "id": { "type" : "integer" }, "title": { "type" : "string" }, "body" : { "type" : "string" } }};
@brwngrldev
API Testing
Set Up Monitors
Prevention• Static Code Analysis
• Code Reviews
• Leak Canary
• Automated Testing
• API Testing@brwngrldev
74 year oldstomach pain
34 year oldstomach pain
@brwngrldev
@brwngrldev
LET’S
SHARE@brwngrldev
Code Outside
InsideEmulator
CODE
@brwngrldev
@Overridepublic void onFailure(Call<Book> call, Throwable t){ bus.post(new BookLoadingErrorEvent(id));
Timber.e(t, "Unable to load the book data from API.");}
Write Logs
Logcat/Pidcat
Log Events
public void trackEvent(String event){ analytics.track(event);
if (Fabric.isInitialized()) { Crashlytics.log(event); }}
Crashlytics
OUTSIDE
@brwngrldev
Crashlytics
Crashlytics
Classy Shark
Classy Shark
Battery Historian
Battery Historian
Battery Historian
…Battery Citizen
mitmproxy
https://mitmproxy.org/doc/howmitmproxy.html
mitmproxy
https://mitmproxy.org/doc/howmitmproxy.html
mitmproxy
brew install python3
pip3 install mitmproxy
mitmproxy --host
@brwngrldev
mitmproxy
mitmproxy
Systrace
Systrace
Alerts Pane
Systrace
Alert Detail
INSIDE
@brwngrldev
Apk Analyzer
Android Profiler
Android Profiler
Android Profiler
Android Profiler
http://tools.android.com/tech-docs/android-profiler
EMULATOR
@brwngrldev
Android Options:
GPU Overdraw
blue -> green -> light red -> dark red
(1x) (4x or more)
Android Options:
GPU Overdraw
@brwngrldev
Android Options:
Profile GPU Rendering
16 milliseconds
@brwngrldev
Android Options:
Profile GPU Rendering
https://developer.android.com/studio/profile/dev-options-rendering.html
Diagnosis
Resources• http://www.kotlinweekly.net - Kotlin Weekly
• http://androidweekly.net - Android Weekly
• https://www.androiddevdigest.com - Android Dev Digest
• http://www.adavis.info/2015/07/android-devs-listen-up.html - Podcasts
• https://www.udacity.com - Udacity
• https://caster.io - Caster.IO
• http://androidstudygroup.github.io/conferences - Android Conferences
Resources• http://findbugs.sourceforge.net - FindBugs
• https://github.com/square/leakcanary - Leak Canary
• https://www.getpostman.com - Postman
• https://github.com/JakeWharton/timber - Timber
• https://github.com/JakeWharton/pidcat - Pidcat
• https://fabric.io/kits/android/crashlytics - Crashlytics
• https://www.lynda.com/trial/AnnyceDavis - Lynda.com
Resources• https://github.com/google/android-classyshark - ClassyShark
• https://github.com/google/battery-historian - Battery Historian
• http://docs.mitmproxy.org/en/latest/mitmproxy.html -mitmproxy
• https://developer.android.com/studio/profile/systrace.html - Systrace
• https://developer.android.com/studio/build/apk-analyzer.html - APK Analyzer
• http://www.adavis.info/2015/03/android-overdraw-what-is-it-and-why.html - Overdraw
• https://developer.android.com/studio/profile/dev-options-rendering.html - GPU Rendering