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.
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
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 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
"People who are really serious about software should make their own hardware."
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 !!
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.