I'm working on a product that will be deployed to many different organizations (ideal scenario, dozens). Each deployment of the system (composed of native apps for iOS and Android) will involve the following:
In other words, the core functionality will remain the same across all deployments, but each instance will look different, hook into a different authentication systems, and have certain features enabled/disabled.
My Question: What would be the best strategy for managing our 2 mobile codebases (iOS & Android) in order to minimize duplication and simplify the deployment process?
The three solutions we're debating are:
Create a core library that is shared across all instances (as a sub-project/library project, or a git submodule), and add a thin layer on top with the branding and any configuration details.
Maintain a Git branch with the core functionality, and create a new branch for each deployment that contains the additional code.
Do something totally different that some smarter person on stackoverflow suggests.
Which sounds best to you? Thanks in advance for any feedback!!
An approach I would consider is dependency injection.
On Android, if you use a dependency injection tool such as Square's Dagger you can simply create a @Module
class which provides and injects components into your application. This way, you could maintain each white-label client's logic as separate components, and at compile time, a specific component would be selected via the reference in the @Module
class.
This is also a great way to test your applications and it can avoid a lot of boilerplate code.
There's great info in the following talks also given by Square:
Dagger: A Fast Dependency Injector for Android and Java
Engineering Elegance: The Secrets of Square's Stack
iOS has similar frameworks, one being Objection.
Outside the box options:
Is it a requirement that the mobile client has to speak directly to the white-label's servers? If not, you may want to consider using your own servers as a proxy to the white-label's servers. This would move all of the business logic up to your server, supporting all of your clients.
I don't have any experience with this but a seemingly promising option is J2ObjC which is in development at Google.
J2ObjC is an open-source command-line tool from Google that translates
Java code to Objective-C for the iOS (iPhone/iPad) platform. This tool
enables Java code to be part of an iOS application's build, as no editing
of the generated files is necessary. The goal is to write an app's non-UI
code (such as data access, or application logic) in Java, which is then
shared by web apps (using GWT), Android apps, and iOS apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With