7. Reasons
• Developers are lazy - reuse code
• Separate concerns (build independent blocs)
• Write better software
• Speed up compile time
• Make other people happy…
8. Make it open source!
• Feel better
• Code better: Power of shame
• Get features and bug fixes for free
• Easier to sell - quality prove
• Excitement from the community
• Security
• It’s free
• But most important: Be famous!
12. Create a SDK!
1. Don’t start with code: README.md and ROADMAP.md
2. Put it in a Git Repository
3. Include it in your CI (Continuous Integration)
4. Add static code analysis tools (i.e. FindBugs, Lint)
5. Autogenerate documentation (i.e. JavaDoc)
6. Prepare for testing
7. Make it accessible (i.e. distribute via maven)
8. Add a sample project
13. Managing Releases
Use the library in a real project
Master
SDK as a git submodule
Master
Develop
Develop
Feature Branch
Feature Branch
23. Flexible - support different versions
defaultConfig {
applicationId 'io.relayr.wunderbar'
minSdkVersion 15
targetSdkVersion 21
versionCode 22
versionName '1.0.22'
}
public boolean isSdk18() {
return android.os.Build.VERSION.SDK_INT >=
Build.VERSION_CODES.JELLY_BEAN_MR2;
}
24. Flexible - be context aware
mApplication.registerActivityLifecycleCallbacks(
new Application.ActivityLifecycleCallbacks() {
@Override
public void onActivityResumed(Activity activity) {
// we know there’s a UI!
}
}
);
25. Testable
• Mock mode (no network requests)
• No static methods
• Avoid final classes
• Avoid access to fields directly
26. Performant
• Don’t block the current thread!
RelayrSdk.sendMessage(“At droidcon Krakow!”);
27. Performant - Don’t log in production
• With Code
RelayrSdk.Builder(this)
.setDebuggable(false)
.build();
• On the Manifest
debuggable=false
28. Reliable
• Don’t crash silently - inform the user when a
problem occurs
RelayrSdk.login(new LoginCallback() {
public void onSuccess() {
// sign the user into the app
}
public void onError() {
// show error message
}
});
29. Lightweight
• Poor network conditions
• Association between small and fast
• Reluctance to include large libraries
31. Lightweight - be modular
dependencies {
}
include ‘io.relayr:java-sdk:0.0.5’
include ‘io.relayr:android-sdk:0.0.5’
include ‘io.relayr:android-onboarding:0.0.7’
include ‘io.relayr:master-module:1.2.0’
include ‘io.relayr:android-commons:1.0.0’