I want to learn C++ (and Python)...

I am going to try to learn C++ (as well as Blender) and hope to someday be able to add some new (and hopefuly usefull) additions to the Blender code.

I have been told learning Python is also usefull for things like plugins, so that also makes my list of things I also want to learn. For someone who started years ago in Basic, the idea of structured code is new to me.

Right now I have access to a system that runs Linux (I like other OS’s as well) and I am now enjoying all it has to offer.

So much to think about! Thanks to elysiun for such a great website and all the help everyone here has offered.

Personally, I’de say go out, and invest in a good C++ book, or enroll in a computer science class at a nearby university. If you have access to a linux machine then you already have access to all the tools you will need for either C++ or python.

Since blender is writen is C/C++ --yea its worth the effort perhaps to learn. But if you starting out or starting new projects, C/C++ does not make sense anymore. I’ll sum it up in one word. Segmentation Fault…

Delt0r

If you’ve never done any programming before then I’d advise that you look at learning Python first, because C and its derivitives can be extremely intimidating languages to learn and they make it extremely easy to shoot yourself in the foot. The number of buffer overflow vulns that turn up in all kinds of software should give you some clue as to the number of mistakes even expert C programmers make.

The fact that a lot of C programmers have a somewhat lax attitude to commenting their code doesn’t help either, it’s very difficult to look at a piece of C code and figure out how it works, and poor commenting will just make this worse.

Programming can be a very rewarding hobby/occupation, but you do need to be prepared for a lot of frustration.

well, i have no idea on python, but so far, all the ideas in c++ are quite easy to grasp. go download a program called gamemaker(www.gamemaker.nl) and learn how to use the variable system. it helped me a lot to get started on c++. also, go pick up a copy of “teach yourself c++ in 21 days”. it is pretty well paced.

If you want to code in Blender, then you’re better off learning C rather than C++. Blender’s source is by far mostly C code, it’s really only the game engine and a few other bits that are C++. But if I were you I’d start out on Python anyway - C can be incredibly frustrating if you’re not familar with the concepts involved (and still frustrating if you are ;))

I echo broken here about learning C first, though depending on your level and commitment, you may be able to jump right into C, instead of sidesteppping at python.

I only mention this because most languages you will be using these days bear a more than passing resemblance to C. If you learn C well first, you will learn some very strict rules and style rules that will help you go a looong way in other languages down the line. :slight_smile:

AgeLess had a great idea, go enroll in a programming course at your local college. you will likely learn tons.

Good luck! OH, and we’ll see you again when you get to your chapters in your books/course on pointers I am sure… :slight_smile:

If you learn C well first, you will learn some very strict rules and style rules that will help you go a looong way in other languages down the line.

Strict rules… I have not meet this kinda C programmer–Most seem to think that comments are for girls, and usefull viarable names are…

The problem with C is that bugs don’t show up where they are. aka seg fault… Its a real pain. And if theres more than one thread, working out when to call free is next to impossable.

I mean the days of manual memory managment should be over.

Start with Python.

If you still want to work on the blender code, then C will eventually be mandatory… But no harm in taking your time.

You never know. Python scripting may be enough to do what you want anyway…

C is not strict at all, wherein lies the problems with it. There’s nothing to stop you from treating an int as a pointer, a char, or any other datatype you feel like at the time. C enforces no kind of type checking or implicit type casting. This makes it extremely powerful if you know what you’re doing, but if you don’t it’ll lead to pain.

Also, you have to do all your own memory management with malloc (), then you’ve got to remember to remove all references to memory you allocated when you’re done with it. If you don’t return memory you’ve finished with to the heap you’ve got a memory leak. If you dispose of a chunk of memory without removing all pointers to it then you will have a dangling pointer somewhere. Dangling pointers are the worst kind of errors to debug because referenceing a dangling pointer may result in everything working as you expected it to, wild results or a crash, depending if the freed memory has been overwritten since you returned it to the heap.

If you want to contribute to Blender then you obviously have to learn C, but if you’re interested in learning programming then maybe it would be worthwhile considering a different language that does the memory management for you, something like C# or Java. I agree with delt0r, manual memory management only leads to trouble and should be discouraged.

Guys, i should point out that i made the comment of learning “C well first”.

C does not have problems. The coder has problems if they learn bad habits, not the language construct itself. remember, garbage in, garbage out. :smiley: i only mention C because if you do learn it well, then you are prepared up front for things at their worst case scenario. (which is, of course, NOT remembering to free up your memory, tracking your pointers, reading past array lengths, etc etc… god the memories of debugging…).

By “learn C well first” I was referring to exactly the type of things that delt0r and passivesmok are pointing out. Learn to avoid those things, and more importantly, WHY to avoid those things, and the experience will help you immensely down the road, no matter what language you are using…

But you will probably learn some very valuable lessons along the way…

However, if you are not in a rush to jump into C, python would be a great place to start! Heck, i need a special grass generation script if you could help me out! :):slight_smile:

CanBlendMan: you’ve opened up one of our favorite cans of worms…

It doesn’t really matter what language you pick to learn programming… a lot of people learn using awk or something equally obtuse.

I echo pld here: C is a perfectly fine choice to learn programming. Pointers and other such things exist in all imperative languages. You might as well learn to use them (and you will, when the time is right).

Python is an interpreted or scripted language, which differs from an imperative language in that it typically makes memory, objects, lists, etc. much more easy to handle than in an imperative one --hence the popularity of scripting languages like Python. It does so, however, by glossing over what is really happening behind the scenes…

Whichever you choose, be sure to get a good reference and learner’s guide. You’re more likely to find these things for C than for Python, but both exist. Make sure to check out several sources. There are plenty of bad tutorials/resources/etc. out there too.

delt0r points out a common problem: people don’t learn to comment their code (they just sit down and start typing, then wonder where all the bugs come from…).

Learning to program is really like math word problems. If you can solve a problem in your head and write down on paper how you did it, step by step, then you can tell the computer how to solve the problem. Failure to understand or have a valid solution before coding produces errors and grief.

In other words, a program is an abstraction over a process. If you can tell me how to make a peanut-butter and jelly sandwich in simple language then you can program a computer to make one.

Hope this helps.

Learn python the best way using the Free online book at http://www.byteofpython.info/
call Byte of Python, the best free python book I found and I used to start coding with python.
I didn’t know anything and this book made me ven understand the clear thinking on programming, make something and now since 1 year I can make some very nice scripts, like I made some socket connections between blender games, my own chat box, irc bot, but also managements scripts for saving information or caculators to do some caculation on my Dives I make in real life. (scuba diving, decompression caculations and so on) :smiley:

Here’s a great site for learning Python. I’ve been reading it for a while, and I’ve learned a lot:

http://www.freenetpages.co.uk/hp/alan.gauld/

It also covers VBScript and Javascript, but it emphasizes more on Python, and is very understandable for those who have never programmed anything before (like me).

I also recommend a text editor that does syntax highlighting and auto indentation (I currently use DrPython).

Tha fact that Python is interpreted doesn’t make any it easier than other languages neither any relation with imperative languages.

And always remember that “C/C++” confuses people. C is one thing, C++ is another thing.