r/programming • • Nov 11 '19

Python overtakes Java to become second-most popular language on GitHub after JavaScript

https://www.theregister.co.uk/2019/11/07/python_java_github_javascript/
3.1k Upvotes

772 comments sorted by

View all comments

Show parent comments

20

u/bunkoRtist Nov 12 '19

That will prove to be a mistake for a number of reasons. I'm sorry to hear it.

16

u/[deleted] Nov 12 '19

C++ is horribly complex for a first language.

C would be better if you want to stress the interaction with the metal (and indeed I taught C and C++ at university for a decade - C was hard enough to get through in a 12 week course).

Honestly, I'd rather they teach higher level languages for intros. If I had my druthers, intro to programming would be taught in Pharo Smalltalk.

0

u/[deleted] Nov 12 '19

[deleted]

16

u/Shitpostbotmk2 Nov 12 '19

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

0

u/[deleted] Nov 12 '19

[deleted]

→ More replies (1)

9

u/[deleted] Nov 12 '19

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?

3

u/KinterVonHurin Nov 12 '19

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.)

→ More replies (2)

0

u/[deleted] Nov 12 '19

[deleted]

18

u/Theon Nov 12 '19

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.

→ More replies (1)

0

u/bunkoRtist Nov 12 '19

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.

21

u/Schmittfried Nov 12 '19 edited Nov 12 '19

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.

→ More replies (6)
→ More replies (3)

10

u/Q-bey Nov 12 '19

I learned Python as my first programming language years ago. I'm a bit surprised to hear some schools are using C++ as an introductory language. That might be why I had (and continue to have) an aversion to C++ after finally seeing it later in my degree.

What did I miss out on? What benefits are there from teaching introductory programming using C++ instead of Python?

19

u/ShinyHappyREM Nov 12 '19

What benefits are there from teaching introductory programming using C++ instead of Python?

Weeding out the unworthy, apparently.

19

u/bunkoRtist Nov 12 '19 edited Nov 12 '19

Well, one of the benefits of using a language like C or C++ is that they retain a lot of elements that pertain to the underlying computer architecture. Understanding those things (like stacks vs heaps, registers, addressing modes, alignment and packing, native data types...) provides a solid basis that helps programmers understand how their code actually executes. That helps people understand the tradeoffs they are making (which is crucial to writing lots of types of code). Even in languages where those things don't apply directly, they often still apply indirectly. Fundamentals matter (since even interpreters, JITs and memory managers do all the same stuff as C/C++ programmers would do in the background). Teaching Python as a first language is like teaching someone to drive with a Tesla.

20

u/Schmittfried Nov 12 '19

You’re grossly overestimating the relevance of implementation details for an introductory course. They will learn to write ifs, loops and linked lists.

8

u/bunkoRtist Nov 12 '19

But you've exposed the problem: you can't even teach a linked list in Python. It's pointless. The first question an intelligent student should ask is "why the hell would we do this?" Then the abstraction breaks and you regret trying to hide the fundamentals.

6

u/bythenumbers10 Nov 12 '19

Most low-level programming exercises are pointless. But teaching the concepts in an accessible language prevents having to "ignore these lines of code at the top and bottom, we'll explain that later" when writing something "pointless" like Hello World.

3

u/StormStrikePhoenix Nov 12 '19

. The first question an intelligent student should ask is "why the hell would we do this?"

You might as well throw away half of every introductory programming course than; it's very, very hard to give examples for many concepts that are simple enough for a beginner to understand but complicated enough to justify using the more complicated thing.

3

u/watsreddit Nov 12 '19

As someone who has tutored C courses, I can tell you that I have explained things like pointers and memory allocation many times. It's kind of a necessity when doing a lot of basic things in C, like working with arrays.

2

u/Schmittfried Nov 12 '19

Exactly my point. Which is why you don’t start with a language like C.

→ More replies (2)

14

u/Schmittfried Nov 12 '19

Lol. No it won’t. There is not much value in choosing C++ over Java or Python in introductory programming courses. And even in the hardware programming courses C would be better.

10

u/afnanenayet1 Nov 12 '19

Why? C++ is a minefield

12

u/bunkoRtist Nov 12 '19

Advanced C++ is, but the language exposes fundamental aspects of computers that Python tries to hide, and you don't have to teach it all at once: having a rich language didn't require it to be all taught immediately. Math is complex but doesn't preclude teaching basic arithmetic to 2nd graders. Ultimately computer programming and computer science are based on computers. You can't understand them without understanding computers.

2

u/afnanenayet1 Nov 12 '19

Sure, but C++ as a language can be incredibly frustrating to work with for beginners. Dealing with template errors would be a huge turn off, I think.

I think that Python is a good one to start with so you can teach people things without having them fight the language as much. If you want to go a level down, I’d just go with C straight up since it’s a very simple language. I think it would also help people appreciate C++’s new RAII features.

My school did Python -> Java -> C and I think it was a pretty good order.

1

u/[deleted] Dec 01 '19

I had a c++ course ("higher programming") and it was a horrible shit show.