Resources for learning C++?

Discussion in 'Tech Heads' started by AgelessDrifter, Jan 22, 2018.

  1. AgelessDrifter

    AgelessDrifter TZT Neckbeard Lord

    Post Count:
    42,679
    I may be too busy soon to really lean into this, but I've decided it's high time I knew a general programming language besides python. (I used to know some php and a tiny bit of JS, but that was ages ago, and I don't even really know what php is used for anymore. I'll continue to learn JS whether I like it or not in the coming semesters, but afaik if I want to learn C that's all on me)

    I was thinking I should check out a Coursera course or something since they're pretty low pressure, and maybe once I get the basics just dive in on some simple project and pick up what I need as I go

    But Coursera's low-pressure also kinda translates into low-usefulness a lot of the time in my (admittedly limited) experience. So I'm wondering what ya'll'd recommend, if anything.

    Also if anyone has any argument why I should be learning something besides C++ I'm open to that as well.
     
  2. AgelessDrifter

    AgelessDrifter TZT Neckbeard Lord

    Post Count:
    42,679
    I mistakenly thought--and am a little disappointed to discover that I'm wrong--that it was C++ and not C# that underlies Unity. Now I'm a little torn--it sounds like C# is kinda limited in usefulness outside of Windows environments
     
  3. Utumno

    Utumno Administrator Staff Member

    Post Count:
    37,450
    Never hurts to be strong in JS since fucking everything is web related these days.

    php is still in very heavy use in a practical sense, but people are almost embarrassed to publicize expertise in it now since it's not hip anymore.
     
  4. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
    i think Unreal Engine 4 uses C++
     
  5. Sear

    Sear TZT Neckbeard Lord

    Post Count:
    29,296
    Unity uses C# pal (unless you meant the runtime itself)

    They're different languages, so it depends on what you're wanting to do. C++ is faster and offers more low-level control. C# has a lot of built-in features and libraries that are useful (LINQ, events, etc).

    C# also might as well be interchangeable with Java, so you essentially know both if you know one of them. I think C++ is more difficult to learn.
     
  6. Sifter

    Sifter TZT Addict

    Post Count:
    2,992
    Would recommend learning Java or C# over C++
     
  7. AgelessDrifter

    AgelessDrifter TZT Neckbeard Lord

    Post Count:
    42,679
    HMMM maybe C# is the way to go after all. The only justification I can think of for C++ now is that since it's lower-level it'd probably be easier to learn C# knowing C++ than C++ knowing C#, and it might give me some useful insight into what's "under the hood" when I'm using other interpreted languages. On the flipside I can think of plenty of things I can do in Unity for funsies off the top of my head whereas C++ would strictly be for resume fodder and I may never really use it if it's that much of a pain in the dick

    Which one is going to look better on my linkedin profile :hmm:
     
  8. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
    tl;dr :

    for ML ppl esp ones who alrdy know python or some similar language learning C++ >>>>>>>>>>>>>>>>>>>>>>> C#, no contest whatsoever (for many reasons listed below), but maybe u should do C# anyway if you would be more motivated to play w/ it in unity than w/ C++ in unreal engine

    not tl;dr:

    i think a strong C++ has broader value than C# as part of anyone's background, and that that's especially true for someone specializing in ML. C# is much easier to pick up and competency in it overlaps more heavily with other, somewhat more popular high level languages like python, & C# allows you to sidestep memory management like other high-level languages

    C++ also appears more frequently as a CPU-side optimizing partner of high-level languages, e.g. as part of the cython project for achieving C/C++ levels of performance in a project written primarily in python. that kind of hybrid optimization is not often necessary, but ML is certainly one of the areas where it can be important

    appreciating low-level memory management is also very useful if you ever write your own GPU kernels, or even if you want to understand what someone else's GPU kernels do, and the languages they're written in (openCL/CUDA) tend to be more-or-less subsets of C, which is more-or-less a subset of C++. given the importance of GPUs to large-scale modern ML this is an obvious advantage, even tho u mostly will spend ur time using pre-written kernels

    there is a reason to lobby for java (but not C#!) for ML, since the currently dominant bulk-parallel cluster-compute CPU(/GPU, but the GPU bits have to wrap to the aforementioned kernel languages ofc)-driven "big-data" processing paradigm (spark) runs on the Java Virtual Machine. you can use it through python ("pyspark") but i personally find some of its error messages mystifying. often that's because they're poorly written but no doubt i would have an easier time understanding them if i had spent more time working with languages like java/scala that are built on the JVM

    i dont really think there are any reasons to advocate for a generic ML grad student to learn C# over C++ rlly. however if you'd rather work in unity (C#) in your spare time than in unreal engine (C++), then in your specific case it could be better to learn C# if you think that would motivate you to play with it more. language features considered in the abstract are a lot less important than how often you realistically see yourself building and testing stuff
     
  9. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
  10. Utumno

    Utumno Administrator Staff Member

    Post Count:
    37,450
  11. Utumno

    Utumno Administrator Staff Member

    Post Count:
    37,450
  12. Sifter

    Sifter TZT Addict

    Post Count:
    2,992
    I would think an ML grad student
    I would bet you 5 uNiKoIn gold that his data science program will mostly be python (sklearn) with maybe some R thrown in, and C++ won't be relevant.
     
  13. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
    that's almost certainly how his program will be structured, sure

    i don't care how his program is structured tho, doesn't change that C++ makes more sense for an ML specialist for the many reasons i gave
     
  14. AgelessDrifter

    AgelessDrifter TZT Neckbeard Lord

    Post Count:
    42,679
    Thanks Agrul, that's all really good info

    Sifter you're exactly right that that's what's on the menu for the curriculum, but for the context of this thread that's actually points in favor of C++ (since I won't be learning it unless I actually take the initiative and--from the sound of it--it'll be relevant to the field once I graduate either way)

    I think I will go with C++ for now; although Java does look tempting after looking at UT's links (and I know I'm gonna be using Spark at some point), it sounds (and correct me, anyone, here if I'm wrong) like the hop from python to Java is mostly syntactical(?), whereas with C there are extra nuts-and-bolts considerations like variable checks and memory allocation and stuff that are novel
     
  15. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
    i think both java and C/C++ are both pretty distant from python. C/C++ maybe arguably more distant but not by a whole lot. C/C++ & java are closer to one another than either is to python

    i havent used java since HS (ignoring my implicit use of it through spark, & even that's technically using the JVM rather than Java per se, with spark being implemented in scala), but i believe memory management in java is much more akin to memory management in C/C++ than python, variable typing is static, etc. from recent experience, some of the more annoying error messages i've run into in spark relate to the JVM's model of memory management; spark will often throw obscure messages about running out of heap space or some such
     
  16. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
    o one other point in favor of java vs python when it comes to spark: in addition to spark really running on the JVM, spark features also tend to be immediately released for its java API and for scala (in which it is directly implemented). only later do new features make it to the pyspark module
     
  17. Agrul

    Agrul TZT Neckbeard Lord

    Post Count:
    44,097
    maybe 1 thing C# would force you to appreciate / hate is object oriented programming, since it literally refuses to let you do anything in a non-object-oriented way

    you can pick up that same skillset from python or C++ or java of course but,

    similar to why some ppl learn functional programming from purely functional languages like haskell

    if you just refuse to master OOP bc ur language gives you alternatives then learning C# could fix that

    so that's a C# thing. that thing is a C# thing. it's a thing about C#
     
  18. Chemosh

    Chemosh TZT Addict

    Post Count:
    4,140
    Latest .net allows for compiling on Linux too
     
  19. Sifter

    Sifter TZT Addict

    Post Count:
    2,992
    I like straight C for learning things like memory management, system calls, managing processes & threads.
     
  20. Kilinitic

    Kilinitic 6,000 feet beyond man and time

    Post Count:
    15,839
    i hate R. so stupid. The worst. Learn C++.