News for hackers. Stuff that matters.
Re:Retiring Python as a Teaching Language by ralusek on Saturday January 06, 2018 @11:25PM (#16089150)
It's unfortunate how despised JavaScript is on Hacker News, because JavaScript is objectively the best language suited for teaching people to program.

Want to work with data from any API? Well JSON, industry standard data protocol, happens to already use exactly the syntax you're familiar with!

Want to give them a sandbox to mess around in...take your pick between jsfiddle, plnkr, codesandbox, etc. Many of these let you collaborate realtime with people to help them work through problems directly. Most people learning to program have 0 familiarity with using a terminal, and having to go through the process of getting an environment set up correctly ALONE is enough to turn off the vast majority of people to programming.

As the author already mentioned, rendering a UI in JS is going to happen on the most ubiquitous platform on the planet: the web browser. If a programmer starting today goes into UI work, the odds are that they'll be building UIs for a web browser is astronomically high, the odds that they'll be using a one-off python toy library is highly unlikely.

And last but not least, the syntax of JavaScript is very much like the syntax for Java and C. Learning JavaScript first makes it very easy to read code from other mainstream languages and have a good idea of what's going on. Particularly with ES6, there is very little to complain about in the syntax of JavaScript.

Re:Retiring Python as a Teaching Language by minimaxir on Saturday January 06, 2018 @11:50PM (#16089243)
There’s a difference between “teaching people to program” and “teaching people to program apps.”

Sure, JS is the hip language for making SPAs, but not the best way to show what boolean logic is and the difference between for and while loops.

Re:Retiring Python as a Teaching Language by arnarbi on Sunday January 07, 2018 @12:55AM (#16089494)
> [JS is] not the best way to show what boolean logic is and the difference between for and while loops.

It's really no worse for that than any commonly used language. Perhaps you meant something else?

Re:Retiring Python as a Teaching Language by ralusek on Sunday January 07, 2018 @06:03PM (#16093270)
JavaScript the language doesn't have to be used for SPAs, or UIs at all. It...has for and while loops (which btw share syntax with all major programming languages), it has boolean logic and bitwise operators.

And I see data structures and algorithms mentioned below...I'm not exactly sure which data structure or algorithm it is that you suspect cannot be expressed in JavaScript?

Re:Retiring Python as a Teaching Language by spraak on Sunday January 07, 2018 @12:01AM (#16089282)
Why can't you reach someone those things in JS? JS has all of what you mention...
Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @12:37AM (#16089432)
Using JavaScript to teach the design of appropriate data structures and algorithms for a computational problem is bound to be an uphill battle.

And anyone who seriously considers teaching a first language that students can't use in a data structures and algorithms course (without having to learn a second language) isn't worth paying much attention to.

Re:Retiring Python as a Teaching Language by JCSato on Sunday January 07, 2018 @01:47PM (#16091995)
"And anyone who seriously considers teaching a first language that students can't use in a data structures and algorithms course (without having to learn a second language) isn't worth paying much attention to."

Why? Both colleges I've been to had their DSA courses after at least two intro courses, and in a different language than the intro courses.

What is so inherently contemptible about this?

Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @06:56PM (#16093572)
Did they give you a formal semantics for the language in which you implemented algorithms? Or did you merely “prove” things about informal descriptions of algorithms?
Re:Retiring Python as a Teaching Language by JCSato on Monday January 08, 2018 @02:24AM (#16095202)
No, proofs were usually done in an entirely separate class later, with the DSA classes focused on data structures (stacks, heaps, hash tables, etc.), sorting algorithms (merge sort, quicksort, etc.), and efficiency (e.g. using Big O). Such was the majority of the content in both cases, at least.

I still don't really have an answer to my question, though. What makes using a different language such a poor choice in this context?

Re:Retiring Python as a Teaching Language by catnaroek on Monday January 08, 2018 @03:47AM (#16095488)
> No, proofs were usually done in an entirely separate class later

Okay, now that is contemptible. And you didn't address my question: Were your proofs about actual programs, or merely about informal algorithm descriptions?

> What makes using a different language such a poor choice in this context?

The fact you would waste too much time teaching a second language at a sufficiently rigorous level to write proofs about programs written in it.

Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @02:17AM (#16089726)
Why can't you use javascript in a data structure and algorithms course?
Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @02:36AM (#16089780)
You can, but it won't be as pleasant as using something more appropriate. Proofs are a big part of any decent data structures and algorithms course. So you want a language that makes it possible for students to prove things about programs written in it, without hand-waving away large parts of its semantics.
Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @03:01AM (#16089833)
> Proofs are a big part of any decent data structures and algorithms course.

There is no need for anything more than a loosely agreed upon pseudo code for for the proofs though, actually many proofs can be made without any code.

> So you want a language that makes it possible for students to prove things about programs written in it, without hand-waving away large parts of its semantics

You can write proofs in any language. I'm not convinced that using a language that is easy to automatically prove correctness of is useful for learning proofs. If anything it's the perfect opportunity for syntax and semantics to blind the student to the fundamental assumptions and arguments that allow them to understand and write proofs.

Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @04:48AM (#16090122)
> There is no need for anything more than a loosely agreed upon pseudo code for for the proofs though, actually many proofs can be made without any code.

The proofs have to be related to the code. Otherwise, you're just inviting sloppiness and hand-waving.

> I'm not convinced that using a language that is easy to automatically prove correctness of is useful for learning proofs.

I'm talking about writing proofs by hand, the good old-fashioned way. It is easier to prove things by hand about Java programs than JavaScript programs, and it is easier still to prove things by hand about ML programs than Java programs.

Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @08:32AM (#16090792)
> The proofs have to be related to the code. Otherwise, you're just inviting sloppiness and hand-waving.

I disagree. Prose based proofs can just as rigorous as proofs using code, or mathematical notation or images.

> I'm talking about writing proofs by hand, the good old-fashioned way. It is easier to prove things by hand about Java programs than JavaScript programs, and it is easier still to prove things by hand about ML programs than Java programs.

As am I! I think we might be talking passed each other a little.

Why is it easier to use a language like Java to formulate a proof exactly?

What are we talking about proving? The abstract algorithms being implemented or the implementations themselves? I was under the impression it was the former and I believe you are too but I'd prefer to be explicit.

Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @01:37PM (#16091952)
> I disagree. Prose based proofs can just as rigorous as proofs using code, or mathematical notation or images.

You can use pictures in your proofs if you want. But the proofs have to be about the actual program you have written, rather than some pseudocode claimed without justification to be equivalent to it.

> Why is it easier to use a language like Java to formulate a proof exactly?

Proofs are written in the language of mathematics, not Java or any other programming language.

However, Java programs are easier to prove things about than JavaScript programs because Java has a richer static semantics that you can use to discharge parts of your proof obligation simply by checking whether your code is a legal Java program. For instance, you can associate to each final class a set of object invariants, defined in terms of its public methods. Java's static semantics is not powerful enough to actually establish these object invariants (you have to do that yourself), but it is powerful enough to prevent users of a final class from breaking invariants that have been established by its implementor (provided users don't use certain misfeatures of the Java language, like reflection).

> What are we talking about proving? The abstract algorithms being implemented or the implementations themselves?

Both. A high-level programming language ought to allow you to express algorithms directly, without distracting you with irrelevant details. (Of course, Java doesn't always do this.)

Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @02:37AM (#16089788)
What makes one language or another "more appropriate"?
Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @02:43AM (#16089801)
Sorry, I edited my previous comment to clarify what I mean by “more appropriate”.
Re:Retiring Python as a Teaching Language by quotemstr on Sunday January 07, 2018 @01:32AM (#16089600)
Am I the only one bothered by the growing use of the word "objectively" as a general-purpose intensifier? That's not what it means.
Re:Retiring Python as a Teaching Language by valuearb on Sunday January 07, 2018 @12:07AM (#16089313)
The lack of types is just one thing that disqualifies JavaScript from teaching serious computer science concepts.
Re:Retiring Python as a Teaching Language by hajile on Sunday January 07, 2018 @03:09PM (#16092393)
You don't hear people say C isn't a serious CS language, but it is about as typed as JS.

C is weakly typed and has implicit conversion. JS is weakly typed and has implicit conversion.

You most certainly mean static types, but even there we have issues with C because passing void pointers is a thing for generic ADTs. This is even weaker typing than JS offers (and that's without talking about the interactions with function pointers).

An even stronger argument against your position on static types is SICP. It's written in scheme, but I have yet to find an introductory book more packed with CS fundamentals. You can read it multiple times and learn new things (very rare for a book to speak to both the experienced and the novice).

If static types were really important, Java, all the C's, and most common be CS language would never be used and Standard ML would reign supreme (perhaps it should anyway).

Types are simply one weapon in the war between elitism and pragmatism.

Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @02:19AM (#16089730)
Javascript still has types, they just aren't enforced. Why is strict typin required for "serious computer science concepts"?
Re:Retiring Python as a Teaching Language by charlysl on Sunday January 07, 2018 @12:26AM (#16089390)
Js quite limited for teaching, no concurrency for instance
Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @02:31AM (#16089767)
setTimeout and non-blocking io produce out of order execution.

What more concurrency are you looking for?

Re:Retiring Python as a Teaching Language by charlysl on Sunday January 07, 2018 @06:55AM (#16090504)
You have a point, I shouldn't have said "no concurrency".

You are restricted to what ammounts to coroutining, which is just one of the many concurrency techniques out there, none of which you can teach with javascript.

You wouldn't be able to show many of the other possibilities of concurrent programming.

Re:Retiring Python as a Teaching Language by iovrthoughtthis on Sunday January 07, 2018 @08:27AM (#16090777)
I agree, JS is absolutely limited for teaching concurrency.
Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @12:43AM (#16089454)
I'm guessing you mean “no parallelism”, right? Because JavaScript has (admittedly horrible) concurrency support. Otherwise what's this “callback hell” some people complain about?
Re:Retiring Python as a Teaching Language by charlysl on Sunday January 07, 2018 @12:59AM (#16089505)
By concurrency I mean expressing in the language that a computation or operation is independent, for instance by putting it in a thread or making it lazy, and all the programming techniques that this enables: active objects, order finding (which plays very well with paralellism btw), etc.

Parallelism I see as a hardware feature that can make programs faster.

I thought about the "callback hell", this is a bit more like coroutines, a quite limited form of concurrency (like non-preemptive threads). In this sense Js is very limited in what programming techniques can be taught.

Re:Retiring Python as a Teaching Language by falafel on Sunday January 07, 2018 @12:48AM (#16089470)
Callback hell? What is this 2010? Callback hell is a non-issue in modern JS code with promises, and async/await.
Re:Retiring Python as a Teaching Language by catnaroek on Sunday January 07, 2018 @02:35AM (#16089778)
Promises don't eliminate callback hell any more than objects eliminate their underlying data structures.
Re:Retiring Python as a Teaching Language by doug1001 on Sunday January 07, 2018 @12:19AM (#16089359)
seems Khan Academy agrees with you, and has for some time (~ five years, perhaps more)