Do's and Don'ts for Android development, by Futurice developers

  1. Use Gradle and its recommended project structure
  2. Put passwords and sensitive data in gradle.properties
  3. Don't write your own HTTP client, use Volley or OkHttp libraries
  4. Use the Jackson library to parse JSON data
  5. Avoid Guava and use only a few libraries due to the65k method limit
  6. Use Fragments to represent a UI screen
  7. Use Activities just to manage Fragments
  8. Layout XMLs are code, organize them well
  9. Use styles to avoid duplicate attributes in layout XMLs
  10. Use multiple style files to avoid a single huge one
  11. Keep your colors.xml short and DRY, just define the palette
  12. Also keep dimens.xml DRY, define generic constants
  13. Do not make a deep hierarchy of ViewGroups
  14. Avoid client-side processing for WebViews, and beware of leaks
  15. Use Robolectric for unit tests, Robotium for connected (UI) tests
  16. Use Genymotion as your emulator
  17. Always use ProGuard or DexGuard

非常简短的17条经验,却又很实在的经验总结。

在开发时,我常常在想,如果大家能够遵守着规范,编码会越来越简单,维护成本及稳定性都会得到很好的把控。

事实上,能够坚守DRY(Don'tRepeat Yourself)的工程师也越来越少。你是否听过“先做出来,后面再重构。。。”,结果你看到的不是重构,而是继续在RY(Repeat Yourself)。

常常会因为一次RY,而不断在RY,数次RY之后,在面临着需求变更时,加班改BUG的开始。。。

一个优秀的项目,仅仅这17条还远远不够。以此共勉,快乐编码。

最后,感谢原作者的分享。

更多请关注原文:https://github.com/benniaobuguai/android-best-practices#use-gradle-and-its-recommended-project-structure

本文转至:http://blog.wo2b.com/?p=250

更多相关文章

  1. Android外派(安卓外派) — 长年提供安卓开发工程师外派业务(可签合
  2. 安卓外派(Android外派)提供安卓程序员外派业务(北京动点,可签合同)
  3. Android(安卓)模拟HTTP协议的编码问题 Android默认编码UTF-8
  4. 互联网徐金良:Android为什么能够超越iOS?
  5. 互联网徐金良:Android为什么能够超越iOS?
  6. Android中MediaMuxer跟MediaCodec用例
  7. Android(安卓)游戏开发的一些基础和经验
  8. Android(安卓)游戏开发的一些基础和个人经验
  9. Android为什么能够超越iOS?

随机推荐

  1. Android调整手机的默认亮度
  2. log函数封装,让WIN32和android ndk共用相
  3. 初学Android,使用ContentResolver获取自
  4. Android的logcat命令详解
  5. Redis 6.0 正式版终于发布了!除了多线程还
  6. View学习(android)
  7. Android(安卓)之 ServiceManager与服务管
  8. android edittext操作
  9. Android(安卓)上网代理设置(浏览器)
  10. Android模拟翻书效果