Skip to main content
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, ...
Robert Harvey's user avatar
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"...
just me's user avatar
  • 653
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 ...
candied_orange's user avatar
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 ...
Christophe's user avatar
  • 78.7k
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 ...
Doc Brown's user avatar
  • 210k
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 ...
candied_orange's user avatar
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 ...
Robzor's user avatar
  • 888
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. ...
amon's user avatar
  • 135k
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 ...
candied_orange's user avatar
10 votes
Accepted

What is the correct way to configure a testing mode on a class?

You should use a different approach. The commonly advised approaches are Use DI to inject the firestore object into your repository class instance. This way, your test framework can just inject a ...
Bart van Ingen Schenau's user avatar
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 ...
Shai Almog's user avatar
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 ...
Doc Brown's user avatar
  • 210k
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 ...
asaf android's user avatar
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,...
Deacon's user avatar
  • 767
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 ...
Robert Harvey's user avatar
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 ...
gnasher729's user avatar
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; ...
Doc Brown's user avatar
  • 210k
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 ...
Dan Pichelman's user avatar
7 votes
Accepted

Best practices for app-cloud synchronization of database representation

You are trying to create a distributed eventually-consistent system. Those are inherently complicated. It's understandable that you are having difficulty coming up with a good solution because there ...
amon's user avatar
  • 135k
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 ...
Greg Burghardt's user avatar
6 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. ...
R Sahu's user avatar
  • 1,986
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 ...
John Wu's user avatar
  • 26.6k
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 ...
Bent's user avatar
  • 2,576
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,...
casablanca's user avatar
  • 4,964
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 ...
Robert Harvey's user avatar
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 ...
gnasher729's user avatar
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){ ...
GetBackerZ's user avatar
5 votes

Private apps for iOS and Android

You can develop and distribute private apps among selected clients. In iOS, ad-hoc distribution is there, but you'll need to hook up your mobile device to a Mac OSX. Ad-hoc distribution is possible ...
TroublingCushion's user avatar
5 votes

If I develop a media player for mobile or desktop do I have to pay for a license if my player is able to read MP3 files?

I read quite a few forum topics and mailing list (link), the general answer was that if you are using the Android SDK, and you do not have an MP3 encoder/decoder in your application, then you don't ...
meskobalazs's user avatar
5 votes
Accepted

Should I put UI and logic in separate classes?

UI design patterns like Model-View-Controller, Model-View-Presenter and Model-View-ViewModel routinely provide mechanisms (i.e. separate classes) that allow Separation of Concerns between the surface ...
Robert Harvey's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible