How Important Is Java in iPhone apps?

Discussion in 'Public Game Developers Forum' started by iphoneprogrammer, Sep 4, 2010.

  1. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    0
    0
    Financial Analyst for Baines and Ernst
    London, UK
    I am currently studying Java, and was wondering how important it's role is in iPhone programming. I am also trying to develop a pretty neat UI and have no Objective-C knowledge, and have heard that some devs use other languages to program UI's and stuff. Is this even possible to do, and if so, is it easier or more difficult than doing it in Objective-C.
     
  2. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    877
    5
    18
    Male
    Developer
    Toronto Canada
    Learning Java might be an OK way get the hang of general programming patterns but you can't use it directly for iOS programming.

    If your UI ideas are based around Apple's UIKit widgets you're better off diving right into Objective-C, Cocoa, and interface builder. You can create a UI from scratch using OpenGLES or some other lower-level view classes but even then you'll need at least a little Objective-C and Cocoa knowledge to setup the layers and handle events.

    Only other option is to use a 3rd party library/engine, but even some of those require Objective-C.
     
  3. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    0
    0
    Financial Analyst for Baines and Ernst
    London, UK
    I figured I would start learning Java first as its similar to Objective-C and learning java will make it easier once I start to learn Obj-C. As for OpenGLES, I have absolutely no idea how to use it, program with it, or even launch the application. Thanks for the help, I appreciate it.

    Is there any specific reason(s) why you cannot directly use Java in iOS development?


    And lastly, I have been trying to find a good alternative to Textpad, a text editor for windows, but for the mac. I figured that Xcode could serve as a substitute seeing as how it is a compiler and all. Is it wrong to think that Xcode will work for compiling Java code, even though its meant for Obj-C programming? I have the Eclipse program (for mac), but do not know how to use it, as I have only used TextPad.
     
  4. sticktron

    sticktron Well-Known Member

    #4 sticktron, Sep 4, 2010
    Last edited: Sep 4, 2010
    Java is stale. Learn C/C++, which of course transfers over into ObjC as well as Javascript, so you are covered from web to handheld to desktop.

    You can still write Java applications for the iPhone, but there is no built-in VM, so you have to jailbreak and get one through Cydia.

    Apple doesn't like Java because it's bloated and slow and ugly, the opposite of Apple's design goals.
     
  5. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    877
    5
    18
    Male
    Developer
    Toronto Canada
    Not so much actually. If you want to start with a "core" language start with plain old C. Objective-C is a superset of C, so any C you know can be applied directly (unlike Java).

    If you're building for iOS or Mac OS X then Xcode is the path of least resistance as far as code editors go. AFAIK Xcode still supports Java development to some extent if you insist on going that route, but I've never used it for Java personally and it's certainly no longer a priority for Apple.

    As far as other text editors go, I always keep TextWrangler handy - it's free and lightweight and has great multi-file search & replace. I use Coda for all my web development and can highly recommend it for HTML/JS/PHP stuff. Some folks swear by TexMate but I could never get into it. I wouldn't call any of these a replacement for Xcode, but if yer so inclined you can use any text editor and compile from the terminal without ever touching Xcode.
     
  6. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    0
    0
    Financial Analyst for Baines and Ernst
    London, UK
    I've read a lot about TextMate and Textwrangler, however I am looking for a free alternative to TextPad and TextMate costs $. So ill give textwrangler a try. I truly appreciate all the info your giving me, it helps so much!! Thank you.
     
  7. If you are interested in iPhone developing, I guess I would ask why Java is the language you are learning. If the iPhone programming is your only goal, you absolutely just get started with Objective C.

    My guess, though, is that you might be taking a programming class. Java is pretty common for programming classes, I think, and in that case I would say, you should absolutely, positively stay in the class and learn Java. Learning programming in any language is going to be more helpful than not knowing any programming language, and for many people having a class is going to be better than trying to teach yourself (although it can be done).

    Just to give my background, other than dabbling in BASIC when I was younger, I started with a class in C++ in high school, moved to working in Java (doing a lot of Enterprise applications and things) for work, and did some web applications (also Java or PHP) after college. So, prior to moving to the iPhone, Java was my strongest language.

    And, in my opinion, the move from Java to Objective C wasn't that bad. There were a couple of syntax differences, of course. And memory management is different. (Java has garbage collection but the iPhone SDK doesn't). But I think if you know one, then you can move to the other without too much of a problem. One of the nice things about Java is that, like Objective C, both use the Objective Oriented Paradigm. So you will be used to structuring your code in classes.

    I do agree that Java is a little bit stale these days. In terms of the computer industry at large, I don't think it is quite as "hot" as it used to be. But remember that the Android SDK is (sort of) Java. And if you are just getting started with programming, then most of the concepts you are learning will carry over to Objective C quite easily.
     
  8. iphoneprogrammer

    iphoneprogrammer Well-Known Member

    Mar 26, 2009
    2,280
    0
    0
    Financial Analyst for Baines and Ernst
    London, UK
    Well where I am taking classes, the prerequisites require me to start at Java, I have asked around to see what classes offer Obj-C but none do. So rather than not taking any programming classes at all, I decided to go with java. I figured that the syntax's would be a bit different, and that Java was somewhat similar Obj-C, so I thought this to be a good place to start.
     
  9. Yeah. That is very common, and what I guessed was your situation when you said you were learning Java. It is very common for Java to be taught in beginning computer classes. Objective C is not usually taught at all in programming courses, since it is basically tied to Apple. (There are, of course, the Stanford lectures and a growing number of exceptions). Other than the Mac and iOS devices, nothing much else uses Objective C.

    But again, I would not worry too much about starting with Java. It will not be the case that trying to learn Objective C will be like starting from scratch. You are going to see tons of things that are familiar, and the transition shouldn't be that difficult.
     
  10. Oh, and as far as editors go, TextWrangler is an awesome free editor for the Mac. Another free one worth looking at is Fraise (which used to be called Smultron) which has a large fan base.

    If you are really, really serious about development and want to invest some time into learning a more powerful editor, the Mac has also has free port of two of the most commonly used text UNIX editors: Vi and Emacs. The Mac comes with Vim, you can open it in the terminal by typing "vim". Or you can download MacVim, which is my editor of choice. I
    think there is are also a free Emacs versions called something like Aquamacs.

    Both of these editors will be confusing at first and you will need to read and use them a lot before you start to get the hang of it, but over time it will start to payoff. (Sort of like programming itself). After awhile you will be able to jump around a document to exactly where you want to go in an practically an instant, without your fingers ever touching the mouse.

    In iPhone programming, I personally use MacVim (a version of vi). But I sometimes get forced back into XCode for various things.
     
  11. sticktron

    sticktron Well-Known Member

    Like the above poster wrote, learning HOW to program is the key.

    Switching between languages is mostly just a matter of syntax (ie most of the languages you will be using are syntactically C-based to begin with: C++/ObjC/Java/C#/Javascript) and different features (garbage collection, sdks, etc.)

    How you go about modeling and the patterns you use are transferable.

    So stay in your class, and on the side try doing things in ObjC that you are doing in class.
     

Share This Page