Hi,
I am looking to learn Java to make a few Android apps but what I am wondering is if I learn Java, will Objective-C make alot more sense to me? I did hear something like this a while ago on some tutorial but am not sure.
Thanks
Hi,
I am looking to learn Java to make a few Android apps but what I am wondering is if I learn Java, will Objective-C make alot more sense to me? I did hear something like this a while ago on some tutorial but am not sure.
Thanks
It depends on the current programming background that you have. If you have no object oriented programmin experience of course the answer is yes!
I would say that learning Java will help you with Obj-C for some aspects:
Apart from that the two paradigms are not so similar because one it's based on method calling while the other is based on message passing.
Learning more languages is always a good idea, but I wouldn't bother learning Java if you need to learn Objective-C.
Java was directly derived from Objective-C and, thus, has a very similar class model and other attributes. Learning Java isn't really going to help with Objective-C and it will likely confuse you more than it helps.
If you want to program for iOS or Mac OS X, you'll need to know Objective-C and might as well just stick to it from the start. There are some great docs and tutorials out there.
If you then want to expand your horizons, learn a radically different language from Objective-C. Say, Erlang, Scheme, Clojure, Go, or something else.
Well it depends on what you already know.
I found knowing C had the biggest impact on my understanding of Objective-C but Java helped in the way that its easier to understand a different object oriented language if you already know an object oriented language...
I suppose not really. There are fundamental differences between the two languages. The most fundamental ones:
However, if you're having general problems understanding serveral programming concepts, such as maybe OOP, than Java is a good choice.
edit: If you come from a PHP background, Ruby might be of interest to you. Semantically, it is extremely close to the OO part of Objective-C, it can be used for the same tasks as PHP, and it is relatively easy to learn.
greetz
back2dos
If you learn objective-c, objective-c will make a lot more sense to you.
Following on to back2dos, I think you'll find that Java really doesn't help you with some of the aspects of Objective-C.
In teaching Objective-C over the past several years, I found that folks who were familiar with C to some level (i.e. pointers and what they meant) and dynamic languages (either Python or Ruby) that had some object oriented structure around them were the fastest to pick up on Objective-C and the "way of thinking" that used the frameworks to the fullest extent. Of all the dynamic languages, I think I'd recommend "Ruby" as the closest, as it uses and has the concept of blocks (passing around anonymous functions to do things) that is now coming into iOS 4.0 and will be pervasive in the near future.
The places where Java, C++ and C# programmers usually stumble are getting used to Objective-C's dynamic typing and runtime, especially around the GUI programming. To be fair, I've seen this bite C++ programmers more in the past, but some of the java-background folks had issues there as well.
The real win and power-boost in doing things with Objective-C is getting comfortable and familiar with the frameworks that you're using, and learning where to plug in your own code to the best effect, and what patterns to follow to make that really effective. Delegation, MVC, and a few other specific patterns are pervasive. If you don't have much background with object oriented programming, Objective-C frankly isn't a bad language to learn it with. If that's where you're finding yourself, I'd recommend the book iPhone Programming: The Big Nerd Ranch Guide as a means of getting into it that covers all the basics really well. Aaron's book Cocoa Programming for Mac OS X is probably a little gentler introduction into Objective-C and object oriented programming - and the first five chapters apply beautifully to either Mac or iPhone development.
The place where folks stumble out of Objective-C is when they get heavily into graphics programming, which quickly drops down into the C frameworks (CoreGraphics) and the interface between the straight-up C libraries and the Objective-C equivalents. They do a pretty good job of keeping that reasonably painless, but when you get into the details it can get a little more tricky.