Thread: Frustration in learning C++

  1. #1
    spaghetticode
    Guest

    Frustration in learning C++

    This language is driving me crazy. How did you guys manage to get over a beginner's frustration due to C++'s learning curve?

    I've tried several languages, Java, Python, C... in all of which I actually saw my progress. Not so with C++. I like working with my textbook, I like the language... but I do have the feeling I'm not really moving on. I know that C++ takes a longer time to learn than most other languages, but still...

    Sometimes I really think I shoul jack it in and stay with Java or Python. But then again, I *want* to learn C++. No reasons for it except I somehow like the language.

    How did you cope with such frustrating moments when you were learning C++?

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Don't worry about learning every little detail about the language. C++ is a very big language and most people don't use 50% of the features.

    Just learn the basics, and start having some fun making programs, games, etc.

  3. #3
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    (Probably because it was the first one I learnt..) I did not have to deal with much frustration.
    But as cyberfish suggested, I learnt stuff like templates and the weird intricacies of OOP...etc. only when I needed them to write a program, not because they were in the next chapter.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    The most important thing is understanding OOP conceptually. If you can explain, in words, what classes, instances, and inheritance mean, the rest is mostly just details.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I already had a good grasp of OOP when I went to study C++ and did not feel particularly frustrated, altho it does have it's own particular, very rigidly structured approach.

    I still find the syntax more awkward and long-winded than other languages I know (but most of those are interpreted, and so probably less constrained). There are also a lot of slightly bizarre idiosyncracies I find counter-intuitive, such as iostream. Put that together -- into "long-winded idiosyncracies" and it might seem a bit masochistic unless you are using the language a lot.

    I do like it tho. I think C++ has a lot going for it; but while some of the features are great, there are others that don't interest me at all, probably because of the nature of what I do with it. I think C++ was designed from the beginning with a strong emphasis on safety mechanisms that make most sense in large, team settings, but that are somewhat irrelevant or irritating on a smaller scale.

    What is it specifically you find frustrating? Beyond the elementary types and flow control, I think you do need to get comfortable with, in order:

    1) the basic OO methadology including inheritance,
    2) the more common STL containers such as vector and map,
    3) how templating works.

    After that, you may not know everything, but you should be fairly comfortable and able to undertake a serious project without being too hackish.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by dennis.cpp View Post
    How did you cope with such frustrating moments when you were learning C++?
    If you've been following me on these forums you know I share that frustration BIG TIME. No matter what I do I can't distort my head into "OOP Think" and eventually gave up... but not for the lack of trying.

    I coped by bailing on it... perminently.

    As I told a friend just the other day... OOP ranks somplace below self-castration on my list of things (not) to do.
    Last edited by CommonTater; 12-31-2011 at 11:41 AM. Reason: typos

  7. #7
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    I learned C++ along side C as my first true language(s). Only with time did I pick up details, and I still far from know them all.
    Of the language's design, I find templates to be the most frustrating. There must be a million better ways to implement meta-programming than the way it's done in C++!
    Interestingly enough, I find OOP to be way overrated, it has no real advantage... except in the matter of RAII. Oh how I love RAII. And exceptions.
    If C had RAII and exceptions (sorry, context saving doesn't count), then C++ would be a complete waste of bytes.

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Yarin View Post
    I learned C++ along side C as my first true language(s). Only with time did I pick up details, and I still far from know them all.
    Of the language's design, I find templates to be the most frustrating. There must be a million better ways to implement meta-programming than the way it's done in C++!
    Interestingly enough, I find OOP to be way overrated, it has no real advantage... except in the matter of RAII. Oh how I love RAII. And exceptions.
    If C had RAII and exceptions (sorry, context saving doesn't count), then C++ would be a complete waste of bytes.
    Can't help you with the auto-destruct functions...

    But both Pelles C and LCC have full try-except-finally SEH support.

    You can always do your cleanups in the try-finally block...

  9. #9
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    C has an answer to almost everything that C++ can do, with the added bonus of lower-level control of the system.

    Exceptions can be done with careful if/else statements, and OOP can be emulated with structs and function pointers.

  10. #10
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Exceptions can be done with careful if/else statements,
    That's exactly what exceptions avoid.

  11. #11
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Quote Originally Posted by whiteflags View Post
    That's exactly what exceptions avoid.
    What's the point of avoiding them? There's no reason to have any abstraction from what's actually happening (don't exceptions rely on some sort of if-else, at an assembly level?), and they serve the same purpose.

  12. #12
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by memcpy View Post
    What's the point of avoiding them? There's no reason to have any abstraction from what's actually happening (don't exceptions rely on some sort of if-else, at an assembly level?), and they serve the same purpose.
    By that logic, the loop constructs are unnecessary... after all, they are all conditional jumps in assembly level, easily done with if and goto !
    The result is the same, only more cumbersome; the same can be said for exceptions.

  13. #13
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    How did you cope with such frustrating moments when you were learning C++?
    Don't try to take on the entire language at a single go.

    Get the book "Accelerated C++"; take your time doing the exercises. Actually, take your time with every little chunk. For example, don't try to learn the science of programming templates at first; learn to use the templates the standard library provides first.

    There must be a million better ways to implement meta-programming than the way it's done in C++!
    O_o

    Naturally. That is a consequence of using facilities to do meta-programming that were not designed for that.

    Using C++ templates to do meta-programming is really pushing C++; it literally never has to be understood or directly used.

    Interestingly enough, I find OOP to be way overrated, it has no real advantage... except in the matter of RAII.
    "RAII" is a part of C++ because it supports scoped construction and destruction of objects. It has nothing to do with "OOP". You will not find "RAII" techniques in a "OOP" book aimed at any other language.

    There's no reason to have any abstraction from what's actually happening (don't exceptions rely on some sort of if-else, at an assembly level?), and they serve the same purpose.
    O_o

    Abstractions are awesome. They ease the burden of handling details. `FILE' is an abstraction. Do you really want to get rid of all of them?

    Soma

  14. #14
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Exceptions are more than just if-else, conceptually anyway. The basic point of exceptions is to refrain from handling errors in the code that raised them. It let's the calling code handle the exception however it wants to handle it. In the conditional branching approach you basically have to handle the error right there, or call some sort of handler function. If you want to look at it that way, exceptions just reorganize some very familiar code.

  15. #15
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by memcpy View Post
    Exceptions can be done with careful if/else statements, and OOP can be emulated with structs and function pointers.
    A Crash Course on theDepths of Win32 Structured Exception Handling, MSJ January 1997

    Trust me, you can't if/else your way out of that...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Frustration with tutorial.
    By A34Chris in forum C Programming
    Replies: 19
    Last Post: 03-18-2008, 03:08 AM
  2. Frustration
    By curlious in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 09-29-2003, 02:22 PM
  3. Frustration ...
    By goran in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 08-06-2003, 11:21 PM
  4. DLL frustration
    By robid1 in forum C Programming
    Replies: 4
    Last Post: 06-22-2003, 03:37 AM
  5. Frustration
    By kas2002 in forum C++ Programming
    Replies: 4
    Last Post: 05-29-2002, 05:00 PM