Which Language?

0fffc181c1288c20da66e5bb3e50ad95
0
Deadhead20 101 Jul 06, 2009 at 13:41

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.

27 Replies

Please log in or register to post a reply.

A77e71b962cd6c7c3b885f0488452f1f
0
tobeythorn 101 Jul 06, 2009 at 15:03

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.

B7dcbc0c0f07253f25ff5c25fe38c081
0
SamuraiCrow 101 Jul 06, 2009 at 15:31

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.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jul 06, 2009 at 16:02

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.

A77e71b962cd6c7c3b885f0488452f1f
0
tobeythorn 101 Jul 06, 2009 at 16:31

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.

D47a8b4fa4e79d1250a2592f5ab8d6cf
0
justin17 101 Jul 13, 2009 at 09:37

For beginners, C and C++ is very popular and effective,
also asm is very important for debugging.
this is my suggestion.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jul 14, 2009 at 14:57

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.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Jul 19, 2009 at 23:50

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.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jul 20, 2009 at 12:57

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.)

A77e71b962cd6c7c3b885f0488452f1f
0
tobeythorn 101 Jul 20, 2009 at 15:19

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.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Jul 20, 2009 at 16:20

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.

2b97deded6213469bcd87b65cce5d014
0
Mihail121 102 Jul 20, 2009 at 16:57

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#.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jul 20, 2009 at 17:33

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…

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jul 20, 2009 at 17:39

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. ;)

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Jul 20, 2009 at 19:03

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.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jul 20, 2009 at 19:36

I’d agree that C is actually pretty simple compared to most other languages.

A77e71b962cd6c7c3b885f0488452f1f
0
tobeythorn 101 Jul 21, 2009 at 03:28

Alphadog,
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.

EDIT:
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!

B7dcbc0c0f07253f25ff5c25fe38c081
0
SamuraiCrow 101 Jul 22, 2009 at 01:32

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.

[rant]
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.
[/rant]

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Jul 22, 2009 at 02:56

@SamuraiCrow

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.

B7dcbc0c0f07253f25ff5c25fe38c081
0
SamuraiCrow 101 Jul 22, 2009 at 14:25

@SyntaxError

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.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Jul 22, 2009 at 15:39

@SamuraiCrow

@SyntaxError This is getting off topic very quickly, but did you try LLVM also?

No I haven’t, but again I would be happy to try it out assumimg it’s not too much of a pain. Can I assume it’s free and downloadable? Also is there any particular piece of code you would like me to try?

B7dcbc0c0f07253f25ff5c25fe38c081
0
SamuraiCrow 101 Jul 22, 2009 at 16:17

http://www.llvm.org/ has the LLVM package but to use it with Mono you have to follow the instructions at http://tirania.org/blog/archive/2009/Jul-16.html . Also there is LLVM-GCC on the LLVM page if you want to compile some C++ code on LLVM.

LLVM is under the University of Illinois Public License which is essentially just a 3-clause BSD open-source license.

Please try whatever code you think would be applicable to test it with.

00000000000000000000000000000000
0
Anonymous Jul 24, 2009 at 12:49

for the begginers I prefer the C As basic language
if u strong in it then you can learn much

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jul 24, 2009 at 14:22

Starting with C gives you no better advantage in other languages than starting in C++ or Python and then going to C. Each of them have key, complex concepts that do not exist in the other and all developers should be familiar with them.

For example, knowing C will not prepare you for the complexities and difficulties of a language that offers reflection.

I will repeat that to be an effective game developer, you will have to slog through at least three languages: C++, Python and C are good choices. I would add that some familiarity with an emergent concurrent language, like Erlang or Scala, would be also useful, as more and more games go from one-person standalone settings to the multi-massive games played today.

0fffc181c1288c20da66e5bb3e50ad95
0
Deadhead20 101 Jul 26, 2009 at 17:30

Alright, I’ve gone out and looked at Python. Learned a tiny bit from online tutorials (I don’t have any money to get books online) I am questioning to go get a C or C++ Book from close by for a little bit though. Would it be a bad idea to try and learn both at the same time?

And, I downloaded Blender because I heard it was a good engine to use with Python but I don’t have any idea how to work it. I’m still looking around for good tutorials, but oh well. If anyone has any information on a good tutorial or book on it, please link it. Thank you.

B7dcbc0c0f07253f25ff5c25fe38c081
0
SamuraiCrow 101 Jul 26, 2009 at 21:46

It might get confusing to learn both C++ and Python at the same time. If you can get a book on C++ and keep it ready for when you’ve learned Python well, and then start on C++ later, you’d be in fine shape.

There is a free online book for Python but it is a bit out-of-date. It’s the Python book they used for our introductory programming course at the University level. http://greenteapress.com/thinkpython/thinkCSpy/ seems to be the current link.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jul 27, 2009 at 01:35

The Python docs themselves also include a few decent tutorials (although they do tend to be targeted more at the experienced programmer picking up Python as an nth language than at the absolute beginner).

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jul 27, 2009 at 12:26

I wouldn’t do more than one language at a time.

For a good online Python book, try these along with the online docs:

http://www.swaroopch.com/notes/Python_en:Table_of_Contents
or the older, but worth reading:

http://www.diveintopython.org/toc/index.html

The former is updated for Python 3, the latter I don’t think is.

I would echo the idea of doing Python first. Easier environment (no compilation) and easier syntax makes for a quick ramp up to get the the “concepts and algorithms” phas.

Check this old post of mine too:

http://www.devmaster.net/forums/showthread.php?p=63624#post63624