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

which should i learn first?

  • Java

    Votes: 28 50.9%
  • C++

    Votes: 19 34.5%
  • Give UP!!!!!

    Votes: 8 14.5%

  • Total voters
    55

afornander

macrumors 6502
Original poster
Apr 5, 2006
286
0
im a sophomore in high school and would have tried learning to code many times, i have tried C++, C, and a little java. every time i try to learn, i loose focuse on learning after 2-3 days.... i want to learn to code, and i want to enjoy it, please tell me how i can do this!:eek: :confused:


1. should i start with C++, or java?
2. how can i help myself focus on learning more?
3. where can i find some free (full) tutorials on learning C++, or java (depending on witch i should learn first, preferably based specially for mac)

4. any other tips
 

PrOeliuM

macrumors member
Jul 31, 2005
30
0
1. I'd say C++.

2. The best way to focus on learning more is to keep yourself working at it. If you're using a book to learn from, try to complete ALL of the examples at the end of each chapter. They will seem trivial and pointless, but through repition you should become more and more familiar with concepts. It is also a good way to keep from "getting in over your head" by starting out with too lofty a goal.

3. If you type in simple strings like "c++ tutorial" into google you can get some good sites to help beginners. This is one I found quickly: http://www.intap.net/~drw/cpp/

4. In your situation, I'd recommend getting a book and using it more frequently than an online tutorial. The book will provide you examples and problems at the end of each chapter (hopefully) that you can work on to get started. Go to a used bookstore and you can probably find one for very little money.
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
4. any other tips

Start with C!!! for the love of god and all that's holy start with C.

Okay, having said that, let me explain: learning C will give you a much better understanding of how computers work and how software works on a computer than any other language. If you're not interested in making this a lifelong pursuit, then maybe consider starting with Java.

Don't start with C++. It's a very complex language that will certainly go over your head if you don't know anything about programming.

Now then, other tips: In any language you pick you out, spend a couple of weeks learning it, going through the examples and actually doing them. Spend some time tweaking the examples too.

Once you get comfortable with the basics, pick a project and start working on it. For me, it was a checkers game written in Java. (Yes, I started with Java. This is why I recommend C to you.) Do as much as you can, then come here (or other good forums for your particular language) and ask questions. Just be respectful, show everybody that you're trying your best to solve the problem on your own, and always post a short example of what's not working right.

It will also be most helpful if you have a solid grasp of algebra, for most graphics-oriented tasks require some algebraic operations.

Edit: oh yeah, buy a book too. Online tutorials won't be nearly as helpful as having a book to page through and follow along with. Plus the quality of instruction in a book should be much higher.

The most important thing to develop at this early stage -- more important than the language itself -- is figuring out how to translate what you want the computer to do into the actual instructions that you put in the source code. This is a skill (talent?) that many people will never acquire (be born with?)...you need to learn how to logically break a problem into pieces and solve the pieces individually, then aggregate those small pieces into larger blocks of functionality, and then aggregate those blocks into useful programs.
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
2. how can i help myself focus on learning more?

For me learning to program has always been driven by the possibilities of what can be done once the 'door' has been opened. So my advice is to find something that really interests you and work towards that goal. For example it could be that you want to be able to program 3-D graphics, artificial intelligence or database stuff … it doesn't really matter what it is so long as it maintains your interest. The answer to which language to learn will I think be answered to a large extent by what it is you want to achieve.

b e n
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
Java, with a good Integrated Development Environment (IDE), will get you started fairly quickly and you'll be able to get a GUI programming and multiple platform programming much more quickly than with most languages.

You could start with C++ but there are too many reasons not to do it, most of which are many chances for confusion. C is a better choice than C++ but you could also end up in confusion and neither language gives you a quick path to GUI development, something that most beginners want.

Be sure to research first, then design, check your code with your research, and you should be set to see what design problems have happened.

Good luck!
 

SupadudeX

macrumors member
Nov 7, 2006
94
0
I would say start with Java. Java is a much easier language than C or C++. Java does all memory management for you so you dont have to worry about the very frustrating issues with pointers and memory errors. Also by learning Java it will give you a foundation into object orientied programming.

That being said, once you have had some experience with Java, I recommend you learn C as well. C is a very powerful language if you know how to use it. Once you know C you can decide where you want to take your programming. If you want to do larger applications you can choose to develop in C++. Once you know C and Java, C++ will be a natural progression.
If you choose to do lower level programming, C will be the language of choice.
 

SMM

macrumors 65816
Sep 22, 2006
1,334
0
Tiger Mountain - WA State
If you are learning on your own, you may want to consider BASIC. It is an easier language to learn and incorporates enough of the programming fundamentals needed to continue with the mid-level and low-level languages, if you find you have the interest and aptitude for programming.

I have heard compelling arguments for starting with low-level first. Others are equally convincing when promoting just the opposite. That leads me to conclude either way can be successful, depending on the individual circumstances. My personal opinion is that learning programming fundamentals is what one will have a high degree of success learning first. So, whatever allows you to grasp the building blocks of programming the easiest is a good choice in a self-study environment.
 

hamsuplo

macrumors newbie
Nov 30, 2006
14
0
Irvine, CA
Since you are in High School, check out AP Computer Science. They probably teach Java by now, I took it when it was C++ back in 98. But its good to learn fundamentals, rather than syntax or the intricacies of 1 language. Learn about data structures, algorithms, object-oriented design, they will apply to all languages. I know reading is boring, but it doesn't hurt to pick up some lecture notes on intro to programming from universities. Learn the science behind it.

I would recommend a friendlier language like Java for beginners. C++ is for good programmers that know all about memory management, garbage collections, pointers, arrays and all that jazz. Java does alot in the background. Now if you want to build efficient applications then you will need to learn about the strengths and weaknesses of each and go from there.
 

bronxbomber92

macrumors regular
Nov 23, 2006
109
0
Learn C then C++.
Want to give a reason why C -> C++? t can be argued that learning a procedural language, like C, first then, moving onto an OO language like C++ his mindset will be unready, and he will become confused in the transition, and ultimately create it difficult for him self.
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
Want to give a reason why C -> C++? t can be argued that learning a procedural language, like C, first then, moving onto an OO language like C++ his mindset will be unready, and he will become confused in the transition, and ultimately create it difficult for him self.

I'm all for learning to programme first by learning algorithms and not engaging object-oriented or procedural languages but I'm of the opinion now that learning an object-oriented language first is best.

You can always learn to use a procedural language but the transition from object-oriented languages is easier than the transition to them.

It's extremely important that new programmers learn C and even COBOL and one assembly language. Efficient programming is something that most developers never seem to learn and procedural languages are definitely important in wringing the most out of a machine.
 

bronxbomber92

macrumors regular
Nov 23, 2006
109
0
I'm all for learning to programme first by learning algorithms and not engaging object-oriented or procedural languages but I'm of the opinion now that learning an object-oriented language first is best.

You can always learn to use a procedural language but the transition from object-oriented languages is easier than the transition to them.

It's extremely important that new programmers learn C and even COBOL and one assembly language. Efficient programming is something that most developers never seem to learn and procedural languages are definitely important in wringing the most out of a machine.
Efficiency is very important. I've been programming for maybe 7 months now, and after talking to many other (professional) programmers, and looking at their source, I've learned a lot.

When you say begineers should learn an assembly language, do you mean an easier (in relevance) assembly like MIPS ASM?
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
Efficiency is very important. I've been programming for maybe 7 months now, and after talking to many other (professional) programmers, and looking at their source, I've learned a lot.

When you say begineers should learn an assembly language, do you mean an easier (in relevance) assembly like MIPS ASM?

Probably the easiest two assembly languages to learn are 6502 and 68000 with 6805 and Z80 not so far away. 8080 or 80x86 are probably the worst, having emulated the worst parts on IBM System/360 assembly.

68000 assembly has the benefit of a lack of quirks, while early 6502 processors (prior to the R6502, 65C02, 65802, and 65816) are missing some simple ways to do things without destroying the accumulator contents.
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
It's extremely important that new programmers learn C and even COBOL and one assembly language. Efficient programming is something that most developers never seem to learn and procedural languages are definitely important in wringing the most out of a machine.

What!? COBOL is definitely not a good language for beginners. In fact, it's so outdated, that if you don't know it now, there's no reason to begin learning it.

I agree that learning an assembly language will make you a better programmer, however.
 

bronxbomber92

macrumors regular
Nov 23, 2006
109
0
What!? COBOL is definitely not a good language for beginners. In fact, it's so outdated, that if you don't know it now, there's no reason to begin learning it.

I agree that learning an assembly language will make you a better programmer, however.
Besides hardware, what else is ASM used for? I'm interested in learning ASM, but I'm not sure if I would ever use it... I tried, making an emulator once, I got it semi working, but I never fully understood the idea manipulating bits...
 

notjustjay

macrumors 603
Sep 19, 2003
6,056
167
Canada, eh?
Besides hardware, what else is ASM used for? I'm interested in learning ASM, but I'm not sure if I would ever use it... I tried, making an emulator once, I got it semi working, but I never fully understood the idea manipulating bits...

I've always liked assembler (for small academic tasks, anyway), it's like a logic puzzle. You've got to break problems down into tiny little steps, and sometimes even that helps you learn. Something trivial like converting decimal to hexadecimal can be done with simple function calls in C, but doing it in assembler forces you to really understand what's going on.

Learning assembler puts you right down at the lowest levels of the computer, since you're only a few steps away from the transistors and logic circuits. You don't have to know how things work at this low level to be a good programmer, but it sure doesn't hurt, and it will give you some idea as to why things are the way they are. That can help a lot when you're dealing with bugs.

I remember once helping my friend debug a program that kept crashing within the IDE she was running it from. Every time it crashed, the IDE popped up a window with a crash report, that showed the assembly code and state of all CPU registers at the time of the crash. Up until I had come along, she had simply dismissed the dialog box (it was full of "gobbleygook code") and tried to figure out her problem by examining the code she had written.

"Whoa", I said.. "Let's have a closer look at that register dump!" I had some background in assembler, so I was able to clearly see what was causing the crash. (I think it was a divide by zero, or a null pointer, or something..)

It's like building a tuner car. Someone who knows how to fine tune an engine right down to the size of the bolt threads is going to be a much better mechanic, even on regular cars.
 

bronxbomber92

macrumors regular
Nov 23, 2006
109
0
Ahhhh, yeah I definitely want to learn assembly (assembler?)... Does anyone know of some good resources (links, [free]books, forums,ect...)?

Yeah, for debugging I can see how it can be useful, also asm can be used in C++ (and C?) using te asm keyword ^_^
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
What!? COBOL is definitely not a good language for beginners. In fact, it's so outdated, that if you don't know it now, there's no reason to begin learning it.

I agree that learning an assembly language will make you a better programmer, however.

COBOL is still useful where money is concerned. There are few languages that handle money properly. COBOL is one of those languages that doesn't suffer from rounding errors because it supports true decimal numbers. RPG (II, III, IV, etc.) and PL/I are others. I'd hate to think how much money would be lost in the cracks because someone used C, C++, or Java.

Ahhhh, yeah I definitely want to learn assembly (assembler?)... Does anyone know of some good resources (links, [free]books, forums,ect...)?

Yeah, for debugging I can see how it can be useful, also asm can be used in C++ (and C?) using te asm keyword ^_^

Assembly language. Many people still confuse the tool, the assembler, with the language.
 

notjustjay

macrumors 603
Sep 19, 2003
6,056
167
Canada, eh?
Assembly language. Many people still confuse the tool, the assembler, with the language.

Guilty. :eek: I've been using the term "assembler" rather liberally. I hope people know I meant "assembly language" (x86 assembly language, at that).

Heck, in one of my third-year engineering courses, we even dabbled briefly in the machine code. We had to write a (very very simple) program in x86 assembly, manually convert it to machine code, then input the hex bytes into an 8086 lab trainer board on a little keypad. The little LED readout confirmed whether our programs ran correctly.

So soon I will get to say "when I was your age..." :D
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
COBOL is still useful where money is concerned. There are few languages that handle money properly. COBOL is one of those languages that doesn't suffer from rounding errors because it supports true decimal numbers. RPG (II, III, IV, etc.) and PL/I are others. I'd hate to think how much money would be lost in the cracks because someone used C, C++, or Java.

I'm not aware of any new application development that is going on in COBOL.

There are plenty of languages that have decimal math libraries which can do arbitrary precision math in base 10...perfectly suited for money. Hell, it's built into every major DBMS in existence today. I work in a large business unit (200 devs) which handles very large volumes of cashflows and there isn't a single COBOL programmer in the building.


bronxbomber92 said:
Besides hardware, what else is ASM used for? I'm interested in learning ASM, but I'm not sure if I would ever use it... I tried, making an emulator once, I got it semi working, but I never fully understood the idea manipulating bits...

You can embed ASM into C, generally by using an "asm{ ... }" block. But for the most part, the easiest place to understand ASM is on low-end microcontrollers. These microcontrollers can be wired up directly on a breadboard, a lot of them are still 8 bit, and the output ports can handle enough current to power LEDs directly. By manipulating registers directly and seeing what the "primitive" operations that a processor is capable of, you get a much better understanding for what a compiler has to do to convert C into machine code.
 

zimv20

macrumors 601
Jul 18, 2002
4,402
11
toronto
I'm not aware of any new application development that is going on in COBOL.
it still happens, probably more than you or i think. there's a pattern of companies trying to replace their mainframe/COBOL systems with client server written in something more modern, like C++ or java. sometimes the new projects are deployed, often they are cancelled. and the whole time, the COBOL programmers snicker and keep coding.
 

zimv20

macrumors 601
Jul 18, 2002
4,402
11
toronto
to the OP -- you've phrased your question wrong. if you want to learn to program, please understand that the languages you use to do that are a means to and end, not the end itself. real programmers think in concepts and merely execute in the language and platform.

becoming a good developer (a rarity, imo) takes practice, commitment, and mentorship. i started programming professionally in 1989, and here are a few things i've noticed over the years:

1. the best developers tend to have technical degrees (computer science produces the best, imo, but there are a lot of good developers with engineering degrees like electrical and mechanical).

2. the best developers have the following traits: arrogance, irreverence, at least a little OCD, and pride.

3. the best developers are never finished with a piece of code. there's always an opportunity to go back and something more readable, more efficient, more reusable, more compliant.

4. the best developers work in cycles: design a little, code a little, test a little, integrate a little, repeat.

5. the best developers see their efforts as a combination of art and science. they balance form and function so that the next developer to come along and extend the code will not only have an easy time of it, but will admire the craftsmanship.

6. the best developers future-proof: their code is easy to read and understand, the functions are small and well-documented, the coding style is consistent, the naming schemes are logical, the code fits into the larger framework and abides by all project standards.

and finally:

7. the best developers are excellent at abstraction. they use that skill to create framework-type code, factor out commonalities in code, and design the system.

not everyone can be a good developer. it takes a special set of skills and years of effort. more likely, on projects you'll find sub-standard hackers (i'm using this term in a way that's fallen out of vogue) who care only about getting the desired output, and little about compliance, maintainability, or future-proofing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.