Hi all, I'm wanting to start programming, but I don't know which language to start with? Should I just push right through C++, or start with a smaller language and work my way up to it? Any suggestions would be extremely helpful. Thank you.
For beginners, I would recommend c or one of its derivatives (c++, objective c) because these are low level. It will give you a sense of what is going on under the hood (something that higher level languages obscure). c and c++ are also arguably good because they are used by so many other people, so it is easy to find resources. In my oppinion, c++ lacks elegance and is a mess of things thrown together. c is relatively simple and consistent and might be a better place to start. Then work your way up.
In the long run, you should try many different languages and decide for yourself what you like and dislike about each and what kinds of applications each is best suited for. Leaning a new language is never a waste of time, because it will show you a different way of thinking about and expressing a problem. You will discover too that most paradigms can actually be implemented in any language.
I'm afraid I must disagree. Low-level languages don't yield enough progress fast enough to satisfy most beginning programmers. They are also difficult to debug.
I'm going to recommend Python as a first language. It makes it easy to learn the style of structured and object-oriented programming up-front and doesn't leave much to puzzle over since it has the most common data structures built into its commands. Once you learn Python scripting, then you can start writing extensions to the language in C and C++ to learn the more advanced topics.
I agree with Python as a first language. You don't have to worry about pointers, memory management, or C's unintuitive (to a beginner) ways of treating strings and arrays. It's more important at the beginning imho to get a feel for how to use data structures and algorithms, than to learn what's going on under the hood.
Having considered Samurai Crow and Reedbeta's arguments, I think they have a very good point that Python will let you learn basic concepts without much fuss. I actually also believe that higher lever languages (like Python) are wonderful and are the future of programming. However, low lever languages are also important things to understand. If you continue programming, you should eventually learning c because it will allow you to understand something like Python with much greater depth.
For beginners, C and C++ is very popular and effective,
also asm is very important for debugging.
this is my suggestion.
In a way, language choice doesn't matter. There is A LOT more to learning HOW to use a language (analysis, design, patterns, algorithms, etc...) versus learning a language itself. Syntax is relatively easy to master, even with a language as vast as C++, versus the actual working knowledge.
As a simple analogy, it doesn't take the carpenter long to see how to sling a hammer, a chisel and a saw, but building a Chippendale cabinet can take years to master.
But, in order of preference, I would agree with SamuraiCrow and Reedbeta: Python first, C++ second, then maybe C, C# or Lua third.
Python is arguably simpler, but not by much, than C++, and prevalent in the game development world. C++ can be much more complex, but the parts you actually need (vs. admire from a distance) are not much worse than Python. And, it is the most prevalent language in the gaming world.
Lastly, C is obviously popular for historical reasons and/or where performance matters a lot. C# is made popular by Microsoft its push in the game development world, and its large community. And Lua is a popular scripting language similar to Python.
I must agree with tobeythorn. I've been a programmer for almost 30 years. It used to be every new hire would come it with a reasonably sound knowledge of the lower level workings of a computer. These days that's not a given. Too many times I have sees guys who have a hard time wrapping their brain around things like pointers, memory management etc, because they did not lean it from the ground up.
This is probably going to be the opposite of what teacher will tell you but I would start with C (in my day I learned fortran) and then move on to C++. Next learn about garbage collection and when and if you finally move to languages like C# and Java you will have some idea what is going on underneath the hood.
I'd love to see a tangible example of how "knowing the lower levels of C" will help you in Python. Specifically which "lower levels" would the awareness thereof enhance most Python coders? (Or, replace "Python" with "C#" or "Java". Doesn't matter, because presumably these hidden truths would benefit coders in any high-level language.)
I'm not a python programmer (although I've read python code before), but I can speak to the relationship between low level and high level. Knowledge of the low level has and continues to make me think about how high level languages are implemented and in that process of inquiry, forced me to probe into what it is I'm really doing in the higher level language and discover some of the more subtle points of paradigms of the higher level language. When first learning a language(computer or human), especially if it one's first language, there is mostly learning through mimicking. It takes a different perspective or second look at something to really figure out what's going on. Since I began learning Japanese, I've come to think much more explicitly about English (my first language). I'm more likely now to question grammar constructs or notice the components, etymology, and implicit meanings of words in English. The benefit to learning multiple languages, although abstract, is most definitely substantial. c, python, and most other languages do offer different ways of expressing ideas.
I have never used Python but I will give you a few examples for C#. In the normal case everything in C# is a pointer to a typed object. This fact may be unknown to you if you are a new programmer. However there are ways to override this. By having some understanding of the underlying layout of computer data you get some idea of when, if and how you should use the specialized features of C# to optimize your code.
Also garbage collection is often of concern with newer languages. The time when objects are destructed can be an issue in certain cases. Can objects be moved during GC? What are the implications of this if you are trying to interface your data to something outside the language? Are back references in your data structures going to cause issues during GC?
If you know C/C++ first and have some knowledge of memory management you tend to think about these things implicitly, and take steps to avoid problems. I'm not claiming that everyone should absolutely learn C/C++ first. However, if you want to be a "complete" programmer and especially if you are working on performance sensitive games, I think this is a good route to take.
How exactly do you want to teach C to newcomers? Despite being my favorite language it is a very complex one. You have to know the whole damn standard (C99 for example) to use it correctly and efficiently. Do you know what it takes to read and understand the standard? Have you read it? Excuse me, sir, but C is not friendly at all. C++ is even worse, being a syntactical hell. Newcomers should take something understandable and productive: Python, Perl, Smalltalk, Java (ok, probably not Java anymore), C#.
Well, I respectfully disagree with both of you (meaning tobeythorn and SyntaxError).
While I can see that you are both developers with some decent amount of experience, it's just that we have somehow arrived at different opinions over our careers.
First, there's a difference between saying something like "a strong developer knows multiple languages" and something like "knowing X will make you better at Y". I agree with the former, but not with the latter.
Knowing multiple languages will help you really see the relative strengths and weaknesses of each. You will better know when to use one versus the other. But, this is a kind of "meta-knowledge", if you'll allow the term. Knowing multiple languages doesn't make your potential in one language any higher; it just makes you more adept at choosing the right tool. The only time knowing C will benefit you is when you need to use C, which can happen often in a performance-demanding subject like game dev.
However, the latter is simply not the case. It's like saying, if you want to really learn and be good at English, you should learn West Saxon Englisc first. Sure, it's interesting to see where some modern English terms and structures came from, but it won't make your English essays any more understandable. B) More tangibly, instilling best C# practices on "big concepts" like GC (memory management), passing by ref/val (pointers), multi-threading, etc. can easily be achieved without knowing C.
I have yet to be found a concept in a higher-language that, without knowing how to implement it in a lower language, you are at a distinct disadvantage to someone who does...
I started with BASIC and worked my way up to Pascal, then C/C++. So while I agree that expertise in a close-to-the-metal language like C/C++ is very useful and important (C++ is my primary language at my job) I still think that for an absolute beginner it's better to use a language that abstracts away the confusing details.
I actually don't think C is very confusing at all. I'm not sure where this idea is coming from. C++ has a lot of little nuances and complexities but C is pretty straight forward. I learned C by simply picking up K&R many years ago. Before learning C I knew Basic and FORTRAN and that's it.
In any case, all opinions here are equally valid so I guess we can just let the OP decide his best option now that he has heard the arguments.
I'd agree that C is actually pretty simple compared to most other languages.
To clarify my position, I don't think that one should necessarily learn lower before higher level languages. In fact, I think SamuraiCrow and Reedbeta makes very compelling arguments that it makes more sense to learn a higher(more "contemporary") language first.
I do maintain that learning multiple languages is one of the best ways of gaining new perspective and of learning new ways of expressing problems. It's not just a matter of knowing when to use which tool. In my own experience, it has often turned out that a method or idea has been possible (and practical) all along in one language, but only it never occurs to me until I learn a language that explicates that idea. High level languages tend to be different tools than low level languages, and that's what's is important. Different perspectives challenge each other and I believe, open up the opportunity to develop more consciousness about expression.
Also, by "think[ing] about how higher level languages are implemented", I mean thinking conceptually about how something works. One could, for example, learn Smalltalk as a first language without really understanding what a message is, how it differs from a function call, and what it's advantages and disadvantages are. Learning c afterwards would probably be very illuminating for that person. In reverse, one could learn c (I'd even argue c++) first, but might totally miss out on object oriented concepts until they learn a language like Smalltalk. Those object oriented concepts can greatly enhance c programming!
My first language was a low-level language called Commodore Basic v2 on the Commodore 64. Since the only way to get things to happen on that architecture was to poke values into the registers and peek the results, it only made sense to move on to the 6510 Assembly langauge next since interpreted BASIC was dead slow.
The good old days of bit banging is mostly gone except for embedded controllers and with it the joys of programming in low-level languages is fading out as well. The only reason for learning a low-level language today is to move on to compiler design and to understand how they work.
I am learning about compilers and have been so overwhelmed by the high-level concepts of optimization and computation that if there was a low-level language I'd recommend to a beginner it would be LLVM Assembly. Once you learn static single assign form it is a simple matter to learn how to implement code at a level where it can still be auto-optimized by the Low-Level Virtual Machine itself and still create optimal code for many processors. Once you get over the thrill of having a lot of control over your code, moving on to a higher level language will still be the most practical way to do anything.
The main reasons I think that C++ is going to start fading out in some circles is that certain features of the language make writing LLVM bitcode and .NET Managed code less portable than they should be. Conditional compilation was a technique in the C preprocessor to avoid compiling code that will only be used in certain situations, a practice that should be eliminated because dead-code elimination within the compiler itself can do this without a preprocessor.
For example: using dead-code elimination at link-time allows all of the system-specific codes to be included in the bitcode on LLVM so that a single collection of bitcode files can be generated portably so that the LLVM's llc command can be used to statically compile them the rest of the way to machine language regardless of the target. Only the runtime libraries would contain system-native code. This combines the best of the .NET and Java worlds with the SDL/SFML worlds.
The main reasons I think that C++ is going to start fading out in some circles is that certain features of the language make writing LLVM bitcode and .NET Managed code less portable than they should be.
I would think most C++ programmers write natively compiled and optimized code. I personally don't care about the .NET bastardization since it is hardly C++. I would rather use C# before using C++/CLI.
Also I don't see C++ "fading out" soon since no other language has come to prominence that fills its niche; that being performance oriented code. In fact other compiled languages such as COBAL and FORTRAN have been fading out in preference to C++. If another good compiled language does appear then C++ may indeed fade out but I don't think languages like C# or Java will replace C++ since they come with their own limitations.
In my tests and despite what some C# fans claim, C++ typically runs at least 2.5X the speed of C# and quite often a lot faster. Yes in some cases if the planets align properly or monumental efforts are made C# or Java may run near the speed of C++ but typically it isn't so. I have tested it many times, but I will be happy to test it again if someone has a particular C# algorithm (that's not too long) that I can code in C++ for comparison.
This is getting off topic very quickly, but did you try LLVM also? When using LLVM to optimize the JIT code of Mono it is often just as much faster than running C# using the default JIT as running C++ over the default JIT.
My rant was based on the FAQ at the LLVM website. If you want to discuss this futher, we should start a new thread.
next page →