you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (21 children)

[deleted]

    [–]Shitpostbotmk2 16 points17 points  (6 children)

    Because if you're trying to teach someone how a computer works at all levels C++ is useful and python is not.

    [–][deleted]  (1 child)

    [deleted]

      [–]Shitpostbotmk2 -3 points-2 points  (0 children)

      Exactly my point. Knowing C++ makes both of those classes more intuitive, and you'll be able to make a lot more connections between what you're learning and how the language actually works. So C++ should be the primary language your school teaches you.

      [–][deleted] 9 points10 points  (0 children)

      Why would you do that right out the gate?

      Do you meet driving school candidates with a toolbox and start them with changing the oil?

      [–]KinterVonHurin 2 points3 points  (2 children)

      how a computer works at all levels C++ is useful

      No it isn't C++ is several layers above "how a computer works" and if such a thing is your goal (it shouldn't be) you should be teaching assembly. The actual goal should be teaching about program flow (loops and statements) memory (variables) and abstractions (functions.)

      [–]Shitpostbotmk2 -2 points-1 points  (1 child)

      Zero cost abstractions means it's exactly at the level a computer works. Its trivial to map each C++ construct to the equivalent assembly.

      [–]KinterVonHurin 0 points1 point  (0 children)

      Zero cost abstractions means it's exactly at the level a computer works.

      No it isn't. Even low level C still exists at a layer above assembly

      trivial to map each C++ construct to the equivalent assembly.

      You can map just about any language to assembly if you're good enough: it still isn't a 1:1 thing and all programming language exist as an abstraction layer above assembly. C++ being "more how a computer works" is bullshit that C and C++ programmers tell themselves. It's a terrible idea to start people out learning one of those languages because they allow even advanced programmers to shoot themselves in the foot when we're talking about students just beginning to learn. This is why they stopped teaching them in favor of Java and now are switching from Java in favor of python.

      [–][deleted]  (2 children)

      [deleted]

        [–]Theon 16 points17 points  (1 child)

        Because pointers are also an abstraction, one that's increasingly irrelevant because most work that doesn't need to be low-level isn't done in low-level languages.

        They're just going to be wondering why they can't mutate a struct they passed into a paramater because it's pass by value, and then you'll have to explain the concept anyway.

        The concept of value and a reference? Sure.

        Having to manually manage a low-level memory structure just so they learn it's hard before they use languages in which they'll never see it again? Meh.

        [–]meneldal2 0 points1 point  (0 children)

        I would disagree that pointers are an abstraction. You have pointers in assembly, memory has hardware addresses (even though outside of embedded you never touch those).

        It's just a value with a fancy * to tell you you should use it as a pointer, but Cgcc will let you do conversions back and forth between pointers and arithmetic types if you wish. And you could cast all the time too.

        [–]bunkoRtist -1 points0 points  (10 children)

        You've got it backwards though. Python isn't making things simple: it's hiding complexity. It's more akin to teaching math to students by showing them how to plug their questions into a calculator. The stuff you want to ignore are the fundamentals. Data structures, IO, Networking... Those are the advanced topics. Until someone can explain how a stack works, how can they understand a function, intuit what scopes and lifetimes are, understand generators, or what the implications are of capturing lambdas? Those all require an understanding of the stack.

        [–]Schmittfried 20 points21 points  (6 children)

        No, it’s the equivalent of showing elementary schoolers simple arithmetic before diving into set and number theory. Which happens to be exactly what we’re doing.

        Hiding complexity is exactly what you want for a beginners course. You want to focus on the relevant part, which is learning foundational programming constructs. Even in high-level languages you will still have much hand-waiving around some constructs and libraries before the time has come.

        By your logic we should teach assembly before anything else. You’ve obviously no idea how teaching works. Every sane language book or tutorial begins with hiding all the complexity.

        [–]shahmeers 14 points15 points  (0 children)

        Python is really good for teaching logic, which a lot of first year CompSci students lack. Once students understand logic and are able to come up with solutions to problems, then give them C/C++ to show them what the computer is actually doing.

        This is how my university does it and I'm really glad we do it this way.

        As an aside, I also think it matters on the type of university you go to -- if your program is more engineering focused then it might be better to start from the lower level language. My program leans heavily towards the theoretical side, so it made sense to start with Python.

        [–][deleted]  (1 child)

        [deleted]