Common Poor Coding Patterns and How to Avoid Them
summary
A demo Android app using the Pinterest API shows common failures and concrete fixes: a base Fragment with protected state creates inheritance hell so code shifts to composition and custom Avatar views; global event queues like EventBus (Otto/TinyBus) cause hidden bugs around a follow button so the app replaces loose events with listener/LiveData or RxJava flows; per-fragment cached models become inconsistent and are solved by a central repository pattern with tests via MVP + Mockito + Robolectric.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 2:30Problem 1 UI
- 7:19Problem 2 Events
- 12:06Problem 3 Events
- 13:05Problem 3 Code
- 13:40Solution
- 17:02Unit Tests
- 23:54Recap
- 25:07Additional Resources
- 25:39Questions
related talks
42mIngredients for a healthy codebase (en)
40mApp Development - Pragmatic Best Practices
29mDon't reinvent the wheel, use libraries: Modern Android Stack
31mPatterns for Safe Refactoring of Android Apps
40mProtips: A fresh look at advanced topics for Android experts
48mEfficient Android Layouts
18mRescuing Old Code with JetPack
23mAndroid Complexity
