PDA

View Full Version : What programming language is right for me?




macsrockmysocks
Jul 12, 2006, 07:03 PM
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?



Mitthrawnuruodo
Jul 12, 2006, 07:16 PM
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.

macsrockmysocks
Jul 12, 2006, 07:22 PM
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.

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?

HiRez
Jul 12, 2006, 07:31 PM
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.

Mitthrawnuruodo
Jul 12, 2006, 07:36 PM
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 (http://java.sun.com/). 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 (http://www.amazon.com/gp/product/0072123540/qid=1152750849/sr=1-12/ref=sr_1_12/102-8139742-0722514?s=books&v=glance&n=283155) and C/C++ (http://www.amazon.com/gp/product/0072227222/qid=1152750818/sr=1-21/ref=sr_1_21/102-8139742-0722514?s=books&v=glance&n=283155) Programmers Reference books. And they can be very handy for beginners and pros alike...

therevolution
Jul 12, 2006, 07:37 PM
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?
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 (http://wiki.python.org/moin/BeginnersGuide/NonProgrammers) for total beginners such as yourself.

balamw
Jul 12, 2006, 07:41 PM
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?
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 (http://www.oreilly.com) books I've used. For the beginner the "Learning XXX" titles are often a good resource. e.g. Learning Python (http://www.oreilly.com/catalog/lpython2)

B

Monkaaay
Jul 12, 2006, 09:22 PM
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.

slooksterPSV
Jul 12, 2006, 10:15 PM
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.
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/

caveman_uk
Jul 13, 2006, 03:04 AM
Objective C is really really easy, Cocoa is awesome, fun, and easy.

Ssssshhhh, don't tell everyone! ;)

macsrockmysocks
Jul 13, 2006, 03:15 AM
Ssssshhhh, don't tell everyone! ;)

Why not? is that a bad thing?

caveman_uk
Jul 13, 2006, 04:59 AM
Why not? is that a bad thing?
So the winking emoticon wasn't enough of a clue then?

kodiak
Jul 13, 2006, 08:17 AM
(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?

caveman_uk
Jul 13, 2006, 08:39 AM
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.

ham_man
Jul 13, 2006, 11:01 AM
Learn how to program with C, learn the concepts of OOP with Ruby, and then move on to Obj-C/Cocoa... :)

GeeYouEye
Jul 13, 2006, 02:13 PM
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.

Gil Bates
Jul 13, 2006, 02:42 PM
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?

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.

ham_man
Jul 13, 2006, 02:45 PM
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.
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...

macsrockmysocks
Jul 13, 2006, 03:10 PM
So the winking emoticon wasn't enough of a clue then?

Sorry, I didn't notice it.

slooksterPSV
Jul 13, 2006, 04:10 PM
Here's a couple programs - they do the same thing:


/*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 argc, char* argv[]) // starting point of any C/C++/Objective-C program
{
printf("Hello world!\n");
return 0;
}

Output

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:@"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.


//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 argc, char* argv[]
{
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.


#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 argc, char* argv[])
{
NSLog(@"Hello world!\n");
return 0;
}


Output:

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

weg
Jul 13, 2006, 05:13 PM
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?
Thinking in Java (http://www.mindview.net/Books/TIJ/) 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 (http://caml.inria.fr/ocaml/index.en.html), there's a good user's manual (http://caml.inria.fr/ocaml/index.en.html) and a free book (http://caml.inria.fr/pub/docs/oreilly-book/index.html) 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# (http://research.microsoft.com/projects/ilx/fsharp.aspx) (can be run on the Mac or on Linux using Mono (http://www.mono-project.com/)). 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++).

macsrockmysocks
Jul 14, 2006, 01:26 PM
Alright guys, I decided to do Python first just because it looked easy. And it is! It is very easy to understand. Thanks guys.

guzhogi
Jul 14, 2006, 01:58 PM
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.

yg17
Jul 14, 2006, 03:24 PM
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.

cmmcintosh
Jul 14, 2006, 04:16 PM
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.

Catfish_Man
Jul 14, 2006, 10:35 PM
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.

NSLog() is much like printf(). It's pretty much the first thing you learn in Cocoa ;)

slooksterPSV
Jul 15, 2006, 12:37 AM
Ok I'm tossing in another dime:

I used to play around with BASIC and QBasic at a young age. Once I learned some of that I downloaded and modified programs and tried to learn more.

When I was younger than 12, I downloaded and played around with C++ using Dev-C++ trying the commands that they had. When it said printf("");
That's all I used and played with.

At 12 years old I found a magazine that taught you HTML, I read the article in the book, went online and learned HTML from http://www.pageresource.com/ - after learning HTML I learn a little bit of javascript.

That same year I went out and got a C how to program book and learned some C. I learned some C++ online and from a couple different books.

After that I learned some Visual Basic and made some small apps in Microsoft Word using the Visual Basic Editor

Once I learned some of that, I purchased an OpenGL book (which I wish I could find) and read through most of it and learned how to create objects and learned more about C/C++.

After that I got a Windows 98 Programming book and learned how to make Windowed applications (WHICH IS A PAIN IN THE @$$!!!). Ok you have SOME and I mean SOME control of the objects in Windows, but nothing like you do on Mac OS X. Plus the cost of the tools to develop good Apps on Windows was over $500.

After that book I bought a "C++ for the absolute beginner" (BEST BOOK IN THE WORLD) - search for it on amazon - and learned C++ and EVERYTHING with C++ that I'd need for developing applications. (short long unsigned signed int char bool void etc. etc. data types).

After I finished that book and I mean FINISHED it I bought a DirectX programming book which didn't teach you crap. It assumed you knew how to program in DirectX already.

After directx I purchased a brand new iBook G4 (that was back in October) I had a G3 before that and I first used a mac when I was a sophomore in HS (I just graduated). Programming in Objective-C and then Cocoa Programming for Mac OS X.

Anyways, the point is, I've learned quite a bit and nothing compares to Objective-C and Cocoa, nothing! Also, Mac's have proven more useful for what I do already, and where I want to go in the future.

weg
Jul 15, 2006, 04:48 AM
Alright guys, I decided to do Python first just because it looked easy. And it is! It is very easy to understand. Thanks guys.

Excellent decision.. though it will be hard for you to move back to primitive languages like C++ and C that don't provide built-in functional features (http://docs.python.org/tut/node7.html#SECTION007130000000000000000) and list comprehension... ;-)

HiRez
Jul 15, 2006, 07:00 AM
Excellent decision.. though it will be hard for you to move back to primitive languages like C++ and CSeriously it's true, it would painful having to do that if you get used to Python first! Even Objective-C (while pretty cool) is painful in many ways compared to Python.

rata911
Jul 15, 2006, 07:20 AM
Depends on what you'd like to do with your aspired programming skills. The following are just excerpts from my personal opinion, don't misunderstand it as a "must-be" guideline or something :)

Objective C is your choice if you'd like to develop Mac applications but if you're a beginner and want to learn basics first (I mean programming basics that are language-independent) then go for Python. Python is my current "toy" and I really really like it so far. I like the "everything is an object" principle. Cute!
If you'd like to learn a programming language that is or might be useful for future classes in let's say college then I'd personally aim for Java or C/C++.

But in fact it doesn't matter. Just make a choice and everything is good :)
You can also have a look at "Brain****" (yes that programming "language" exists) :D

Edit: Oh, the stars above should be substituted with the F-Word...my bad.

macsrockmysocks
Jul 15, 2006, 02:28 PM
Seriously it's true, it would painful having to do that if you get used to Python first! Even Objective-C (while pretty cool) is painful in many ways compared to Python.

I figured I hate Python now. I just don't see the point in it. Half the things I was doing was: ask the person their name-.......ok easy......- and making mthematical thingys- absolute boredom

HiRez
Jul 15, 2006, 04:55 PM
I figured I hate Python now. I just don't see the point in it. Half the things I was doing was: ask the person their name-.......ok easy......- and making mthematical thingys- absolute boredomI have no idea what you just said.

slooksterPSV
Jul 15, 2006, 08:30 PM
I figured I hate Python now. I just don't see the point in it. Half the things I was doing was: ask the person their name-.......ok easy......- and making mthematical thingys- absolute boredom

Well, you have to start somewhere, so why not ask the user to do basic things. When it teaches you how to ask the persons name, its mainly to show you how to take in Input and output it as well. So I take the users last name as char*, or if I want both names, I take them char* char*. Rather, in C like this:

char *firstName, *lastName;
scanf("%s %s", firstName, lastName);

variables is that lesson, etc. etc. There's always a meaning.


Seriously it's true, it would painful having to do that if you get used to Python first! Even Objective-C (while pretty cool) is painful in many ways compared to Python.


Well... easy languages like that are ok if you're just trying to do something quick, effortlessly, and with few errors. But if you want more control you NEED to use C, C++, C#, or Obj-C.

HiRez
Jul 15, 2006, 10:35 PM
Well... easy languages like that are ok if you're just trying to do something quick, effortlessly, and with few errors. But if you want more control you NEED to use C, C++, C#, or Obj-C.I don't agree with you there, I think you have a misunderstanding of what Python is. Python is well-designed and elegant, making it easy to use, yes, but easy as opposed to being "simple". It has quite a lot of advanced features that C, C++, C#, and Objective-C lack, and is more truly object-oriented than any of them (although Ruby takes that even further). I've got a lot more experience with Objective-C than Python, but if I had my choice I'd choose to program in Python. I can do things in 25 lines of Python code that would take over 100 in Objective-C, and much longer time-wise from the typing alone. And that's with it being clear, readable, and maintainable when done. The only thing holding Python back IMO is a native GUI API such as AppKit or a cross-platform one such as JFC/Swing (yes, I know about PyObjC) and a native web API such as Rails.

Anyway, the point is that Python is much more powerful than the toy scripting language many people believe it to be. Having said that, there is a place for C-derived languages, and they have their own advantages, but you really need to take a closer look at so-called scripting languages such as Python and Ruby before you write them off. I once viewed them that way too, but my eyes have been opened.

icetraxx
Jul 15, 2006, 11:33 PM
I know others might disagree but you might want to think about tinkering around with RealBasic. Its easy to get started with and it can build crossplatform applications. If you use carbon framework calls within your app it will give you all the features of the carbon framework inside MacOS 10 and not just the realbasic supplied features. I find you can build very powerful applications with it.

Hope I've helped,
Chris :)

slooksterPSV
Jul 16, 2006, 01:26 AM
I know others might disagree but you might want to think about tinkering around with RealBasic. Its easy to get started with and it can build crossplatform applications. If you use carbon framework calls within your app it will give you all the features of the carbon framework inside MacOS 10 and not just the realbasic supplied features. I find you can build very powerful applications with it.

Hope I've helped,
Chris :)
RealBasic - BASIC/VisualBasic oriented, its cross platform for Linux, Mac OS 9/X and Windows. It's a very nifty program and there are people who have developed programs with it and they're programs you'd pay $200 for, RealBasic is powerful.

--now
In response to HiRez's statement, I know very little of Python so what you say may hold true, but for what I've seen and used, it doesn't hold true for me. I like having grain finite control with every aspect, and Python may offer that, but I'm used to C oriented languages, so that's why I defend them that much. Now my friend, his boss sent him out to buy some Ruby books to learn Ruby, its gaining large popularity - I haven't used it or seen it - but these languages may have more power than C/C++/C#/Obj-C, but I just haven't used it enough to see it. Now I have seen some pretty awesome games made with Python and that's way nifty, again I'm used to C/C++... and the engines like SDL, OpenGL, Allegro, etc.
BTW this is important: The easier the language is for you, the more power to you. C oriented is easier for me so I have better control and ease of use with it. Others, like HiRez, have better control with so called "script like" languages like Python so that benefits them. --Right now with Objective-C I'm surprised, I've been expecting to input more code than I am, but Cocoa links all of it together so easily that it takes out all the hard work lol.

slooksterPSV
Jul 19, 2006, 09:51 AM
http://www.samspublishing.com/articles/article.asp?p=102257&rl=1
There is chapter 3 of Programming in Objective-C

AlmostThere
Jul 19, 2006, 04:41 PM
Anyway, the point is that Python is much more powerful than the toy scripting language many people believe it to be. Having said that, there is a place for C-derived languages, and they have their own advantages, but you really need to take a closer look at so-called scripting languages such as Python and Ruby before you write them off. I once viewed them that way too, but my eyes have been opened.

Couldn't agree more. Python (and friends) lead to shorter development time, fewer bugs and less maintenance ... which leads to higher productivity, greater sense of achievement, a big bonus and more holiday ... which makes me :D

and a native web API such as Rails.
Django? TurboGears? Plone?

And Apple really need to bring the PyObjC guys in house and give us a proper RAD environment.

mig2000
Jul 21, 2006, 09:05 PM
I am a senior programmer and one of my client is asking me if there is any Object O programming for MAC that is code free. Basically, he has seen some tools like this in PC and like to know if there is any programming language or tool that requires no coding - I am not aware of any but if anyone knows anything, please share.

Thanks
Alex