71
votes
Accepted
Uncle Bob's clean architecture - An entity/model class for each layer?
In my opinion, that's absolutely not how it's meant. And it's a violation of DRY.
The idea is that the entity / domain object in the middle is modeled to represent the domain as good and as ...
- 834
41
votes
Accepted
Clean Architecture - Too many Use Case Classes
Do I really have to make 24 use cases?
Only if everything you write is CRUD.
Refer to the diagram below:
Your assertion is that you will have six different entities, and 4 methods (Create, Read, ...
- 198k
23
votes
Accepted
What to keep in mind when releasing an app which uses libraries licensed under the Apache 2.0 License?
There are well-established patterns for attributing the libraries you use. In general, you put this attribution in the same place where you'd put your copyright notice.
In a desktop application: ...
- 130k
16
votes
Accepted
Why is Android Runtime's AOT compilation more performant than Dalvik's JIT?
Compilers need two things to generate performant code: information and resources.
JIT compilers have way more information at their disposal than AOT compilers. Static analysis is impossible in the ...
- 101k
15
votes
Accepted
Should business logic be in the app or in the backend?
It should be on a case-by-case basis but I would expect most of the logic to go in the backend.
Your interactor might still contain several methods ("Check ticket availability", "Add ticket to basket"...
- 608
14
votes
Accepted
Difficulties in reading code
I have more than 20 years of experience and I am profoundly lazy. I work in many platforms.
The way I read and understand someone else's code is primarily with my fingers.
Why yes I am the kid who ...
- 97.7k
14
votes
Accepted
Access multiple entities in repository - clean architecture
Your repository doesn't break the "clean architecture", which identifies entities as the core, requires dependency inversion, but doesn't impose to use repositories.
But your repository ...
- 72k
13
votes
Accepted
Paid and Free Version in seperate git branches
You can try to utilize version control for this, but I recommend against it.
Such a requirement is much easier to manage by maintaining only one "version" or "branch" of the application, when you add ...
- 194k
13
votes
Accepted
Proper way to name a class which has just methods and not fields
If a class is properly encapsulated it's hard to tell if it even has fields from outside.
Some classes are immutable. You can't change their fields once their objects are constructed. Your class is ...
- 97.7k
11
votes
Uncle Bob's clean architecture - An entity/model class for each layer?
You actually got it right. And there is no violation of DRY because you accept SRP.
For example:
You have a business-Method createX(String name) then you may have a Method createX(String name) in the ...
- 111
11
votes
Why use XML in Android?
Its because its simpler - tools can be written to manipulate a XML document far easier than understand java code, so the layout can be created and modified by a simple tool that does not need to also ...
- 48.2k
10
votes
Accepted
How to prevent users from decompiling app to find API key?
Why is it holding the secret? The app should never be holding the secret.
Your back end (or the validation service you're using) for performing the authentication round trip should be holding the ...
- 878
10
votes
Accepted
Why doesn't CharSequence define contains(CharSequence)?
The point of CharSequence is to provide a read-only view to a character sequence, and that's it. This interface does not provide any string manipulation or searching methods. Those are out of scope.
...
- 130k
9
votes
Why are there no cross-platform mobile applications?
As the co-founder of Codename One which does pretty much that I can answer that pretty easily.
You can cross compile (which is what we do) but you can't have a single binary that will work everywhere ...
- 191
9
votes
Accepted
Unit Testing in VIPER Architecture: Possible?
Oh it's possible. It just doesn't look like what you want it to look like.
What you're complaining about is the use of output ports1,2,3 to communicate results rather then returning results. Does ...
- 97.7k
9
votes
Accepted
Keeping version parity between platforms
When most of your code base is shared for both platforms, I would avoid getting version numbers "out of sync", because it will bring a lot more effort for writing a coherent changelog or ...
- 194k
8
votes
Accepted
In MVP pattern should the View instantiate a Model object based on UI contents, or just pass these contents as parameters to the Presenter?
According to Martin Fowler's description of MVP ( http://martinfowler.com/eaaDev/uiArchs.html )
Of the View portion of MVC, Fowler says:
The first element of Potel is to treat the view as a structure ...
- 11.1k
8
votes
Accepted
Pure Dependency Injection - How to implement it
You've probably finished your course by now, but in case you are still searching, or someone else is: rolling your own DI is actually very simple on Android once you know how to do it.
Creating the ...
- 96
8
votes
Put conditional logic inside method for DRY, or keep it outside for readability?
I think that the logic in the existing code base is fine. I think that the method name is the issue.
Instead of naming it showInterstatialAd, why not name it something that tells what the method does,...
- 499
8
votes
Accepted
Is recommendable set as final as classes by default in a SDK?
In general, unless you're specifically designing your classes to be inheritable, it's better to mark them final.
Here's why: you can't predict how someone might use your class. If you allow ...
- 198k
7
votes
how can the presenter or view interact with the model in the MVP pattern?
In the MVP pattern is the View is "dumb". It doesn't really do anything. The presenter acts as the controlling object in the heirarchy, while the Model stores the data and has business logic methods ...
- 8,700
7
votes
JSON API or Plain JSON
I'm not interested in JSON, I'm interested in the objects that are created from JSON. Like in your example, turning plain JSON into objects is easy. How difficult is it for new developers? Mostly they ...
- 40.5k
7
votes
Accepted
Is blocking a UI thread sometimes a good idea?
The better approach is to keep track if the animation currently runs or not, like this:
bool animationRuns=false;
async void Clicked()
{
if(animationRuns)
return;
animationRuns=true;
...
- 194k
7
votes
Releasing an unfinished Android app?
You only get one chance to make a first impression.
If you release an obviously unfinished buggy app, the first people to look at it will drown you in negative reviews.
Once you have a lot of ...
- 13.8k
7
votes
Accepted
How many presenters should I use in proper MVP?
Making the Presenters be dependent one one another does not sound right. The dependencies are such that you will need all the Views and all the Presenters to make one pair of View and Presenter work.
...
- 1,946
7
votes
Is this Singleton-like design pattern a feasible framework to build on?
It makes perfect sense to have only one instance of a class if it has a large cost when being initialized or it allows continuous operation as in your case.
But that does not indicate that the rest ...
- 2,576
7
votes
Accepted
Best way to Model Classes associated with other Classes?
It feels like a good number of things are missing, to be honest.
A Team has many Players.
A Match is played between two Teams.
A Season is composed of many Matches.
A Season is managed by a ...
- 32.5k
6
votes
Proposed Method to Restrict API Access to Mobile App Only
Some comments
Your mechanism relies upon the secrecy of an algorithm, a technique known as security through obscurity, which is almost universally deemed a bad idea.
It is not likely you will be able ...
- 25.7k
6
votes
Should business logic be in the app or in the backend?
The very definition of the terms "front end" and "back end" comes from the separation of business logic (back end) from the user interface (front end). So yes, business logic should be in the back-end,...
- 4,694
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
android × 587java × 122
ios × 85
android-development × 59
mobile × 48
architecture × 35
design-patterns × 32
iphone × 28
mvp × 21
database × 19
android-market × 19
design × 17
licensing × 14
rest × 12
web-applications × 12
algorithms × 11
api × 11
security × 11
game-development × 11
object-oriented × 10
multithreading × 10
clean-code × 10
mvvm × 10
synchronization × 10
sqlite × 10