A good API is not just easy to use but also hard to misuse.
- Version your API
- Path: /v1/users
- Subdomain: api.v1.example.com/users
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.| private boolean isServiceRunning() { | |
| ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); | |
| for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)){ | |
| if("com.example.MyNeatoIntentService".equals(service.service.getClassName())) { | |
| return true; | |
| } | |
| } | |
| return false; | |
| } |
| // app module build.gradle | |
| apply plugin: 'com.android.application' | |
| android { | |
| compileSdkVersion rootProject.compileSdkVersion | |
| buildToolsVersion rootProject.buildToolsVersion | |
| defaultConfig { | |
| applicationId "com.segunfamisa.gradleextraproperties" | |
| minSdkVersion rootProject.minSdkVersion | |
| targetSdkVersion rootProject.targetSdkVersion |
| <?xml version="1.0" encoding="utf-8"?> | |
| <resources> | |
| <!-- google's material design colours from | |
| http://www.google.com/design/spec/style/color.html#color-ui-color-palette --> | |
| <!--reds--> | |
| <color name="md_red_50">#FFEBEE</color> | |
| <color name="md_red_100">#FFCDD2</color> | |
| <color name="md_red_200">#EF9A9A</color> |
| Your name and email address were configured automatically based | |
| on your username and hostname. Please check that they are accurate. | |
| You can suppress this message by setting them explicitly: | |
| git config --global user.name "Your Name" | |
| git config --global user.email [email protected] | |
| After doing this, you may fix the identity used for this commit with: | |
| git commit --amend --reset-author |
| [user] | |
| name = Julien Bisconti | |
| email = [email protected] | |
| [core] | |
| excludesfile = ~/.gitignore | |
| pager = diff-so-fancy | less --tabs=1,5 -R | |
| editor = /usr/bin/vim | |
| [alias] | |
| wow = log --all --graph --decorate --oneline --simplify-by-decoration |