Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

eyeluvmyimac

macrumors regular
Original poster
Oct 27, 2002
229
1
do any of you program? i want and need to get started learning, how do I get started?

I dont want to spend any money either.

I was told i should write it in text edit and download gcc somewhere. Is this correct? and where could I find it?

Thanks for your help!
 

alset

macrumors 65816
Nov 9, 2002
1,262
0
East Bay, CA
You can register as an Apple Developer, entitling you to the free download of Apple Dev Tools. This will include a C compiler and other nifty tools.

Search Google for "C Tutorials" or "Programming Tutorials." Through in the word "Mac" if you don't find anything specific to your work. Also, check the Apple Knowledge Base and Developer forums.

Then again, cough up some cash and get a good book at your local store. The best things in life take sacrifice, so expect to pay a good $50 and then do it with a smile.

Dan
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
Well, since you have textedit, you have OSX. OSX comes with a fairly nice development toolset (if you pirated OSX, you're probably out of luck, but you can check in /Applications/Installers). It should be on the grey developer tools cd. It comes with a bunch of tutorials, but if at all possible, you should get a book. OSX doesn't use C++ (unless you want to do carbon or non-GUI programming), but Objective-C is quite nice. I'm currently working on an Objective-C/Cocoa project with my brother. I got started programming in Object LOGO from a book, switched to BASIC, then took a week long class in C++. I picked up C++ from books and a few classes for a while, then switched to Java (MUCH friendlier). After I learned some Java, I got interested in making a game in Cocoa (Java's really too slow for games) and started to learn Objective-C by checking a book out of my local library. I recently bought "Learning Cocoa with Objective C" from Amazon, and can recommend it (although it assumes you already know some C. Java and C++ should be similar enough that they'll work as a base too). I'm also taking a programming class at school (I'm a junior in high school), but it really sucks because we have no budget and not enough teachers.

<edit> I just reread your post. Whatever you do, DON'T program in Textedit. It's annoying beyond belief once you get above a few hundred lines of code. I had to use it when the dev tools were borked on my machine. Use Project Builder (part of the dev tools) instead. </edit>
 

lmalave

macrumors 68000
Nov 8, 2002
1,614
0
Chinatown NYC
Java

Hmmm...I don't recommend learning C++ as a first language - it's a bit hairy. But if you really want to learn modern object-oriented programming, I would learn Java instead. Apple has great support for Java, and the Apple Developer Tools mentioned above have support for Java as well.

I would start with the Java Tutorial on Sun's website: http://java.sun.com/docs/books/tutorial/

It's how I learned to program Java about 7 years ago (and I've now been a professional Java programmer for the last 6 years). It's an oldie but still a goody.

In terms of text editor, any will do for simple Java programming. Text Edit is fine but it won't do Java syntax highlighting. I use a Cocoa-native version of Emacs, but that might be too complicated for a beginner. I would just download an eval version of BBEdit good for 30 days - that'll definitely work, and in the meantime you can try to find a good freeware Java editor.
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
Re: Java

Originally posted by lmalave

In terms of text editor, any will do for simple Java programming. Text Edit is fine but it won't do Java syntax highlighting. I use a Cocoa-native version of Emacs, but that might be too complicated for a beginner. I would just download an eval version of BBEdit good for 30 days - that'll definitely work, and in the meantime you can try to find a good freeware Java editor.

Like Project Builder? JEdit is OK too, but it kinda bugs me (perhaps it's Win2000 that's bugging me, but I think it's at least partially JEdit's fault). I do wish Project Builder would get that autocompletion thing that some IDEs have. I never really figured it out when I had access to it, but I think I could really use it now.
 

benjaminpg

macrumors regular
Apr 21, 2002
113
0
Salt Lake City, UT
I would highly recommend REALbasic, by RealSoftware, found at http://www.realbasic.com. I realize that you don't want to spend any money, but I still recommend you at least consider it. You can download a 30-day demo version, and try it out. If you are planning to do GUI, this is much better than C++, because you don't have to lay it out in code. Simply drag controls to windows, similar to Interface Builder.

In general though, the code is simpler than Cocoa, and there are not two separate applications, Interface Builder, and Project Builder. This means there is a more visible link between the code and the GUI.

I would recommend doing the supplied tutorial to build a very simple word processor. It has about the same features as the old SimpleText. To demonstrate the efficiency of it, the tutorial is written in about 200 lines of code, where SimpleText is written in about 20,000 lines of C++ code. This is a HUGE difference.

One of the other huge features of REALbasic is that it features awesome autocompletion. This insures that things are spelled correctly, and is also useful if you cannot remember the exact name of something. If you know the first couple letters, you can very easily figure out the rest. If you have typed at least one letter, you can hit tab, and it will provide a list of all the possible commands, starting with that letter.

If you do decide to use REALbasic, one of the best ways to learn is to subscribe the mailing list. Everyone on the list is extremely helpful and will provide help, no matter the complexity.

Note: I am not affiliated with RealSoftware, just a very happy customer.
 

macktheknife

macrumors 6502a
Jan 24, 2002
639
0
Apple comes with some great developer tools you can download. Here are some threads with questions from other Macrumors members on learning to program. Check them out:

C++ Programming on OS X

C Programming on OS X

More C Programming on OS X

Apple's Developers Tools

BTW, I had started learning to program a few months ago, and my efforts finally bore fruit when I passed my Sun Certified Java Programmer exam (see discussion here). I'm a financial analyst who majored in History back in college, so if I can do it, so can you. Good luck!
 

Einherjar

macrumors regular
Jan 6, 2003
115
0
Also, be sure to invest in a copy of Metrowerks' CodeWarrior for OS X. Great development environment once you get good enough with your code--plus with CodeWarrior, it's very easy to port code over to other platforms, at least from what I've heard.
 

Nipsy

macrumors 65816
Jan 19, 2002
1,009
0
Originally posted by benjaminpg
re: REALBasic:
If you are planning to do GUI, this is much better than C++, because you don't have to lay it out in code. Simply drag controls to windows, similar to Interface Builder.

REAL Basic is easier than hard coded c (or derivatives), but by no means better. It is easy to do simple tasks in REALBasic, and has a shallow learning curve, but is not a good solution for serious development. It has problems with memory leakage, and is quite slow (comparatively).

Well written c (or deriatives) will consistently yield faster, more efficiecnt code.

If you're going to learn programming you need to understand the c syntax and object model, as they form the basis of many high level languages (Java, c, c++, obj-c [less so], JavaScript, PHP) are all similar in syntax and object referencing.
 

benjaminpg

macrumors regular
Apr 21, 2002
113
0
Salt Lake City, UT
Originally posted by Nipsy
REAL Basic is easier than hard coded c (or derivatives), but by no means better. It is easy to do simple tasks in REALBasic, and has a shallow learning curve, but is not a good solution for serious development. It has problems with memory leakage, and is quite slow (comparatively).
I suppose it depends on your definition of better
;). My definition of better is that it is easier to create moderately complex applications. One of the most common misconceptions of REALbasic is that it can only do simple tasks. In fact very complex applications can be written in it.

It is slower than most C derivatives, however, for algorithms that must be executed quickly C code can be wrapped into a plugin, which can then be used in REALbasic.
Well written c (or deriatives) will consistently yield faster, more efficiecnt code.

If you're going to learn programming you need to understand the c syntax and object model, as they form the basis of many high level languages (Java, c, c++, obj-c [less so], JavaScript, PHP) are all similar in syntax and object referencing.

REALbasic is an object-oriented language. In fact, right now I am learning Java, and I am amazed at how many similarities I keep finding.

One of the main advantages of C derivatives, not including Objective-C is that they are extremely cross-platform, and are free. REALbasic currently compiles for Windows, Classic Mac OS, and Mac OS X, but not any other forms of Unix.
 

ddtlm

macrumors 65816
Aug 20, 2001
1,184
0
Einherjar:

Also, be sure to invest in a copy of Metrowerks' CodeWarrior for OS X. Great development environment once you get good enough with your code--plus with CodeWarrior, it's very easy to port code over to other platforms, at least from what I've heard.
Why do that when Project Builder is free, and works great? I really like Project Builder. It made me stop using Nedit on Linux for some things, and that says a lot. I do wish it had customizable text highlighting like Nedit though.

I've used Codewarrior and I still use Visual C on Windows... Project Builder is tops, says I.

lmalave:

Hmmm...I don't recommend learning C++ as a first language - it's a bit hairy. But if you really want to learn modern object-oriented programming, I would learn Java instead. Apple has great support for Java, and the Apple Developer Tools mentioned above have support for Java as well.
I second this.

Java is pretty good and has widespread uses. C/C++ is for speed, Perl is for scipts, and PHP is for web pages. All other languages are for background noise.
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,728
1,901
Lard
I really wouldn't suggest using MetroWerks CodeWarrior unless you have money to burn. It has a capable IDE and excellent compilers but after that, it really falls down. Still, it's as good as Borland C++ was in 1993, if you're only doing C and C++. CodeWarrior does Java and it does GUI Java better than it does GUI C/C++.

C++ isn't a bad language if you water it down by leaving out operator overloading and templates, which make it truly difficult to port code to Java.

Objective-C is a much better O-O language than Java (primitives data types in an O-O language?) or C++ (static runtime) and is available wherever you find gcc.
 

jaykk

macrumors 6502a
Jan 5, 2002
854
5
CA
Good news if u want to try CodeWarrior

Metrowerks offers its CodeWarrior Development Studio v8 for Mac OS X for $99. That's $300 off the regular price. Offer ends February 28, 2003.
I think Mac OS X is going to be the best development platform ever :)

CodeWarrior
 

gallenx

macrumors newbie
Jan 28, 2003
6
0
Learn C instead

A lot of people tend to tell you to learn Java, Real Basic, or C++ to start out. I really have to disagree. If you plan on programming in the future and want to learn a lot of languages, C is the best choice.

So many languages are based on C (Obj-C, Java, Perl, C++, etc), that learning C makes learning those much easier. I don't know C++, and my Perl experience is minimal, but due to my good understanding of C, I learned all of Obj-C in two afternoons, and most of Java over the weekend. I was also able to make some small open-source contributions in C++ just based off of my ability to read C code and extrapolate C++ syntax.

I recommend learning C, then Obj-C, and then Java. Obj-C is a small extension to C that's pretty easy to learn. Java was influenced heavily by Obj-C, even though its syntax is more like C++, so most of the concepts you pick up from Obj-C will help you along there.

Here are some resources you might find valuable:

The New C Primer Plus ($25 at half.com)
This is the best computer book I've ever read. It's just absolutely incredible. Great for a programming beginner or even experienced programmers learning C. Covers lots of important programming concepts, and really does a thorough job at teaching C in an easy way. My brother had lots of trouble in his computer class, and this really helped him a lot.

Object-Oriented Programming and the Objective-C Language
Whatever object-oriented language you're learning, read Chapter 2 of this book. It has a good explanation of most relevant object-oriented concepts.

Bruce Eckel's Free Online Programming Books
Thinking in Java and Thinking in C++ are on here for free. You can buy them if you really want, but that would be $40 that you'd spend needlessly. I've heard great things about these two books, but never read them myself. Hell, even if they suck, they're free, so they're worth a look.

The Java Programming Language
Written by the creators of Java. It's a good book if you read Chapter 2 in the book above and you know how to program. Else, it's too sparse of examples to really be helpful.


Also, check out Apple Project Builder. It's free and does most of what people want for C, Obj-C, Java, and C++. If you decide to learn Java, you can also download Borland JBuilder Personal for free.

Anyway, hope that helps.

-Prachi
 

lmalave

macrumors 68000
Nov 8, 2002
1,614
0
Chinatown NYC
Re: Learn C instead

Originally posted by gallenx
I recommend learning C, then Obj-C, and then Java. Obj-C is a small extension to C that's pretty easy to learn. Java was influenced heavily by Obj-C, even though its syntax is more like C++, so most of the concepts you pick up from Obj-C will help you along there.

I learned C and C++ before learning Java (Lisp was actually my first language), but I still think Java is a much better learning language. Sure, the Java syntax came from C, but that't precisely the point, Java is a *simplified* form of C in many ways. No header files, no having to allocate memory, etc. And you can still learn basic functional programming before moving on to object-oriented concepts - just put all your code in a single class - the class has a main() function and you can just use the class's methods the same way you would C functions. Any Java tutorial for beginner programmers will start with basic programming concepts anyway.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.