Ive been trying to learn Programming for a while now and im not really getting anywhere, except getting frustrated and annoyed. Ive had a crack at C++ and other languages but just find it frustrating, If anyone could point me in the right direction to learning the right language and any suggested book/ websites, that would help Alot. Note: I have NO programming experience what so ever. :smile.gif:
I'd say get a book. It's nice to have a reliable source to hold your hand through the whole learning process.
I picked up Sams Teach Yourself Java in 24 Hours. I'm not sure how great it'll be in the end, since I haven't finished it. However, the author is pretty light-hearted so it's not a chore to read, and I find I'm getting a better understanding of Java in general, versus when I tried learning with online tutorials.
There's also this guy's Java video tutorials on youtube:
There's 80+ videos there, and he records everything he does while explaining, so you can follow along.
Both the book and the videos are for newbs to programming, so you don't need to have any background knowledge.
Though personally I only went with Java because Notch uses it. I don't know if it's a good idea to start there or not. But after so much confusion over what to start with, and so many different opinions from people, it felt nice to say "**** it, he uses it, I like his games, so I'm going to use it too."
I'm a big fan of Problem Solving with C++: The Object of Programming by Walter Savitch.
I've got the 5th edition, and it does a very good job of running you through the imperative, functional, and object-oriented concepts of C++ in that order. The book teaches you everything you need to know to start applying C++ to other projects as well as many general programming concepts that carry over to other languages. I'd recommend it to anyone looking to learn how to program.
Beware that it reads like a textbook because it is one. It can also be a bit pricey ($55 new on Amazon, half that used; newer editions cost up to $120), so be rather sure that you're serious about this before ordering it.
After you get through that book, you then must learn how to apply the concepts the book taught you. This is the bit where you learn about data structures and abstractions. This is the part where you start getting into computer science. I wasn't much a fan of the textbook I was given for this part, so I've unfortunately got nothing for you. Basically, look at all the different sorts of sorts (selection sort, bubble sort, merge sort, quicksort, etc), look at different data structures (lists, stacks, queues, trees, maps, and so on), and try out some recursive algorithms. Then note their algorithmic efficiency (learn about Big-O notation) and practical application.
Then, once you've learned about all that, it's best to introduce yourself to the other programming paradigms. Spend a bit of time with Scheme and a bit of time with Prolog. Scheme will turn everything you learned about programming thus far upside down (it's incredibly elegant, though). Prolog will melt your brain. Good luck with that.
After that, you can basically be released out into the world of computer science and programming and learn about whatever interests you.
Oh yeah, that reminds me that I made a few pages for someone I was tutoring once upon a time. I've uploaded them here (put into a rar since my uploading service doesn't let me upload .html files).
It's really meant to be more of a reference than a how-to, but it actually goes into the topics discussed with a fair deal of depth. I do realize now that I forgot to explain what a "literal" is in them.
A literal is any in-line value not bound to a variable.
Mkay, im thinking i might take up actionscript, its not as advanced nor powerfull as C++ but it is probably a better language to begin learning with. Anyone reccomned any good actionscript books or have any reasons why i shouldnt learn action script?
You shouldn't learn actionscript because it's a terrible language to do anything in.
Seriously, though, start off with a stricter language. C++ has static typing and static scope, as opposed to Actionscript's dynamic typing and dynamic scope. Dynamic typing and scope open you up to a world of bad programming practices that are impossible with static typing and scope. Learn it correctly the first time and keep up with good programming practices even in environments that don't enforce them.
Say you have a variable in the main part of the program called "num". In Actionscript, you can make a function that references this very same variable, "num". The function might add 3 to the value of num and do nothing else. It would look like this:
num = 5;
num += 3;
The number output would be 8. You can't do that in C++. The compiler will tell you that no variable called "num" has been defined in the scope of the function, and that's a good thing. Here's why:
num = 5;
num = 3;
num += 5;
num += 5;
What would the function stuff2 print out? (12) How about the function stuff? (8) Which num is which? What num am I adding 5 to? Is it the same num I declared outside? What about the num I'm adding 3 to? If I have a different function and use the variable name "num", which num does it use? Things can get confusing in a very bad way. In actionscript, you see how it can flip-flop on this behavior when using parameters with identical names.
In C++, your only option for the first scenario is as follows:
using namespace std;
int add3(const int number);
int num = 5;
cout << add3(num) << endl << num << endl;
cin >> c;
int add3(const int number)
int num = number +3;
In this case, what is output on the first line? (8) What is output on the second line? (5)
You can be very sure that the variable named "num" is not nor will ever be the same variable declared as "num" in any other function or scope. It is a completely separate entity. It exists only inside that function and cannot be used anywhere else. Likewise, the function cannot use any variables declared anywhere but in the function.
You can very specifically break this using pass-by-reference parameters, but it's done in a very explicit fashion. There's no way you could do it accidentally.
C# would actually be better than C++ because C# is a strongly-typed language as opposed to a weakly-typed one. This is pretty much only in reference to the implicit conversions that the primitive types in C++ can undergo. C#, to my knowledge, doesn't allow implicit conversions without at least a warning.
By which I mean, if you do this:
char c = 2042;
C++ won't say a thing, and you end up with who knows what character (it would be the character '·', but let's see you figure that out).
C# will yell at you and tell you to change it to something correct.
In this case, you want to be yelled at for doing something wrong. Getting a compiler error is, in every possible circumstance, preferable to getting unexpected behavior.
Alright, a request.
I have been around many a guide on how to learn languages. So far the best I have seen are for Python and Actionscript, simply because they don't do the ******** that many other guides do. So my request is a guide that does none of the following:
-"Alright, let us begin. Paste this code into your window. I won't tell you what it does, but it is needed for the program to run."
We need to know what we are putting on the screen. No mystery code. Even a half-assed explination of what it does means we don't get any bright ideas and use it later for areas inappropiate for it.
-"So after explaining the usual variables, basic functions and basic arrays and string workings we shall make a simple program. Look over the following hundred lines of code for this short program on how to tell the time, make a new file, start making records on the times when you click, and then creates a library of these records that automatically deletes old copies and tells the future. There are about fifty terms in this program I never explained, but you should be able to piece together what they do."
I am not giving this idiocy the benifit of explaining what the hell is wrong with it.
-"Alright, I explained variables, various strings, arrays and such, basic loops and exceptions and some little bit of odd code here and there. Now take this and assemble programs without any help from me on how to fit these building blocks together."
Just because we know the basics doesn't mean we know how to use them. Show us how to organize and build programs with these.
In most languages, there's going to be some code that you have to paste in there before you completely understand what it does. In C++, these are includes and namespaces. Namespaces won't make sense until scope is explained, it's difficult/futile to explain scope until you've been introduced to functions. Includes are pretty self-explanatory for the most part, though.
There's certainly a lot less of it in C++ than there is in a language such as C# or Java, where you have to satisfy the Object Oriented requirements of the language, and classes get explained further down the road than namespaces do.
Actionscript seems simpler because it hides a lot from you. With Actionscript, you're not coding programs. You're coding inside a specific little part of a program that's running around your code. All you get to do in Actionscript is tell that program to perform certain actions. It's like operating the remote control to a robot rather than building your very own robot.
A namespace is merely a name for a group of variables and functions, a programmer-defined scope. The using directive applies a namespace to the entire document. Namespaces are many times used when multiple programmers are working on the same project. What could be more annoying than finding out that two of your programmers made a function with the same name, confusing the compiler and forcing one of them to change it (and change every time the function was called throughout the code)?
If you built the functions in separate namespaces, however, you could easily specify which one you want to use with either a using directive or the namespace operator like so:
using namespace std;
The entire document will be written inside the std namespace (the namespace std denotes things written for the C Standard Library), but we've specified an exception to that, the function myFunction() which will be written inside the namespace myNamespace. When calling that function inside the namespace std, we have to use the namespace operator:
using namespace std;
char c = myNamespace::myFunction();
Namespaces are most relevant when you get into classes since each class specifies its own self-contained namespace and scope.