What programming language is right for me?

Discussion in 'Mac Programming' started by macsrockmysocks, Jul 12, 2006.

  1. macrumors regular

    Joined:
    Feb 21, 2006
    #1
    I know that this forum isn't really about "this", but I want to learn some type of computer language. I am 14 and an Honors High School student. I do not know which language would most suit me though. I have a Mac, so I considered Cocoaa and Objective-C. What ddo you guys think?
     
  2. Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #2
    I would start off with a nice scripting language, like Python and/or PHP, the latter is nice for making websites (maybe even with some XML and/or MySQL thrown in), and in PHP5 you can even get started on the next step: Object Oriented Programming.

    Learn some basic Java, which is probably the most educational OOP language out there, and once you have a good understanding of that you're ready for anything.

    Some simple C programming could also be handy before getting into Object-C, I would think.

    Every language has it's pros and cons and only by trying quite a few you can find the one that suits you and your programming projects best.
     
  3. thread starter macrumors regular

    Joined:
    Feb 21, 2006
    #3
    Ok, I think I am going to do the basic Java, then C, then Cocoa(Objective-C). Do you know any books for absolute beginners?
     
  4. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #4
    Python is great, but recently I've been checking out Ruby, which has much of Python's goodness but IMO is potentially much more useful because of Rails. You can't go wrong learning ANSI C as it is the foundation for many modern languages and is still useful itself.

    Java...meh. I used to really like Java a lot, and spent a lot of time with it, but after getting into Python and Ruby, Java seems a bit archaic and extremely bloated. It's got some advantages, but it can just take so much work to get things up that it's painful. In other words, you may find yourself spending most of your time building "scaffolding" on which to get your app running, rather than concentrating on the task at hand. Objective-C has some of this problem too, although things like Interface Builder, CoreData, and Cocoa Bindings bring some relief. For web apps, Struts is the API from Hell, and JSP+Servets suck by comparison with modern lithe solutions such as PHP and Ruby on Rails. Still, Java is not a bad language to learn programming on. One advantage Java has, other than being (mostly) cross-platform, is that there are literally a ton of books written about it, and a sea of free references and tutorials available online.
     
  5. Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #5
    I didn't actually read the book when I took Java in college, just spend much time solving the (small but frequent) assignments we got...

    I would start at Sun's Java site. Lot's of downloads, code examples and tutorials, and it's (mostly) free... :)

    The only books I've actually used a lot are the Java and C/C++ Programmers Reference books. And they can be very handy for beginners and pros alike...
     
  6. macrumors 6502

    Joined:
    May 12, 2003
    #6
    Yikes. While doing all those things would certainly be educational, it's overkill if you just want to find out what programming is all about and if it's something you'd like to pursue further.

    Do you have a certain project in mind you'd like to do? If so, perhaps we can make a better suggestion for you. You don't have to pick Obj-C just because you have a Mac. On the other hand, if Cocoa apps are what you want to do, then Obj-C is the way to go. You probably don't need to bother with learning Java first, though.

    If you want something simply to help you get a feel for programming, I'd go with Python. Here's a list of Python tutorials for total beginners such as yourself.
     
  7. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #7
    As mitth pointed our each language has its own strengths and weaknesses. It would help to know what kind of programs you intend to write, and where you think you might go into later in life...

    Personally I tend to "Click" with all of the O'Reilly books I've used. For the beginner the "Learning XXX" titles are often a good resource. e.g. Learning Python

    B
     
  8. macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #8
    I think you should check out Objective-C. It's a pretty simple extension to C that includes objects. With Cocoa you have a nice framework to start with too. I think working with these two technologies would give you a good start.
     
  9. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #9
    I second learning Objective-C then learning Cocoa.

    Objective C is really really easy, Cocoa is awesome, fun, and easy.

    I recommend: Steve Kochan's Programming in Objective-C
    For Cocoa I highly recommend: Aaron Hillegass' Cocoa Programming for Mac OS X
    For HTML ( a simple scripting language) - learn it off of: http://www.pageresource.com/
     
  10. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #10
    Ssssshhhh, don't tell everyone! ;)
     
  11. thread starter macrumors regular

    Joined:
    Feb 21, 2006
    #11
    Why not? is that a bad thing?
     
  12. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #12
    So the winking emoticon wasn't enough of a clue then?
     
  13. macrumors newbie

    Joined:
    Mar 21, 2005
    #13
    (trying not to go off topic :))

    when doing cocoa bits, does every one use straight objective-c, or use objective-c++?

    i already know c, c++ etc, want to play with cocoa...
    most examples i see use plain objective-c,
    so is objective c++ only used when trying to utilise existing c++ libraries?


    as for original poster... if you wanna learn how to program, rather than script .. then use java, its easier than c/c++ - teaches most of the concepts (expect perhaps good memory mangement) but has great tools and multi platform - i guess the reason colleges have moved to it.

    so leads another question for the existing programmers... anyone use the java cocoa interface? any good?
     
  14. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #14
    I've never used objective c++ only objective-c. Neither have I ever used the java bridge. It's deprecated anyway and won't be developed any further by Apple.
     
  15. macrumors 68020

    ham_man

    Joined:
    Jan 21, 2005
    #15
    Learn how to program with C, learn the concepts of OOP with Ruby, and then move on to Obj-C/Cocoa... :)
     
  16. macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #16
    First learn C, then Smalltalk. Then imagine a fusion between them. That's Objective-C and Cocoa, which you should learn next. Then Java (for WebObjects, which is the best web app stack out there - beats Struts to death with a strut, bashes Rails over the head with a rail... okay, enough of that). Then, when you're ready for something really fun, Io.
     
  17. macrumors newbie

    Joined:
    Jun 16, 2006
    Location:
    Frozen Wasteland
    #17
    You can mix Objective-C and C++ no problem. There are things you can do easier in C++ than Objective-C, and vice versa. I only use Objective-C in the Mac specific area to make porting to the "other" platform easier.

    To the OP, if you are planning to major CS in college, you may want to try Java. I heard it is what they teach first. But if you want to write Mac applications, Objective-C/Cocoa is the best.
     
  18. macrumors 68020

    ham_man

    Joined:
    Jan 21, 2005
    #18
    Learning any OOPL and then learning another is like learning Spanish then learning Italian. They are both alike, but there are some minor phrasing and syntax differences. In the end its the same framework and structure, just a different way to go about writing it...
     
  19. thread starter macrumors regular

    Joined:
    Feb 21, 2006
    #19
    Sorry, I didn't notice it.
     
  20. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #20
    Here's a couple programs - they do the same thing:

    PHP:
    /*Using the [ php ] tag for MacRumors color codes the code
    Code coloring helps you to understand what and where your variables are
    Ignore everything above this line*/

    #include <stdio.h> // include the standard input/output header

    int main(int argccharargv[]) // starting point of any C/C++/Objective-C program
    {
      
    printf("Hello world!\n");
      return 
    0;
    }
    Output
    Code:
    Hello world!
    
    The above is C. Let's disect it:
    #include <stdio.h> --links that header file to your program, this will allow you to use specific functions such as printf, scanf, sprintf, etc.

    int main(int argc, char* argv[]) --this is the starting point of any C/C++/Objective-C program, int main is a function that takes two arguments, int argc, and char* argv[]. If you use this on the command line and you type something after the executable name (let's say its myfirstprogram) so if you type: myfirstprogram this program -- argc would have the number 3 stored in it. myfristprogram = 1, this = 2, program = 3 and char* argv[] would contain those arguments in an array. -- basically ignore all that about int argc and char* argv[] for now.

    All functions that you are specifying what they do have curly braces around them, so inside the function int main(int argc, char* argv[]) you specify what it's going to do between { and }.

    printf("Hello world!\n"); -- this will print out text out if you run it in a terminal or command line window. It will print out:
    Hello world!
    _
    _ denotes the cursor. \n tells printf to go to a new line. So \n\n\n would go to the next line 3 times.

    return 0; -- tells you everything executed fine and that there were no errors. if you get 1 or -1 or something above or below 0 then there was an error with your program.

    You'll notice that lines that do something (like print output, return variables, declare variables, declaring functions that haven't been defined) all have semi-colons after them ( ; ). This is to tell the compiler when that function ends what its doing. Now this is different with different functions, for example if you are using variables, you can do a new line... ehh.. here's two examples:

    NSLog(@"He"
    "ll"
    "o w"
    "or"
    "l"
    "d!\n");

    [myFraction number1:23
    number2:44
    string:mad:"The fraction is: "];

    oh the stuff between /* */ are comments and are ignored by the compiler same with //
    Programmers use these to document there programs so they know what is going on.

    PHP:
    //This is a C++ program now
    #include <iostream>

    using namespace std
    //use the standard namespace std so we don't have
    //to type in std::cout

    int main(int argccharargv[]
    {
      
    cout << "Hello world!" << endl;

      
    //now let's say we didn't specify using namespace std;
      //we'd have to type this in to get Hello world!
      // std::cout << "Hello world!" << std::endl;
     
     
    return 0// let our app know it ended fine
    }
    The above is C++ read through the comments to see what it does.

    PHP:
    #import <Foundation/Foundation.h> 

    //Yes names are case sensitive
    //and notice we #import the files we need, we don't #include them
    //#import is better so it doesn't have to compile code included from
    //those files again

    int main(int argccharargv[])
    {
      
    NSLog(@"Hello world!\n");
      return 
    0;
    }
    Output:
    Code:
    2006-07-13 15:09:48.915 a.out[7822] Hello world!
    
    Oi this post is long, if someone wants to explain more, go for it. The Objective-C program uses a part of the Foundation framework, but its not the first objective-c program I made in the one book, the first objective-c program used <stdio.h> (using #import)..

    Anyways I've probably scared you from programming huh? there's a lot, and a lot to explain, just be prepared
     
  21. weg
    macrumors 6502a

    weg

    Joined:
    Mar 29, 2004
    Location:
    nj
    #21
    Thinking in Java would be for free (though I've to admit that I never read this book). Try to learn several different languages, you're still young and you can always specialize in one language later... A good book on the concepts of Object Oriented Programming is Bertrand Meyer's book on that topic, and if you want to go for something different you can have a look at Ocaml, there's a good user's manual and a free book online. Python is also a nice language to start with. It has some object oriented as well as functional elements, and like functional programming languages, it's pretty easy to write your first small applications (since there's an interactive development environment). If you want to learn a .NET language I'd have a look at F# (can be run on the Mac or on Linux using Mono). As a beginner, I'd stay away from C++ and C#, since these languages contain way too many features and allow you to write programs in a very bad style. Once you've understood the concepts they will be easy to learn (uhm, well.. not that I know anybody who has fully mastered C++).
     
  22. thread starter macrumors regular

    Joined:
    Feb 21, 2006
    #22
    Alright guys, I decided to do Python first just because it looked easy. And it is! It is very easy to understand. Thanks guys.
     
  23. macrumors 68020

    guzhogi

    Joined:
    Aug 31, 2003
    Location:
    Wherever my feet take me…
    #23
    It also depends on what you want to do. If you want to make Mac only apps, go w/ objective-c. Cocoa is just a framework, not it's own programming labguage. If you want to do Windows-only, learn .Net. But C/C++ is probably crucial since many apps in several different OSes use these, along with Java. PHP is good for websites, along w/ HTML. Note: HTML is a markup language, not a programming language. Those languages are probably a good place to start basic programming. Also, C, C++, Java and Javascript are all fairly similar. Once you know one, it's generally easy to go between them.

    There are butt loads of other languages out there, like Lisp, Scheme, Prolog, Perl, BASIC, Fortran, etc. As said earlier, each language has its pros and cons and are better suited for each thing.

    If you really like programming, several universities of computer science majors. I majored in Computer Science at Illinois Wesleyan University which is a liberal arts university so I probably did not get as much training as I would have gotten if I has gone to MIT. But hey, do whatever's right for you.
     
  24. macrumors G5

    yg17

    Joined:
    Aug 1, 2004
    Location:
    St. Louis, MO
    #24
    I first taught myself PHP, and now consider myself to be very good at it, and I've never touched a book thanks to tutorials online, and the PHP documentation which is extremely helpful. I then learned C++ and Java in college which were easy, but once you know 1 programming language, learning another is a lot easier. I never got too deep into C++ and Java, because I switched majors from computer science (programming) to IT, which is more of a general computer major.

    I know 3 languages (4 if you want to count Javascript, although I'm not a pro at that, I still have to look things up every now and then), and still prefer PHP. I find it a bit easier to use, and I know more PHP than C++ and Java combined, so I can write a pretty advanced PHP program, but my C++ and Java skills limit me to useless command line programs. Plus, since I've done a little bit of website design (nothing professional, just crap with friends and a personal site that didn't last too long due to my laziness), knowing PHP just made sense.

    Unfortunately, PHP is virtually useless in the business world. For some reason, large corporations won't touch PHP with a 10 foot pole and would rather work with things like ColdFusion and M$ ASP for reasons I'll never understand.
     
  25. macrumors newbie

    Joined:
    Jun 22, 2006
    #25
    yg17 i wouldn't say C++ was easy, When ever you first learn pointers it gets complex and confusing.

    slooksterPSV what does the function NSlog() do? i have never seen that.
     

Share This Page