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

Brother Michael

macrumors 6502a
Original poster
Apr 14, 2004
717
0
Hey everyone!
Ok long story short I am getting a minor in Computer Science as such I am taking some CS Classes now and learning how to program.

I want to start using my iBook to program as well. I know I have to install XCode and I have been reading the online help about the Darwin project, however I am more than a little confused. Can anyone here re-explain in a nutshell what I need to install to do C/C++ programing (From what I gathered I only need to install XCode to run Java, Python, Perl and Ruby, am I wrong?)

Thanks a lot
Mike
 

earthtoandy

macrumors 6502
Jan 18, 2003
250
0
C++ eh? too bad your arent doing java... my university moved to java a couple years ago... seems like a good choice
 

broken_keyboard

macrumors 65816
Apr 19, 2004
1,144
0
Secret Moon base
Michael - the C/C++ compiler is a part of OS X even without XCode...

To compile the C program in the file my_prog.c, open a terminal and type:

gcc my_prog.c -o myprog

Then run the prog with:

./myprog
 

Brother Michael

macrumors 6502a
Original poster
Apr 14, 2004
717
0
broken_keyboard: Really? I didn't know that! Well then what is XCode for? Is it for the other programming languages?

earthtoandy: That's nice. There is talk in the upper management (?) area of the Computer Science department here abotu adding Java. Currently they have a class on VB and I was informed that if one knows VB Java isn't that hard to pick up on.

robbieduncan: Thanks! I am installing it now.

Mike
 

grapes911

Moderator emeritus
Jul 28, 2003
6,995
10
Citizens Bank Park
earthtoandy said:
C++ eh? too bad your arent doing java... my university moved to java a couple years ago... seems like a good choice

If your university stopped teaching c/c++, I feel sorry for you. All good programmers should know c/c++ or some other derivative. Java is usually a 2nd, 3rd, or 4th language. And, from my expirence in the real world, (and this is only an opinion) java is on its way out and c# is taking its spot.
 

jefhatfield

Retired
Jul 9, 2000
8,803
0
grapes911 said:
If your university stopped teaching c/c++, I feel sorry for you. All good programmers should know c/c++ or some other derivative. Java is usually a 2nd, 3rd, or 4th language. And, from my expirence in the real world, (and this is only an opinion) java is on its way out and c# is taking its spot.

C/C++ is usually the first language these days, with java or others as later languages

at my school, beginning programming is C++, and the advanced classes are java and visual basic...somewhere C# may enter the curriculum
 

broken_keyboard

macrumors 65816
Apr 19, 2004
1,144
0
Secret Moon base
Brother Michael said:
broken_keyboard: Really? I didn't know that! Well then what is XCode for? Is it for the other programming languages?

XCode is a fancy editing tool, it does color hightlighting of keywords etc, but it's not strictly necessary. You can just program in a plain text editor and then compile from the command line.

The other cool thing XCode has is the GUI designer. This lets you put together a GUI a lot faster than coding it by hand. Also XCode has a debugger, which lets you stop the program as it is running and change values of variables and restart it again, etc...

It's good stuff, but it's all optional. All you really need is a text editor and a command prompt...
 

Brother Michael

macrumors 6502a
Original poster
Apr 14, 2004
717
0
broken_keyboard said:
XCode is a fancy editing tool, it does color hightlighting of keywords etc, but it's not strictly necessary. You can just program in a plain text editor and then compile from the command line.

The other cool thing XCode has is the GUI designer. This lets you put together a GUI a lot faster than coding it by hand. Also XCode has a debugger, which lets you stop the program as it is running and change values of variables and restart it again, etc...

It's good stuff, but it's all optional. All you really need is a text editor and a command prompt...

Hmm, ok. My school uses Soloris UNIX and we do all the editing in either VI or Pico and then compile from the command line.

I suspect that creating a GUI is hard stuff, but is modifiying one something that a novice can tackle?

Mike
 

Gabriel

macrumors member
Sep 22, 2003
36
0
grapes911 said:
If your university stopped teaching c/c++, I feel sorry for you. All good programmers should know c/c++ or some other derivative. Java is usually a 2nd, 3rd, or 4th language. And, from my expirence in the real world, (and this is only an opinion) java is on its way out and c# is taking its spot.

Any CS student who understands concepts such as object-orientation ought to be able to pick up a specific language (either Java or C/C++) pretty quickly on their own. If a college's CS department is focusing on teaching you specific technologies at the expense of the more basic information and skills then they're wasting your time and money. Java is a better language for a CS 1 course because IMHO its cleaner and a better example of object-orientation than C++. The most popular computer organization textbook uses MIPS, an assembly language from about 1992. MIPS may not have a lot of practical use today, but its the best example of a reduced instruction set assembler out there.
 

Gabriel

macrumors member
Sep 22, 2003
36
0
Brother Michael said:
Hmm, ok. My school uses Soloris UNIX and we do all the editing in either VI or Pico and then compile from the command line.

I suspect that creating a GUI is hard stuff, but is modifiying one something that a novice can tackle?

Mike

Well, I suspect that you're going to be working in pure C++. When you write a program for a Mac using Carbon or Cocoa, Apple provides libraries that make creating a GUI pretty much as simple as dragging around bits and pieces in Interface Builder. First you have to learn how to use a general language like C++, then you have to learn how to use that the Apple API's. When you've accomplished that creating and modifying a GUI is simple.
 

iMeowbot

macrumors G3
Aug 30, 2003
8,634
0
Another important feature of Xcode (and perhaps the most important) is that it provides a replacement for the archaic makefile method of building Unix projects. Recent releases allow portions of compiled programs to be changed while running, restoring some long-lost functionality that was commonplace before Unix and other small-computer operating systems took over.

On learning the C family of languages: yes, that's still a very important set of skills to have, and it will be for a long time. If it's not a part of the core requirements, it is still an excellent idea to choose it as an elective, or even learn about them on your own if need be. Java can be a good applications language, but there are still large domains whrere it simply isn't a correct fit.
 

MacNeXT

macrumors 6502
Jun 21, 2004
258
0
jefhatfield said:
C/C++ is usually the first language these days, with java or others as later languages

at my school, beginning programming is C++, and the advanced classes are java and visual basic...somewhere C# may enter the curriculum

At my school we had JAVA before C++, and I think this is more convenient because C++ introduces some more complex concepts like real multiple inheritance, pointers/references and templates. JAVA is generally considered easier and friendlier than C++ wich is correct IMO.

Do they seriously teach Visual Basic after C++ at your school??????
 

jefhatfield

Retired
Jul 9, 2000
8,803
0
MacNeXT said:
Do they seriously teach Visual Basic after C++ at your school??????

they do, but it's probably more tradition than anything else...another tradition in programming is to do the "hello world" program

anyone can learn the basics of java, perhaps, but to master it to the level of java 2 certification is harder than achieving a bs in cs, and the java 2 cert is not even a degree, but can yield you twice the salary as a generalized bs degree in cs in silicon valley

the ccie certification, originally the basic tech training for a cisco sales rep, but now considered the top level of cisco techinical certification, is also not a degree, but starting salary for a cisco certified ccie is six digits...what is funny is that there are tons of techies out there who exit high school thinking that "college" would be too hard or too long for them and then go the six month to one year "certification" route, and end up making more money anyway than any college grad with a bachelor's degree ;)
 

grapes911

Moderator emeritus
Jul 28, 2003
6,995
10
Citizens Bank Park
Gabriel said:
Any CS student who understands concepts such as object-orientation ought to be able to pick up a specific language (either Java or C/C++) pretty quickly on their own. If a college's CS department is focusing on teaching you specific technologies at the expense of the more basic information and skills then they're wasting your time and money. Java is a better language for a CS 1 course because IMHO its cleaner and a better example of object-orientation than C++. The most popular computer organization textbook uses MIPS, an assembly language from about 1992. MIPS may not have a lot of practical use today, but its the best example of a reduced instruction set assembler out there.

I pretty much agree with you. (and i love MIPS by the way)

I don't really think it matters which language you learn first...but I think it is a catastrophe that they both aren't taught. If you know one, you should be able to learn the other pretty easily (I think most people would agree that). Students that are only exposed to one are being cheated. I believe that every CompSci student should learn C/C++ and Java/C# reguardless of the order. But this in just one man's opinion.
 

jcgerm

macrumors member
May 28, 2003
91
0
jefhatfield said:
they do, but it's probably more tradition than anything else...another tradition in programming is to do the "hello world" program

anyone can learn the basics of java, perhaps, but to master it to the level of java 2 certification is harder than achieving a bs in cs, and the java 2 cert is not even a degree, but can yield you twice the salary as a generalized bs degree in cs in silicon valley

the ccie certification, originally the basic tech training for a cisco sales rep, but now considered the top level of cisco techinical certification, is also not a degree, but starting salary for a cisco certified ccie is six digits...what is funny is that there are tons of techies out there who exit high school thinking that "college" would be too hard or too long for them and then go the six month to one year "certification" route, and end up making more money anyway than any college grad with a bachelor's degree ;)

First, CCIE certification doesn't have anything to do with software engineering. Go that route if you want to be a network admin or an IT guy.

Second, yes, Java certification is good to have, but without a college degree your chances of finding a job where you can actually use the certification are EXTREMELY small. Most companies won't even look at you if you don't have a college degree. You could probably name some people who have gotten these types of jobs without a degree, but the great majority of people will not.

No certification is a viable alternative to a BS in Computer Science. If you can't see that, then you don't know what CS is. It's not about how many languages you know or how many API's you have experience with. It's about software engineering. Programming is just one small part. Programmers are the bottom of the barrel. If you're a programmer, the only way to advance in a company is up. Programmers get promoted to management, and a lot of times companies require you to have an MBA to go that route. Sure, programmers make lots of money, but in management you'll make more.

Certifications aren't alternatives to getting a degree. They might supplement a degree, but with just a few certifications you're going to get a dead end job with very little hope for advancement.
 

jefhatfield

Retired
Jul 9, 2000
8,803
0
jcgerm said:
First, CCIE certification doesn't have anything to do with software engineering. Go that route if you want to be a network admin or an IT guy.

Second, yes, Java certification is good to have, but without a college degree your chances of finding a job where you can actually use the certification are EXTREMELY small. Most companies won't even look at you if you don't have a college degree. You could probably name some people who have gotten these types of jobs without a degree, but the great majority of people will not.

No certification is a viable alternative to a BS in Computer Science. If you can't see that, then you don't know what CS is. It's not about how many languages you know or how many API's you have experience with. It's about software engineering. Programming is just one small part. Programmers are the bottom of the barrel. If you're a programmer, the only way to advance in a company is up. Programmers get promoted to management, and a lot of times companies require you to have an MBA to go that route. Sure, programmers make lots of money, but in management you'll make more.

Certifications aren't alternatives to getting a degree. They might supplement a degree, but with just a few certifications you're going to get a dead end job with very little hope for advancement.

i hope you are right since i am investing in my graduate education in this high tech field at great expense

but having grown up in silicon valley and having seen who got the big jobs and who didn't, it's all about supply and demand

remember this field was largely built up by gates, allen, ellison, jobs, dell, etc...and oh, btw, none of these people even have a ba or bs

when i got my ba in hr, i worked for the govt in hr for programmers and IT support people who backed the pentagon...from what i saw, a cs degree was not the ticket, not even a foot in the door...having the right skill set for the right job was what we were trained to look for...at least for the military and civil service

i have been asked to teach cs at my college and i know most of the professors who teach there and only two have a cs degree, and phd's at that...but the school's hr officers want to right person with the right skill to teach a cs class, not someone with letters behind his/her name

other fields, like dentistry, medicine, nursing do require a directly related college degree by necessity or tradition...but high tech, it, and cs is very different...i am talking through my experiences as a techie and hr officer, and in the context of silicon valley/northern california so i am not saying it's like that everywhere in the world

there is no downside to getting certified and there is no downside to getting a degree...in my case i took both routes and what has really made computers worthwhile for me and my customers/clients has been my experience

if i do decide to be a cs professor, though the pay and hours suck, i would try and make the curriculum a little more relevant to the fast changing real world of high tech

after 25 years in the working field, some of it around high tech/computers, etc, i have found my experiences to be different from what you have mentioned but i do agree tha mba types make more than the computer geeks...but many high tech mba types do not have any technical background but usually a background in accounting and sales...when i was in mba school, the emphasis was on the bottom line and my school put more mba's into the high tech field than any school in the world and very few were engineers or computer scientists...but the mba is a good degree to have in high tech

i have one friend who was a ceo for a software firm and he tried to get the best education for his purposes...mba, cpa, mcse...and all those have greatly helped him be a young entrepreneur in the valley...he can't program a lick but he hired programmers for that stuff ;)
 

jcgerm

macrumors member
May 28, 2003
91
0
I never said you needed a CS degree to be CS professor. I've had several that don't. Also, I think you're getting backwards on what I said about getting an MBA. I know most MBA's don't necessarily have technical backgrounds, but to go anywhere WITH a technical background, you're probably going to need an MBA. And yes, it is about supply and demand. But if you compare two people for entry level positions, both with the same technical skills, only one has a degree and the other several certifications, the one with the degree with be hired over the other.

What you saw over the years were most likely people with a lot of work experience. Getting your foot in the door is the hardest part and without a degree I would say it's nearly impossible. The degree stands as more of a requirement for most people. Once a company sees that, THEN they'll look at your experience.

As for gates, allen, ellison, jobs, and dell etc...these are perfect examples of people who are exceptions. The vast majority of people are not like these guys and will not succeed in the same way. Plus, they're not engineers, they're businessmen.

So overall, I'm talking about people getting started in the industry. Experience is definitely the key, but without a degree it's VERY hard to break in.
 

MacFan26

macrumors 65816
Jan 8, 2003
1,219
1
San Francisco, California
My university starts off with Java in the intro classes and is fairly Java focused but also has a number of classes in other languages. For the people who keep saying Java isn't going anywhere and won't be dominant in the future, where are you getting this? I've only heard the opposite about it, and not just from teachers who happen to like it, but people from industry as well.
 

grapes911

Moderator emeritus
Jul 28, 2003
6,995
10
Citizens Bank Park
MacFan26 said:
My university starts off with Java in the intro classes and is fairly Java focused but also has a number of classes in other languages. For the people who keep saying Java isn't going anywhere and won't be dominant in the future, where are you getting this? I've only heard the opposite about it, and not just from teachers who happen to like it, but people from industry as well.

While java is being used more and more, so is C#. C#, although much less popular than java, is growing at a much larger percent. Many large university are considering switching their java courses to c#. (notice I said considering, because many have not switched.) I had an internship last summer and a requirement for the job was java. When I got there we acutally didn't use java at all, rather we used c#. They are so similar most people don't know the difference. I asked around and did some research and found out that many professors of the top universities are now perfering c#. Just remember, predicting what languages will be the dominant ones are only opinions and should be treated as such.
 

Brother Michael

macrumors 6502a
Original poster
Apr 14, 2004
717
0
The terminal is coming back at me saying that "gcc" doesn't exist.

Any ideas? Need any more info about the system?

Mike

EDIT:

roam-95-241:~/documents/programs mike$ gcc hello.cpp -o myprog
-bash: gcc: command not found
 

jefhatfield

Retired
Jul 9, 2000
8,803
0
jcgerm said:
I never said you needed a CS degree to be CS professor. I've had several that don't. Also, I think you're getting backwards on what I said about getting an MBA. I know most MBA's don't necessarily have technical backgrounds, but to go anywhere WITH a technical background, you're probably going to need an MBA. And yes, it is about supply and demand. But if you compare two people for entry level positions, both with the same technical skills, only one has a degree and the other several certifications, the one with the degree with be hired over the other.

What you saw over the years were most likely people with a lot of work experience. Getting your foot in the door is the hardest part and without a degree I would say it's nearly impossible. The degree stands as more of a requirement for most people. Once a company sees that, THEN they'll look at your experience.

As for gates, allen, ellison, jobs, and dell etc...these are perfect examples of people who are exceptions. The vast majority of people are not like these guys and will not succeed in the same way. Plus, they're not engineers, they're businessmen.

So overall, I'm talking about people getting started in the industry. Experience is definitely the key, but without a degree it's VERY hard to break in.

what you say can very well be the case today...remember that i am probably 15-20 years older than you and in those days, the olden days ;) , the computer industry was relatively new in a big, corporate sense...the demand was huge and there weren't enough people to fill the positions but people with experience were needed for the jobs...a degree usually didn't do because it was usually computer theory but the geeky computer hobbyists actually knew a lot more of what was needed to make a company go to the next step

the key high tech people i mentioned were not the exceptions, but the role models and there were literally tens of thousands, if not more, out of high school or college dropouts who entered the high tech field and built it up...medicine, law, academia, dentistry and many other disciplines simply would not have these non degreed people due to their lack of a couple or three letters behind their names but high tech opened their arms and let them in

in all the years i have worked in and around the silicon valley, i have met only one person with a cs degree...one...and i am 40 and have worked since i was 15...even some during college to keep honest ;)

...a few classes in this and that totalling to a 4 year cs degree are not good if you don't keep your techie skills up but poeple who like to program and tinker with electronics/computers remember what is needed when the day comes for them to hit the ground running in a job...many of the computer scientists/programmers i met were hired right out of high school or majored in something besides computer science....but they always kept their skill set up because they liked it....the cs majors i knew were almost always in it to "get a cs degree as fast as they could" and as soon as they finished a language, that was it...in one ear and out the other :)

the companies i worked for or know of hire computer scientists/programmers who know and like their craft and those companies go out of their way not to hire cs majors because they have been disappointed too many times with cs theory heads who didn't keep up their skills...you have to love it to excel in any high tech endeavor and the pursuit of high tech knowledge for the pure task of it, which is better than a kid who studies cs because they want a j-o-b

as for the mba types in companies:

many engineers move up a company ladder and finally end up at a crossroads in the rung of management... some get mba's, but most don't find management, marketing, accounting, and sales to their liking so they step back down...techies and businessheads are very rarely the same people...and thank god to that ;)

that being said, it is not a waste of time to get a degree or a certification...but like what you are doing, practice your craft all the time before, during, and AFTER college, and get experience...even us hr managers or hiring mba's know the difference between a competent computer person and one who collects letters behind his name...in the high tech field, experienced workers call those people "paper tigers" ;)

many old, wise people, from day one, make the distinction between the ivory tower of academia and the real world...in no place is this more relevant than high tech in silicon valley
 

yellow

Moderator emeritus
Oct 21, 2003
16,018
6
Portland, OR
Brother Michael said:
The terminal is coming back at me saying that "gcc" doesn't exist.

Any ideas? Need any more info about the system?

Mike

EDIT:

roam-95-241:~/documents/programs mike$ gcc hello.cpp -o myprog
-bash: gcc: command not found

Mainly because the dude who posted earlier saying you didn't need XCode was mistaken. gcc 3.3 is installed as part of XCode. Do yourself a favor and download XCode 1.5. gcc lives in /usr/bin/
 

Brother Michael

macrumors 6502a
Original poster
Apr 14, 2004
717
0
yellow said:
Mainly because the dude who posted earlier saying you didn't need XCode was mistaken. gcc 3.3 is installed as part of XCode. Do yourself a favor and download XCode 1.5. gcc lives in /usr/bin/

Ok I just decided to spend the gig and installed XCode...If that is overkill, then I will just remove the XCode and Interface Builder...I mean I can do that right?

Anyways, I built my first program simple hello world.


#include<iostream>

int main()
{
cout << "Hello World!";

return 0;
}


Pretty sure that is all I need right? I mean I compiled it with "gcc" and it didn't like my "cout" command. Alright this program is stored in "~/documents/programs" so that I know where they all are. Is this a problem? Can my compiler not locate my "iostream" library? For 1.5 gig of an install for XCode I better have a simple input output library...

Keep in mind though I have never programmed before and even though I am fimiliar with UNIX through using Linux, I am very much a novice...

Mike
 

broken_keyboard

macrumors 65816
Apr 19, 2004
1,144
0
Secret Moon base
Brother Michael said:
#include<iostream>

int main()
{
cout << "Hello World!";

return 0;
}


Pretty sure that is all I need right? I mean I compiled it with "gcc" and it didn't like my "cout" command. Alright this program is stored in "~/documents/programs" so that I know where they all are. Is this a problem? Can my compiler not locate my "iostream" library? For 1.5 gig of an install for XCode I better have a simple input output library...

Mike

If gcc was installed as part of XCode then sorry, I thought it was part of the standard install.

Regarding your question, since your prog is C++ you should use g++ instead of gcc, i.e.

g++ hello.cc -o hello
./hello
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.