Beginner: C vs C++
nelsonrip (2) | |
I was just wondering, do you need to know C in order to learn C++? Also, is C++ a good program to start learning programming with? I want to learn all kinds of programming but don't know where to start, and don't want to invest to much time in a programming to advanced for me as a beginner programming. Any answers is very much appreciated. | |
muzhogg (51) | |
I imagine that you already know that C++ is an extension of C -- so that pretty much any valid C program will compile and run on a C++ compiler. But the important thing to know is WHY C needed an extension in the first place. It boils down to the need to have tools to allow OOP -- Object Oriented Programming. In OOP the primary focus is on the data, rather than on the methods used to manipulate it. The OOP approach of C++, in other words, is a quite different programming philosophy from the function centred approach of C. All this means that whether you know C or not is a double-edged sword. On the one hand, knowing C is good because it means you already know alot of the basics which have transfered over to C++. On the other hand, knowing C is bad because it is uses an entirely different, non-OOP approach to programming and so teaches you what are "bad habits" from an OOP perspective. I'd say, however, that for a person who doesn't already know C, it makes very little sense to first learn C and THEN try to learn C++. Yes a knowledge of C will give you certain basics which are useful to know -- but if you're starting from scratch, you'll learn those basics just as well if you begin with C++. Bottom line -- if you want to learn C++ then study C++. If you want to learn C then study C. As for other languages, it's hard to say if they are "better" than C++. The reality with these things is that people design programming languages for particular reasons and the "best" programming language is the one which helps you do whatever it is you want to do. I'd suggest you ask yourself what reason you have for learning to program. Is your interest writing online games, authoring databases, or joining in the development of Linux? Whichever most takes your fancy may very well have a big inpact on what language you choose -- for online games you learn flash, for databases you learn SQL (Structured Query Language) and for Linux you learn C and assembler (although it does use some C++). All that said, if you just want to learn how to program, C++ is a pretty good choice. If you know C++ there's not much you can't do and learning it will give you the knowledge to pick up other languages pretty easily if you need to. Also, don't worry that C++ is "too advanced" -- the fact is that if you learn any programming language properly you're going to cover much of the same ground as you're going to need to know the basic principles of memory management, data input and output, file manipulation and so on. After all, programming is all about controling a computer - and you can't do this if you don't have the tools to control ALL the major components - keyboard, display, memory, hard-drive, etc, etc. Again, C++ lets you do all this, and once you've learned it in C++ you can take it all to another language relatively easily. Finally, my most important piece of advice is ALWAYS to learn a few things, but learn them very, very well. Too many people try to write control systems for intergalactic space travel when they don't even get basic data structures. Whatever language you learn, I suggest you get a good book and read it over and over. Play around with the examples, do the problems, and really work at understanding what's going on. If you do this, you'll be amazed at how quickly material which seemed absolutely incomprehensible soon becomes second nature. So, yeah, I'd go with C++ -- you won't become an expert overnight, but taking the time to learn C++ really well won't be a waste of time either no matter which language eventually becomes your favourite. All the best | |
Last edited on Jan 26, 2008 at 9:50pm |
nelsonrip (2) | Jan 28, 2008 at 5:09am |
thanks a ton, and i know i wont be an expert overnight. Really, i just want to know how to program for fun. Hopefully down the line i can implement programming in a career perspective but right now its just one of those things i've always wanted to know. | |
Topic archived. No new replies allowed.
No comments:
Post a Comment