My first programming language, which one?


Peyote

macrumors 6502a
Apr 11, 2002
760
0
COBOL

:D


I'm not programmer by any means, but I think Java would be a good place to start. Very similar to Actionscripting in Flash as well.


Once you have Java totally down, ColdFusion is good to know for developing.
 

jalagl

macrumors 6502a
Jun 5, 2003
802
1
Costa Rica
Java

I would suggest Java. You can use OSX's dev tools, which came bundled with the OS, and you can find a lot of tutorials online.

i would also suggest C, but it tends to get a bit complex as a first language.
 

GeeYouEye

macrumors 68000
Dec 9, 2001
1,651
3
State of Denial
For Mac programming, C, followed by Objective-C. Java if you really want cross-platform stuff. C++ is okay too if you don't get too deep into it or you don't want to do much Mac programming off the command line since you pick up several habits which need to be unlearned for Objective-C.
 

Osirius

macrumors newbie
Original poster
Dec 22, 2004
3
0
okay, i think i will go for java, thanks for the help guys
 

SkAlex

macrumors member
Jun 21, 2004
47
0
I just completed my first programming course at NYU and it was in JAVA. I really enjoyed it and found it was a great introduction. The course stressed that a large reason they start with JAVA is its cross-platform use.
 

blaster_boy

macrumors 6502
Jan 31, 2004
282
4
Belgium
Python

If all you want to do is bang out scripts, or start with that, why not try python. It's used by quite a lot of people, but it is not a compiled language (it pre-compiles itself, but not fully).

http://www.python.org for more info and tutorials :)

Easy to get started, and you can then dig in deeper and deeper. It's very methodical and has a very good feel to it - It's also already pre-installed on the mac, and is cross-platform.

Check http://osx.fresmeat.net for python editors and packages, there are quite a few of them around that work on mac.
 

jamdr

macrumors 6502a
Jul 20, 2003
660
0
Bay Area
Java

Java is the best choice for a beginning programming language for a lot reasons that I'm not going to elaborate on right now. It's also a great language for a lot of other things, but for beginners it's really the only option. There is a reason almost all introductory cs courses are taught in Java nowadays.

Java and OS X is a mixed bag. On the plus side, Apple seems committed to Java because it comes preinstalled on every computer. However, historically Java releases on OS X lag behind Windows releases by years. And since Java 5 (the largest upgrade to the Java language since its first release) is going to go final soon, some recent Java software may not run on OS X. Personally, I think Java 5 is an abomination and completely ruins the language in some respects. But the truth is that if Sun releases a new version of Java, OS X needs to support it to keep up with Windows.

There is also the issue of performance. Java is a very fast language when it is run on Windows. The key word there is Windows. Java performance on OS X is less than exciting and Apple seems perfectly content with lagging behind Windows in yet another way. Now, I don't mean to give you the impression that Java is slow on OS X--it is plenty fast for most applications. But if you are creating huge, complex Swing GUIs or graphical games, you will see what I mean. And this is why Mac users generally have some aversion to Java, while Windows users have no such bias. Anyway, enough ranting. Now go learn Java.
 

Lyle

macrumors 68000
Jun 11, 2003
1,874
0
Madison, Alabama
blaster_boy said:
If all you want to do is bang out scripts, or start with that, why not try python. It's used by quite a lot of people, but it is not a compiled language (it pre-compiles itself, but not fully).
I'll second this, and throw in a recommendation for Ruby as well. Ruby also comes preinstalled on Mac OS X, and like Python, there are slightly fewer barriers to getting started as opposed to a compiled programming language like Java.

This is not a slam against Java, by the way; it's the language I use primarily at work. It's definitely a programming language that any professional software developer should be familiar with; I'm just not sure I'd recommend it as a first programming language for anyone.
 

caveman_uk

Guest
Feb 17, 2003
2,391
1
Hitchin, Herts, UK
First programming language - well mine was Sinclair Basic but I'd recommend a language that doesn't teach you bad habits. OOP is all the rage now so I guess Java is a good suggestion. For portability you can't beat C but it's hardly a beginners language. :rolleyes:
 

atif.muhammad

macrumors member
Oct 26, 2004
92
0
none of your business
caveman_uk said:
First programming language - well mine was Sinclair Basic but I'd recommend a language that doesn't teach you bad habits. OOP is all the rage now so I guess Java is a good suggestion. For portability you can't beat C but it's hardly a beginners language. :rolleyes:
yup i totally agree.
i tried to learn C, C++ and JAVA when i was 12 yrs old. i understood C until the bit where it got to arrays.
i've never ever understood C++ and JAVA particularly because of OOP. the books always introduced me to new concepts called inheritance or something like that. i was only 12 and didnt understand a sh*t about it. but reading through this thread has reignited my desire to learn Java now that im 16 yrs old and hopefully, i'll understand it better now. cheers people
 

mms

macrumors 6502a
Oct 8, 2003
784
0
CA
Sure you can go learn C++ or Java but another good place to start is perl or PHP. Plenty of fun and not so hard to learn. Granted, you won't be writing full-fledged apps with them, but scripting is a good introduction to computers.
 

Mechcozmo

macrumors 603
Jul 17, 2004
5,215
2
AppleScript
:D

Damn easy, works on any Mac... what else do you want? Oh yeah try this stuff out: tutorials are built in... ultra easy syntax... :D
 

HiRez

macrumors 603
Jan 6, 2004
5,805
1,699
Western US
I agree that Java is probably the best one to learn with.

1) You can do everything with a text editor (BBEdit is great for coding) and command-line tool from the Terminal. Later you can move to an IDE like XCode or NetBeans of course, but I think it's good to start with the very basics.

2) It's object-oriented and cleaner and safer than C++. There are no pointers that you can use for pointer math, which is a powerful feature in other languages but also a cause of many many bugs.

3) It has automatic garbage-collection of references when they're done being used (although honestly this can be a point of confusion later on when you use a language that requires more manual memory management).

4) It's cross-platform for just about any OS out there.

5) The most important argument for learning programming in Java is that the amount of offline and online resources you can get is staggering. There are literally hundreds and hundreds of Java books out there, and many online tutorials and Web/Usenet forums for asking for help with specific things. If you get stuck on something, someone will have an answer for you, usually within minutes or hours.
 

ChrisBrightwell

macrumors 68020
Apr 5, 2004
2,294
0
Huntsville, AL
jalagl said:
I would suggest Java. [...]
Ditto that. Java is good for a first language because you spend all your time in the JVM. It protects you from a lot of system-crashing mistakes (like calling an operation on a null pointer) and allows you to become a pretty good programmer since you spend more time focusing on logic rather than error trapping.

Once you get comfortable with Java, though, I'd strongly recommend C and/or C++.
 

therevolution

macrumors 6502
May 12, 2003
468
0
Python and Java are both good choices. Python might be a little more forgiving as a first language. Java/Swing is great for getting some exposure to GUI programming.

Of possible interest to you is ESR's take on the subject. Link goes to relevant section, but I think the whole document is a good read.
 

zimv20

macrumors 601
Jul 18, 2002
4,388
7
toronto
jamdr said:
Java [...] for beginners it's really the only option.
wow. i started off w/ BASIC and Fortran, and i turned out okay.

now i'm going to ask the question which should have been asked in post #2. Osirius -- what are you hoping to accomplish through programming?
 

northen

macrumors member
Jan 8, 2005
80
0
Aalborg, Denmark
C

The language of choice would clearly be ANSI C :)

Very clean and logical syntax, no unwanted abstraction, very well-supported and well-defined :)

And let us just make a few hello-world examples, just to see what you're going to fight with :)

Java
Code:
public class HelloWorld {
   public static void main() {
     System.out.writeln("Hello World");
   }
}
C
Code:
#include <stdio.h>
int main() {
   printf("Hello World\n");
   return 0;
}
C++
Code:
#include <iostream>
using namespace std;
int main() {
   cout << "Hello World" << endl;
   return 0;
}
Cocoa/Objective-C
Code:
#import <Foundation/Foundation.h>
int main() {
   NSLog(@"Hello World\n");
   return 0;
}
Python
Code:
print "Hello World\n"

Now, these examples aren't much good in reality, but they show off what the language is.

Even though C has some pitfalls in term of memory usage, they aren't that bad, and if you get -the- C book, by Brian Kernighan and Dennis Ritchie (the latter being the original designer of C), called `the C Programming Language` you will learn a lot in a very short time :) Besides, with the knowledge of C, you can quickly move on to Objective-C, Java and C++. Because of my C knowledge, I know those languages pretty well too. But I still prefer C for a lot of things, because of its speed, elegance and simplicity :)
 

Simon Liquid

macrumors regular
Jul 4, 2001
223
0
Iowa
Add to that:

Brainf•ck

Code:
++++++++[>+++++++++<-]>.<++++[>+++++++<-]>+.<+
+[>+++<-]>+..+++.++++[>++++++++<-]>.<+++++[>++++++++
++<-]>+++++.<<.+++.------.<+++[>---<-]>+.
 

TrumanApple

macrumors member
Jan 2, 2005
87
0
my 2 cents...

i had my intro to programming taught in Ada95 and i learned alot from it... it is very strongly typed so you develop great habits in thinking about data types and explicit type conversions... ada also forces you to keep very good track of actual and formal parameters...

Basicly for real world usage... ada is not really used anymore (cept DOD stuff, real time devices)... but its a great language to learn. Its much more important to learn how to program than it is to learn a language... a good programmer can learn a new language without a problem, so its more important to learn the basics of programming than it is to learn the syntax of a specific language...


but then again im a soph in college and i have only had 1 CS class so far (CS major), so maybe listen to more experienced programmers...
 

jsw

Moderator emeritus
Mar 16, 2004
22,819
40
Andover, MA
jamdr said:
Java is the best choice for a beginning programming language for a lot reasons that I'm not going to elaborate on right now. It's also a great language for a lot of other things, but for beginners it's really the only option. There is a reason almost all introductory cs courses are taught in Java nowadays.

Java and OS X is a mixed bag. On the plus side, Apple seems committed to Java because it comes preinstalled on every computer. However, historically Java releases on OS X lag behind Windows releases by years. And since Java 5 (the largest upgrade to the Java language since its first release) is going to go final soon, some recent Java software may not run on OS X. Personally, I think Java 5 is an abomination and completely ruins the language in some respects. But the truth is that if Sun releases a new version of Java, OS X needs to support it to keep up with Windows.

There is also the issue of performance. Java is a very fast language when it is run on Windows. The key word there is Windows. Java performance on OS X is less than exciting and Apple seems perfectly content with lagging behind Windows in yet another way. Now, I don't mean to give you the impression that Java is slow on OS X--it is plenty fast for most applications. But if you are creating huge, complex Swing GUIs or graphical games, you will see what I mean. And this is why Mac users generally have some aversion to Java, while Windows users have no such bias. Anyway, enough ranting. Now go learn Java.
I agree - Java is great. Many reasons have been given, and I agree with them all. To me, the single nicest part is the fact that Java GUI coding is both powerful and portable, a big plus compared to any other language. As far as non-GUI programming is concerned, I like a lot of languages (Java, C++, Objective-C, python, etc.) - but, for a beginner, Swing (Java's GUI stuff, essentially) is, I think, a big plus.

As far as OS X support: Tiger has Java 5 built in. That's a relatively minor lag, as it's barely been released on Solaris/Windows and certainly isn't the basis of any major apps yet. So, by late spring, say, OS X will be using Java 5.

Also, as a plus, OS X makes it very easy to use Java as part of an app based on Objective-C, so you can use Java when it's advantageous, then switch to Objective-C when it better suits your purposes.

However, regardless of language, the most important thing to learn while learning programming is how to approach the problem, something you'll work on regardless of language. A good programmer is a good programmer regardless of the language being used simply because that programmer uses good algorithms.

Edit: - just like TrumanApple wrote as I was replying.

But Java is pretty forgiving while being quite powerful, and it's got a stunningly good library of classes that will run on pretty much any platform you choose, automatically.
 

northen

macrumors member
Jan 8, 2005
80
0
Aalborg, Denmark
...and upon that

Simon Liquid said:
Brainf•ck

Code:
++++++++[>+++++++++<-]>.<++++[>+++++++<-]>+.<+
+[>+++<-]>+..+++.++++[>++++++++<-]>.<+++++[>++++++++
++<-]>+++++.<<.+++.------.<+++[>---<-]>+.
A very obfuscated language. I once coded an interpreter and compiler for a Brainf*ck-like language, which I called SIGI (Sigmund Freud's pet name :p, because it could make you insane :p)

Code:
aHpaepalppaopa pawpaoparpalpadpn0
:D

...or my new language, Psilo ;)

Code:
main, begin
var,message,string
assign,message,@"Hello World\n"
emits,message
exit,0
...or the C89/POSIX hello world

Code:
#include <stdio.h>
#include <unistd.h>

void print( void * str );

main() {
    pthread_t hello, world;
    char * strhello = "Hello ";
    char * strworld = "World";
 
    pthread_create(&hello, pthread_attr_default, (void*)&print, (void*)strhello);
    pthread_create(&world, pthread_attr_default, (void*)&print, (void*)strworld);

    exit(0);
}

void print( void * str ) {
     printf("%s", (char*)str);
}
:p

Of course, if you wanted to print it out in the correct order, you would need a mutex or spinlock of some sort :cool:
 

northen

macrumors member
Jan 8, 2005
80
0
Aalborg, Denmark
jsw said:
I agree - Java is great. Many reasons have been given, and I agree with them all. To me, the single nicest part is the fact that Java GUI coding is both powerful and portable, a big plus compared to any other language. As far as non-GUI programming is concerned, I like a lot of languages (Java, C++, Objective-C, python, etc.) - but, for a beginner, Swing (Java's GUI stuff, essentially) is, I think, a big plus.

As far as OS X support: Tiger has Java 5 built in. That's a relatively minor lag, as it's barely been released on Solaris/Windows and certainly isn't the basis of any major apps yet. So, by late spring, say, OS X will be using Java 5.

Also, as a plus, OS X makes it very easy to use Java as part of an app based on Objective-C, so you can use Java when it's advantageous, then switch to Objective-C when it better suits your purposes.

However, regardless of language, the most important thing to learn while learning programming is how to approach the problem, something you'll work on regardless of language. A good programmer is a good programmer regardless of the language being used simply because that programmer uses good algorithms.

Edit: - just like TrumanApple wrote as I was replying.

But Java is pretty forgiving while being quite powerful, and it's got a stunningly good library of classes that will run on pretty much any platform you choose, automatically.
The main problems with Java (at least how I see it) are:

- Lack of fast, low-level file handling.
- The JVM uses a lot of memory and doesn't start instantaneously; I wrote a simple HTTP server in Java and in C, and tested it on a standard 100 mbit/s network. The Java one delivered about 1 MB/sec and used 20 megabytes of memory. The C delivered 9 MB/sec and used 500 kilobytes.
- It enforces everything upon an Object-oriented programming paradigm, but still includes non-OOP basic types, which is very ambiguous to new users.
- Too much class supplanting. The StringTokenizer class has been supplanted at least 2 times, which is very confusing, because the language often changes too drastically at each major increment
- While usage of the language is free, the built-in classes are incompatible with the GPL, meaning you cannot link non-Java GPL'ed code modules to your Java program (which may still be licensed under the GPL)
- Is only available on major platforms. Platforms like the *BSD's have very poor Java support.