Don’t Compare Java and Objective-C

“My opinion as an android and iOS developer”

Wildan Garviandi
Amartha Engineering
4 min readMar 9, 2018

--

I start as an android engineer on my first career and end up on iOS (because i love the MVC architecture), android is incredible open source OS that grow twice faster than iOS and android using Java in development process which mean if you had learn Java for desktop or web you’ll learn faster develop android app.

As we know that Objective-C is one of language from Apple to build app for iDevice or Mac products It is the main programming language used by Applefor the OS X and iOS operating systems, and their respective application programming interfaces (APIs), Cocoa and Cocoa Touch. This statement is totaly different with Java.

Java is intended to let application developers “write once, run anywhere” (WORA) meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual machine(JVM) regardless of computer architecture.

If we want to compare the performance in language compare Objective-C and Java is not use because we need compare in many cases and in OS Technology Comparing ARC and Dalvik/ART(start from Kitkat API) also hard to do, but if we talk about metrics in iOS altough the memory is very low you can see your app still smoothly animate the button, but in android probably crash because GC(Grabage Collector) is collect you object to release object on memory.

Each programming language that i mention here are have an own patterns. For me Java pattern are more “Geek” than Objective-C start from method name :

i can said that if you aren’t put the JavaDocs on that method probably your team doesn’t know what’s the meaning from those variable. On that sample as we can see method :

are not “human friendly” for me. Meanwhile if i wrote sample code on Objective-C :

as we can see here Objective-C code are longer than Java but more easy to read. But Objective-C have a weak point. In Java All you need to set method to be public accessible just type :

but in Objective-C you need to register the method in .h file :

and implement on .m file :

this saga not end yet … in variable declaration java have some fancy method :

and so many other sample …

In Objective-C private static simply just need declare on interface :

but Objective-C have other issue ..

for Java engineer if you want to make an object you don’t need to define what is object status on memory, but in objective-C you can assign object status like :

strong mean your object will stay still on memory even if memory warning and need to release some object, nonatomic means multiple thread access the variable (dynamic type) for more detail you probably need to see this

actualy there’s still more to compare beetwen Objective-C and Java but some case can’t just tell like this, if you curious about “are you sure with what you doing?” you need to try by your self simply just create an hello world app, or maybe app with simple button and textview where you can try to pass object.

So The Conclusion Are

Java and Objective-C have a different builder, compiler, IDE and platform compability. My advice is please pick one you like if you like readable code you can choose Objective-C but if you like to develop app in more platform Java is not only using by android so you can use Java for build other platform.

Thank you for spend your time read my articles, any feedback please put on Response.

We’re always looking for awesome people to join our incredible journey! Click here to learn more!

--

--

Wildan Garviandi
Amartha Engineering

Software developer, Mobile dev wizard, Backend dev for fun, UX/UI Researcher, and new skill Machine Learning engineer FTW!