72
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 ...
43
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, ...
16
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"...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
11
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 ...
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.
...
10
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 this ...
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 ...
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 ...
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 ...
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 ...
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,...
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 ...
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 ...
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;
...
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 ...
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.
...
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 ...
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 ...
6
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 ...
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,...
6
votes
Accepted
In mobile games that work across android and iOS is game logic written twice?
Three words: cross-platform compatibility.
If you write your game in HTML and Javascript, it will run on any platform where there is a web browser on the device (which is most devices nowadays). If ...
6
votes
Can you modify the front-end source code of a mobile app?
It's not just that people might be able to hack into your front-end app. They might be connecting directly to your server with an app that they wrote themselves.
I can get around whatever security ...
5
votes
String[] args vs (String . . . args)
A feature of String[] vs String... is that the "String..." does not need to be part of the call.
public void test(String... args){
if(args.length > 0){
for( String text : args){
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
android × 584java × 123
ios × 84
android-development × 58
mobile × 48
architecture × 36
design-patterns × 32
iphone × 27
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
synchronization × 10
sqlite × 10
testing × 9