3 Replies - 8638 Views - Last Post: 09 March 2011 - 08:48 AM Rate Topic: -----

#1 TripYR  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 08-March 11

Learning Curve with C++?

Posted 08 March 2011 - 10:23 PM

What are basics I should try to focus on that will help me out in the long run when learning c++ as a beginner.
Is This A Good Question/Topic? 0
  • +

Replies To: Learning Curve with C++?

#2 apw5020  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 666
  • Joined: 26-March 09

Re: Learning Curve with C++?

Posted 08 March 2011 - 11:56 PM

Was This Post Helpful? 0
  • +
  • -

#3 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 614
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: Learning Curve with C++?

Posted 09 March 2011 - 07:46 AM

Realistically high ideals and motivation. Do you have any particular area of programming that you're interested in?
Was This Post Helpful? 0
  • +
  • -

#4 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2246
  • View blog
  • Posts: 9,236
  • Joined: 18-February 07

Re: Learning Curve with C++?

Posted 09 March 2011 - 08:48 AM

I generally find that beginners have a couple of hurdles that get progressivly harder:

#1 what is a program? -- not a really hard thing to understand, maybe that is why so many beginners have problem with it, they *think* they get it but don't. Heck I have been programming for many years and every once in a while I stumble on this one.

#2 Syntax -- programming is very structured and requires correct syntax. Most errors (even after years of programming) are just syntax errors, a missing semi-colon, using = when you mean ==, mistyping the name a function, forgetting the correct include etc. -- as frustrating as syntax errors are you need to just learn from them and move on and try your best not to dammage your computer when it takes 2hrs of debugging to discover a rather obvious typo.

#3 Program flow/execution order -- execution starts at the top of main() and ends at the return but it can wiggle a lot in between. Beginners often have a hard time with this. We get people who initialize variable after they are used or print out values that have not been computed yet etc. -- A programming should be able to "turn on" a program in ones head, at least step though the logic and you need to start learning that skill right away.

#4 Variables/data -- do you know what a variable really is? do you know what computer data really is (just bits). What is an integer? a floating point number? a char? a string? did you know a string is just a long list of little integers? do you really understand that ALL data in a computer is just numbers? do you know ASCII? Understanding what data really is, is probably the MOST IMPORTANT thing a programmer can every understand -- and like other lessons this is one that you will always find yourself coming back to because its simplicity has such far reaching implications.

#5 control structures -- how to use if, else, do, while, switch etc. -- really not generally a hard step if you are getting along with #3 -- there can be some interesting twists like loop unrolling, interators -- but really by the time you are ready for these you should have a good grasp already so they are more fun then hurdles when you get there.

#6 functions/modular programming -- BIG STEP. Learning to break up problems (functional decomposition). learning to modularize your logic

#7 structures (classes part 1) -- aggregation of data. (What I called data modularization) -- Learning to logically combine data into "records" or structures.

#8 pointers -- The BIG one. If you make it here you are doing good, you will probably have used them already in strings or arrays but now one really has to grok them and they are probably the biggest hurdle. Funny thing is, understanding WHAT they are is not hard, seeing how they are useful and how they are used can be a little mind bending because they are an abstraction that is not abstract. They reference addresses AND have addresses. Learning how to use pointers is the biggest C hurdle - I think it is the second biggest C++ hurdle but that may only be a matter of how you approach learning C++.

#9 Classes. Classes bring together structures and functions -- the hurdle here is generally understanding what belongs INSIDE a class and what does not. Understanding the IDEA of an Object. By the time you get here writing a class is simple, understanding what they are also kind of easy, understanding how best to use them... that takes a bit. I suspect though this too is not a terribly hard hurdle but it can take time.

#10 abstract data types -- starts simple - what is an array? maybe a little confusing with a stack vs. queue but graspable... then linked lists are not really too hard esp. if you understand pointers... but then trees...

#11 Algorithms -- Many programmers do programming without every learning about the classic algorithms (sorting/searching/traversing trees/arithmetic) and indeed because many of the abstract data types are actually done for you in libraries you actually don't really need to learn these to just program. BUT if you really want to be a great programmer you will have to dig in an study the classics. Kind of like reading Latin or ancient Greek, it is hard, it takes time, it hurts your brain but you will learn so much about programming what the underlying abstractions. Even just working though the bubble sort (which should really never be actually used in production code) is a great exercise.

#12 OOP -- beginning to lump things together, since there are many steps in learning OOP (encapsulation, inheritance, polymorphism) -- you should actually START this early, I like the hello world program to look like this:

#include <iostream>

using namespace std;

class World {
    World() { cout << "Hello World!" << endl; }
    ~World() { cout << "Goodbye World!" << endl; }

World theWorld;

int main() {
    return 0;

but whether you learn C first and then move into C++ or start out with classes on day one, learning OOP is a continuing drive. It takes YEARS. But thats ok, because much of "learning OOP" is experience. Its about learning how to construct frameworks for solving complex problems and before you can really properly get into it you need to learn to use the language.

#15 -- STL -- ok you have to learn the libraries at some point.

#14 -- Generic programming -- Again I am lumping things together here. Many C++ programmers get by just fine with only briefly touching this topic here and there.

IF you can get to #9 then you are probably not exactly a true *beginner* anymore and these higher ones may be kind of complicated but you have all the tools for implementing them all you need to do is work on understanding them. You have to understand that it takes TIME to learn these upper ones and mostly they are learned by WRITING PROGRAMS.

So my absolute biggest piece of advice for learning to program: DO PROGRAMMING. WRITE PROGRAMS. USE PROGRAMMING TO SOLVE PROBLEMS.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1