创建安卓app的30个经验教训 - 泡在网上的日子



创建安卓app的30个经验教训 - 泡在网上的日子

  1. 在添加任何第三方party之前,请三思:这真的是一个成熟的项目吗?

  2. 如果一个东西用户看不到,就不要绘制它

  3. 除非真的需要,否则别使用数据库;

  4. 达到65k方法数限制来的非常快,真的,非常快!不过 multidexing 可以拯救你;

  5. RxJava 是 AsyncTasks 以及其它杂碎的最佳替代者;

  6. Retrofit 可能是现在最佳的网络请求库;

  7. 使用 Retrolambda来简化你的代码;

  8. 把 RxJava 和 Retrofit 以及 Retrolambda 结合起来会让你酷炸天!

  9. 我使用 EventBus 而且它也很好,但是我并不会用太多,因为这样代码库会变得凌乱;

  10. 包名按照功能来,而不是按分层来;

  11. 把所有东西都移到 application thread之外;

  12. lint 可以帮助你优化布局与布局树,这样你就能识别出那些可能已经被移除的冗余的View;

  13. 如果你在使用gradle,使用一切可能的方式去加速它;

  14. 对builds做profile reports,以便知道什么占据了编译时间;

  15. 使用一个 有名的 架构;

  16. 测试时比较花时间,但是一旦你找到诀窍它可以比不使用测试更快、更健壮;

  17. 使用 依赖注入 让你的app更模块化,从而更易于测试;

  18. 收听 fragmented podcast 将会让你受益;

  19. 千万别用私人邮箱作为你安卓市场的发布者账号;

  20. 总是使用恰当的输入类型;

  21. Use analytics to find usage patterns and isolate bugs;

  22. 关注最新的 libraries(使用dryrun 来快速查看它们的的效果);

  23. 你的service应该做你所需的事情,并且尽快死去;

  24. 使用 Account Manager 来提示登录用户名和邮箱地址;

  25. 使用CI(持续集成)来构建和发布你的beta和产品apk;

  26. 不要运行自己的CI server,维护server是费时的事情,因为磁盘空间,安全问题,更新server以防止SSL攻击等等原因。使用circleci, travis 或者 shippable, 它们便宜,而且你也可以少担心一些事情;

  27. Automate your deployments to the playstore;

  28. 如果一个library很大而你只需要使用其中的一部分功能,你应该寻找一个更小的来替代(比如依靠proguard );

  29. 要使用多于实际需要的module。从零开始编译一个module或者仅仅是检查上个module是否最新所需要的时间几乎是加载 binary .jar/.aar依赖的4倍以上;

  30. 开始考虑用SVG来替代PNG

  31. Make library abstraction classes, it'll be way easier to switch to a new library if you only need to switch in one place (e.g.AppLogger.d("message") can contain Log.d(TAG, message) and later realise that Timber.d(message) is a better option);

  32. 监控你的连接情况以及连接类型(wifi之下更新更多数据?);

  33. 监控你的电源和电量(在充电的时候更新更多的数据?电量低的时候暂停更新?);

  34. 一个用户界面就如一个笑话那样,如果你需要解释,那么证明它并不够好;

  35. Tests are great for performance: Write slow (but correct) implementation then verify optimizations don't break anything with tests.


Read full article from 创建安卓app的30个经验教训 - 泡在网上的日子


No comments:

Post a Comment

Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts