• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to convert java code to objective c?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Im a newbie to the world of programming and have only been learning Java for 3 months. Im finding it hard and beginning to question will it ever make sense and could I make a career out of it My goals were to pass the SCJP exam/get a job/make phone apps. One day I was looking up iphone development just to see what i could be doing with Java in the future. To my horror I realised Java had nothing to do with iphone development it was objective C . I did more research and people are saying obj c is a harder lanuage to learn. Im struggling with Java so learning oblective c would be mission impossible. To make a long story short is there any way to convert java code to objective c?

Thank you in advance.
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not aware of any code converter, I don't like to take this route personally any way.
Don't try to learn two languages concurrently, switching the context between the two of them is going to damage your learning process.
The good news is there are a lot of similarity between Java and Objective-C, yes that including automatic memory management.

If you want to learn Objective-C and iOS development at the same time, then have a look at this book: Objective-C Fundamentals.
The mission isn't impossible, it is doable
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hussein Baghdadi wrote:The good news is there are a lot of similarity between Java and Objective-C, yes that including automatic memory management.



Well, there is a certain commonality of all modern languages, so there are similarities, but I would not call it "a lot". I do agree that once you know two or three languages, adding the next one is nearly trivial.

While Objective-C does have automatic memory management when running on OS-X, it does *not* have it on IOS. That feature is missing from the embedded operating system.

Proper IOS applications must be designed as IOS applications, with the toolset and frameworks that IOS provides. Even if there were a conversion tool, the resulting code would not look and feel like a proper IOS application.

If your must learn to write Objective-C on IOS as your very first programming environment, I wish you the best of luck. I'd start with something a bit less challenging, but that is just IMHO.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On a side note, iOS 5 has Automatic Reference Counting now, makes memory management the job of the compiler.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hussein Baghdadi wrote:On a side note, iOS 5 has Automatic Reference Counting now, makes memory management the job of the compiler.


The job of Memory management belongs somewhere automated. Its good that IOS 5 has finally supported this. Too bad it will take years before we can rely upon it, as there are literally millions of devices that will never run IOS 5
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why "will never run iOS5" ? Any proof or known reasons?
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lots of old iPhones were left off the upgrade path. I don't remember the details of which, and when. This is not just an Apple thing, nearly all vendors have minimum hardware requirements for upgrades. Just as modern HTML 5 code can't run on ancient versions of Microsoft IE.
 
padraig dillane
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to all who replied. Ill keep slogging away with the Java
 
Ranch Hand
Posts: 1609
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would agree with Husseini of not trying to learn two things. I can not appreciate the similarity between Objective-C and Java, but if there are any, I think they may have to do with syntax. I think C is always known to sit closely with the hardware while, Java relies mostly on the JVM. Coming to iPhone/Apple, somewhere Steve had repeated Alan Kay's quote,
"People who are really serious about software should make their own hardware."
 
Greenhorn
Posts: 23
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If all you want is mobile development,

you must consider phonegap and jquery mobile. This supports most of the current smartphone OS. I suggest not to limit your scope to one specific platform, as platform independence is very impressive.

These two frameworks lets you create mobile app mostly out of simple HTML/CSS !!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some time ago, I wrote this article on starting with ObjectiveC development as an Android/Java developer.
Basically, it is not possible to convert Java code automatically, but as a Java developer, it is quite easy for me to map an Android app to an objectiveC equivalent.
Android code can pretty much be literally translated line per line to ObjectiveC(not taking into account the infrastructural differences, of an Activity vs a ViewController for example), without a lot of rethinking/refactoring.

And ARC is compatible with iOS 4.0 on, making it viable for most projects, since most iOS apps target only from 4.0 anyway.
There are some situations in which you cannot use it yet though, like when using third party libs that do not have conversions yet.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic