cogneurodude said:
Hello all,
I'll hopefully be attending a cognitive neuroscience PhD program next fall and I'd like to learn some programming beforehand (having programming skills helps for lots of neuroimaging labs) Labs I've worked in used UNIX and MATLAB and I'd really like to improve my knowledge before I go to graduate school.
My question is, what is the best way to do this considering my options?
I don't have much money and I can't take any courses at school in programming next semester.
Is there a good C/C++ website that offers good training for beginners that anyone recommends? A quick google search found several but I'm not sure if which one to look into.
As for UNIX, I was lucky enough to find a UNIX textbook and I have linux installed as a virtual machine so I'm set there.
Can computer programming be learned well on one's own? Would it help to meet with a CS professor next semester every other week or so to help me along?
I know my questions might be hard to answer so I appreciate any feedback!
Thanks!
Hey there cogneurodude and welcome to the forums.
I used to work as a programmer but I'm nearly finished doing a math double major degree. I'll try and keep my advice relevant, concise and to the point.
With regards to learning C++, you should note that C++ is simply the C language with a bunch of extensions.
My advice when learning programming for the first time is to not get tangled with the idea of learning a high level language getting lost in definitions, features and so forth. I'll give you some ideas of what I think are important in any kind of programming:
1) Flow control
Although there are dozens and dozens of language each with their upsides and downsides, the fact is that computers (for the most part) are machines that execute procedural commands.
Given this, you need to understand what the flow control of a program is and imagine what it would look like in your head.
Its critical that you know how things are executed in all environments because if something goes wrong and you don't know the flow control of the program, you won't be able to fix it.
2) State
The next thing you need to do is imagine the state of your program. As you do more programming and go from your simple 20 line program in int main to your thousands if not hundreds of thousands of lines of code for some complex task, you will able to visualize what is going on and the relationships between the variables and the functions that use them.
You have to know state in order to fix problems. For example you may have not initialized a pointer, or a variable might be "out of bounds" or something else.
To get used to this, learn to write programs that check and correct bad states and make sure that everything has a starting value and that you write code in a way that guarantees a function will run if its variables are in a valid state.
3) Structure
When you start off you'll probably write some simple programs with ints, floats, doubles and so on, but soon you're going to have to create more organized and less redundant code. With this you need to be aware of structure.
Structure is simply some organization of data. In C,C++ you will use the struct keyword to define structure.
Before you learn things native to C++ like object oriented programming consisting of things like inheritance, polymorphism, encapsulation, virtual definitions and so on, you need to understand basic structure. Its easy to understand how things like this work if you understand how these things look in memory. Typically when you inherit from a base class you are simply stacking structures on top of each other in memory and depending on the rules you add function callbacks and so on, but I won't go into this as it will probably be confusing.
These things are things that are essential for any kind of programming. You have to see the forest from the trees if you are to become proficient. Keep the above in mind when you are learning whatever language you want to learn.
For C++ there is a book calling Thinking in C++ by Eckel and if things haven't changed, it should be free for download from his or an affiliate website.
Of course there are tonnes more things to become good at programming, but I think the above will set you up to be a better programmer than if you just read a book that explains the language and gives some examples: again its seeing the forest from the trees.
Good luck!