We recently wrote a post on J2ObjC and the benefits of using it for cross-platform development. It went over some of the advantages of using J2ObjC, but we’ve had some follow-up questions since. Rather than fielding these one-by-one, we decided to do a follow-up post with more detail about the benefits of J2ObjC.
Here it is: the top 4 reasons to use J2ObjC for cross-platform development projects.
J2ObjC helps to reduce duplicate code by up to 70-80% because you can write all the business logic only once. That’s the majority of the app, coded once, for both iOS and Android. Only the UI needs to be coded separately outside of the core.
This means requirements are implemented only once. Basic functionality like local storage, network calls, GPS, Bluetooth, etc., can be modularized and reused in future projects. User stories on tools like JIRA can be split much more easily, with separate stories for UI and business logic. All of this – less coding, reduced redundancy, easier separation – ultimately reduces development cycles so products can be delivered more quickly.
J2ObjC forces development teams to strictly follow MVC architecture, which separates the business logic and the UI into the “core” and the “platform.” It forces a disciplined approach that requires thorough planning and vastly improves coding structure. When these are properly separated, each is easier to update or change as required.
The advantages are numerous. Updates are easier. Code is more easily reusable and applicable when changes need to be made. And, you can make changes to the Model, View, or Controller independently without affecting other parts; therefore changing, reusing, and updating code is simpler and quicker.
The biggest downside to using tools for cross-platform development as opposed to building natively for each platform is that there is typically some loss of native functionality or aesthetic. This is because the majority of cross-platform tools add an extra layer of communication since the system can’t directly access the methods.
This isn’t the case with J2ObjC. Developers create the shared logic in Java on the Android side, meaning Android can directly access the methods. The logic is then transpiled to Objective-C using J2ObjC, so the iOS side now has the methods directly accessible as well. And because the UI still needs to be coded natively, the user experience doesn’t suffer either.
As already mentioned, J2ObjC forces the separation of the business logic and UI, which as an ancillary benefit improves project workflow. Developers working on UI can continue to do work even when the core is not completed, and vice versa. This also allows for more flexibility in the allocation of resources, as UI developers and core developers can help each other out when necessary to meet deadlines. With J2ObjC, you can do more things, faster, with fewer people.
While J2ObjC is not without its disadvantages, we’ve found it to be the most effective cross-platform app development method. Depending on your current development process, it may take some getting used to. That said, the long-term benefits are worth the initial time investment. Less coding, shorter development cycles, and better project workflows allow you to create better apps, more quickly, without sacrificing native performance.