Closed feresr closed 8 years ago
This application is an approach of how to implement an android app based on the Uncle Bob's Clean Code architecture. The synchronization depends of the app and is not standard. The example you have exposed, can be done with a few lines of code. IMO this isn't an issue,
Perhaps you are right and this is not an issue. But could someone provide references to articles explaining how to integrate this architure without this small setback. I mean, using this 'as is' on a real application wouldn't be optimal. Again. I love how this is structured. but this small flaw prevents me from using it in my app.
@feresr Of course, It's not an issue because if you check the code there is the cache store also (you can use whatever you want there like a Database instead of files) in order to store/cache a few things and invalidate them after mins/hours whatever anyway.
@spirosoik thanks!. I took another quick look at the code and noticed I had skipped these key lines:
UserDataStore userDataStore;
if (!this.userCache.isExpired() && this.userCache.isCached(userId)) { userDataStore = new DiskUserDataStore(this.userCache); } else { userDataStore = createCloudDataStore(); }```
Now everything falls into place :)
Will close this issue now.
@feresr the only thing which must change is that this demo uses a multiple activity architecture. it will be good to use a single activity architecture with fragments. I mentioned it here https://github.com/android10/Android-CleanArchitecture/issues/32#issuecomment-139189160 and another guy send a detailed pull request for this kind of implementation. check here https://github.com/android10/Android-CleanArchitecture/pull/53
Read carefully the post of @android10 , he mentioned a few things which must be done a little bit different. One of them is the packaging of application's features. @android10 suggests and actually, it's a good idea to use 'Packages by feature', especially if you are in a big team and you want to keep the ownership as a smaller team
Guys, nice discussion. Sorry I was on vacations. As you have figured out, one of the approach is to use a cache, that's the main value of it, isn't it? We want to avoid connections as much as we can, specially when no data is changed on the server.
On the other hand, another simple approach I used is to retain fragment instances. Although this is not the most effective solution, it is pretty much we need in order to not either hit the api or query the cache.
@android10 :+1: cool
I like how you architectured your application but, in a real android app. you would't want to waste resources and make new network request every time the user does something as simple as rotating their phone.