3 ms·
Some of what is in this article isn't correct: > Because fragments create, bind, and configure views, they contain a lot of view-related code. This effectively
by Zigurd 12y ago
Some of what is in this article isn't correct:
> Because fragments create, bind, and configure views, they contain a lot of view-related code. This effectively means that business logic isn't decoupled from view code — making it hard to write unit tests against fragments.
Put the business logic somewhere else. You CAN'T put it in Fragment objects, except in trivial cases, for other reasons, like you'll have different Fragments for different layouts for different screens, and different combinations of Fragments. Assuming you have a REST-backed app architecture, you can put business logic in front of your REST calls or, if data is sync'ed locally, in the ContentProvider or in a bound service wrapping the ContentProvider.
I have seen other big companies build big teams that over-engineer Android apps. I think that's what happened at Square.