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

Hinsight4

macrumors newbie
Original poster
Jul 15, 2005
11
0
I was reading some online tutorials on MacDev Center and followed an article setting up an app to use tar (ruby-cocoa based). Anyway, what language should I invest my time in if I'm going into computer science? I see a lot of talk about C, C++, objective-c etc, but what one should I choose? I don't want to learn cocoa exclusively because I'm sure the classes I'll take will focus on Windows, so I don't want to tie myself down from the start. I know this is an opinionated subject, but thanks for the advice!

Matt
 

notjustjay

macrumors 603
Sep 19, 2003
6,056
167
Canada, eh?
Java seems to be the de facto standard for learning languages - particularly at my university, anyway.

Java is very similar to C++, syntax-wise, and you'll have little difficulty learning one if you know the other. However, Java simplifies a lot of the things that can be tricky in C++, especially to a beginner, such as pointers, function prototyping, debugging (with its detailed traces), etc. The language library is HUGE and provides tools for doing all kinds of things (data types, communications, GUI stuff, etc).
 

Toreador93

macrumors regular
Sep 14, 2003
190
0
My college is mostly C++. Java is okay for some applications, but if you're writing big software, you'll probably be writing it in some kind of C-variant.

C++ is more advanced than C, thus will be used more. I'm not sure, but I think objective C is easier, but you won't learn the ins and outs. C# is a Microsoft variant. Once you learn one language, it's pretty easy going to another. But I think C++ will be more helpful in the long run.
 

khammack

macrumors regular
Sep 28, 2004
166
0
Portland, OR
If you're talking about getting a CS degree, you need to learn several languages representing a wide variety of programming styles.

Learn C (not C++). Do this whenever, but before C++. Don't learn C++ yet.

Learn an Object oriented language (not C++), like Java or Common Lisp. Yes, Common Lisp.

Once you've learned some other proper object oriented language (not C++), then learn C++. Do this only after you understand what Object oriented programming is. Otherwise, it'll make little sense (especially if you learn pure C first, which you ought to do).

Learn a purely functional language, like Scheme. Learn it. You may find this more difficult if you already know something else; some CS degrees teach Scheme as their first programming language. If you want to start with Scheme, try http://www.drscheme.org. It runs on Windows/OSX/Linux.

Learn a high level scripting language like Perl or Python (or both).

What order you learn them in is up to you. As a disclaimer, and so you can understand where I'm coming from, I'll summarize my relationship to programming:

I started with basic in the early 80's, moved on to FORTRAN, then Pascal, then C, then C++ (didn't get it), then Java (AHA! So that's OO programming), then Scheme, then C++ properly, then Perl, then loads of others and I lost track at over 20.

I rotate between Linux, OS X, and WinXP on a daily basis (though ever more rarely do I use Windows). In my current job I don't write apps, I write lots of small programs crafted for analysis of whatever problem I'm working on. Also I write stuff that updates static web pages and the like. I get the most mileage out of Python, with some Scheme thrown in.

I use C/C++ for device drivers or other low level programming. Also it's used for simulation at our company so I mess with it a bit there.

-kev
 

Whyren

macrumors 6502a
I'm not an expert here or anything, but I'd suggest starting with an "older" language first, such as C or C++. The biggest thing in computer programming is understanding algorithms and breaking down tasks into "either-or" situations. Beyond that, it's just syntax and language-specific rules. Starting with older languages, you have more rules you have to follow. More recent language, like Java, allow you to bend the rules more to make things easier. If you know the trickier way first, it just gets easier from there. Just like doing standard deviation by hand, then figuring out your calculator can do it in a few button presses (confound you Probability/Statistics teacher!).
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
Whyren said:
The biggest thing in computer programming is understanding algorithms and breaking down tasks into "either-or" situations. Beyond that, it's just syntax and language-specific rules.
Until you bump up against the differences between writing object-oriented code and procedural code, eg. There are fundamental differences in the design philosophy of each language that you'd do well to try and notice as you learn them.
 

khammack

macrumors regular
Sep 28, 2004
166
0
Portland, OR
Whyren said:
I'm not an expert here or anything, but I'd suggest starting with an "older" language first, such as C or C++. The biggest thing in computer programming is understanding algorithms and breaking down tasks into "either-or" situations. Beyond that, it's just syntax and language-specific rules. Starting with older languages, you have more rules you have to follow. More recent language, like Java, allow you to bend the rules more to make things easier. If you know the trickier way first, it just gets easier from there. Just like doing standard deviation by hand, then figuring out your calculator can do it in a few button presses (confound you Probability/Statistics teacher!).

You're talking about what I call the "bottom-up" approach, which has merit. But I don't agree that it's the necessarily the best approach.

Personally, I recommend the "top-down" approach; start with a very high level language like scheme, perl, or python before learning C. Java isn't quite in the same class as the others. It's not as tedious as C, but it still isn't in the same class as scheme / perl / python.

Many university CS curriculums now use Scheme in their "Intro to programming" course. Of course, many also begin with C. Clearly, there is widespread disagreement on which approach is best.

I'm not saying the bottom-up approach is wrong, but I wouldn't say it's better either. The most important thing to do is just pick something that appeals to you and get started.

-kev
 

plinden

macrumors 601
Apr 8, 2004
4,029
142
I followed a similar track to khammack in learning programming languages (BASIC first, then FORTRAN, C, a sidetrack into Parallel C for transputers, C++ started then abandoned, Java, and back to C++. Java taught me all I need to know about Object Oriented programming.

But, knowing what I know now, I would have learnt an OO language first (ie. Java). I found I had to unlearn all the bad habits I picked up with the procedural languages before I was effective in Java or C++.

However, although Java is easy to use, it's hard to use properly. You get hit hard by performance bottlenecks if you don't know the workarounds.

I think I would have found it more enlightening to learn basic OO concepts before even starting to program. But that's just me. Some people seem to find the opposite is more effective.
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
I think I would have found it more enlightening to learn basic OO concepts before even starting to program. But that's just me. Some people seem to find the opposite is more effective.
An important consideration is: what kind of programming are you planning to pursue? If someone is hoping to get into embedded code, or intense graphics applications, low-level coding would be a great start. However, if you expect to write desktop user apps, especially using some flavor of RAD, you would probably do better getting used to OO, first.
 

khammack

macrumors regular
Sep 28, 2004
166
0
Portland, OR
logicat2001 said:
An important consideration is: what kind of programming are you planning to pursue? If someone is hoping to get into embedded code, or intense graphics applications, low-level coding would be a great start. However, if you expect to write desktop user apps, especially using some flavor of RAD, you would probably do better getting used to OO, first.

This is a good point. Programming isn't about knowing languages, it's about writing programs. The type of program you want to write will drive the sort of language that you will use to write it.

Start with a modest programming project, then choose a language that you think would be appropriate.

Then, reimplement that program in another language.

I have a handful of very simple programs that I use to get familiar with new programming languages. When learning something new, I start with these:

1) Print "Hello" to the screen.

2) Do some sort of text processing. For example, I always do the same thing, read 2 files like these:

file1.txt:
A1 one # comment
B2 three # another comment

file2.txt:
A1 one # different comment
B2 two
B3 three

And print the differences. The output for the above would look like:
"B2" is "three" in "file1.txt" but it is "two" in "file2.txt"
"B3" is not defined in "file1.txt"

Treat # signs as comment markers; Ignore the # sign and everything after it.

3) Finally, for graphics programming I implement a mandelbrot viewer / explorer program. It's simple to implement, but requires graphics and number crunching that can take a lot of time (which exposes you to performance issues) and can easily cause you to run into numbers so small that the computer can't deal with them (so you have to as a programmer). You can get loads of mileage out of this one actually, you don't need graphics at first, you can just create a .png file (which requires that you learn entirely different aspects of the library / language).

For an explanation of how to compute the mandelbrot set, look here: http://www.ddewey.net/mandelbrot/

Of course, you probably want to make something different. Those were just examples.

-kev
 

Hinsight4

macrumors newbie
Original poster
Jul 15, 2005
11
0
Thanks for all of your responses everyone. I was torn between Java and maybe Objective-C, and after googling a bit decided that I like Objective C better (I just like the syntax a little better I guess, Java seems angry :) Might not be a great reason, but I finally found a decent book for Cocoa and Objective-C and that's what I'm working on right now. Granted I'll have to learn other languages etc later, but I'll have something to start with and I'll have some idea of coding. So thanks again!

Matt
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
Hinsight4 said:
Granted I'll have to learn other languages etc later, but I'll have something to start with and I'll have some idea of coding. So thanks again!
Matt,

Glad to hear you're jumping in; there's really no other way to do it. Just as an example, I've been happily coding with Cocoa in Obj-C and having a great time.

However, my current project has me digging in to low-level C in order to extract raw binary data from a third-party file format. What I found has led me to learning about Pascal strings, which required me to figure out how to convert between Pascal and C-strings. Then I realized I had to learn about OSTypes and FSSpecs in order to complete this app.

Just gotta stay nimble...
Enjoy the ride,
Anton
 

prophet621

macrumors member
Jul 31, 2005
86
0
What does it mean when people talk about Python or Perl as a very high level languages?

I've been meaning to pick up Python but have just been so tired and drained from work and life that I can't concentrate or remember anything so I haven't really done anything with it.

I picked Python because from my understanding it's a very clean and somewhat easy to pick up but still has some power behind it.
 

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
prophet621 said:
What does it mean when people talk about Python or Perl as a very high level languages?

I've been meaning to pick up Python but have just been so tired and drained from work and life that I can't concentrate or remember anything so I haven't really done anything with it.

I picked Python because from my understanding it's a very clean and somewhat easy to pick up but still has some power behind it.
The "higher-level" the language, generally the more you can do with less code, and the libraries of functions you can call are usually larger. Syntax tends to be more readable with higher-level languages. The downsides are that performance is not as good as lower-level languages, and you lose some control (many high-level languages "buffer" you with "sandboxes" to protect you from doing anything really bad).

Python is an excellent general-purpose scripting language, by the way, easily my favorite. I never liked Perl. Perl is powerful but its syntax really turns my stomach. If you want to do web programming, I would recommend PHP as a fairly high-level language.
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
Another way to say it is that high-level languages have more layers of abstraction between what's actually being accomplished with bits and your hardware. These layers of abstraction allow you to code with, e.g.:
  • GUIWindow *myWindow;
    point1 = (0,0);
    point2 = (400,400);
    makeWindow(point1, point2);
This code (which isn't real code) would presumably allow you to create a new window at the screen that is 400 pixels high and 400 pixels wide, starting at screen location (0,0). The instructions you need to write, as a programmer, are really simple and quite easy to understand just by reading it. That's high-level.

If you were using a low-level language, e.g. you might be required to custom write every single routine or function that would drive your video card hardware to fill particular pixels in, one by one, then finally render it on your screen. That's low-level.

The beauty of using pre-existing code libraries or frameworks, or of using a high-level language, is that the hard-core code that actually makes this stuff run is hidden. It helps keep code more consistent, it saves everyone the work of re-inventing the wheel every time they want to accomplish something, it typically makes it easier to debug, and definitely makes your own code easier to read. This makes a huge difference as your coding projects grow in size and complexity.

BTW, one of the reasons/benefits of Object oriented programming is to allow for high-level code using lower-level components. You learn how to structure your own programming into a model that's much easier to work with, even though typically it'll run a bit slower. In my current work, I'm using Cocoa w/Obj-C; the Cocoa frameworks are definitely high-level. However, I can freely intermingle any C code, libraries or system calls at whim. It gives me the best of both worlds.

Best,
Anton
 

ham_man

macrumors 68020
Jan 21, 2005
2,265
0
C

Java is a bloated P.O.S. I hate nearly all programs written in it. Hate.

And C++ is a bit too much for a beginner...
 

Heath

macrumors regular
Aug 19, 2005
133
0
Canada
Java

ham_man said:
C

Java is a bloated P.O.S. I hate nearly all programs written in it. Hate.

And C++ is a bit too much for a beginner...


Java isn't that bad, and it gives a good handle on object oriented principles.

Java -used- to be bloated and poorly performing but it has caught up in leaps and bounds recently.

Of course all these performance issues are moot when you have a lousy programmer trying to use them! :)

I'd recommend Java, Python for object oriented learning and C for lower level learning.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.