Why We Should Teach Python instead of Racket
acbart.github.ioFull disclosure - I took 3 classes in Racket: Intro to CS, Programming Languages, and Compilers.
> Racket is not a very popular language in teaching communities
This list of schools with introductory Racket classes isn't accurate, because the author did not look beyond the naming of the courses on the Github page. My school was missed.
> Students are unlikely to have had prior experience with Racket
This is good because it means students from varying backgrounds of programming experience start from a level playing field.
> Racket’s aesthetic beauty has limited relevance to CS1
Computer Science is first and foremost an ivory tower and students are (imo) better off being confronted with this fact up front. Software Engineering is probably better taught with a more practical language.
> Students do not use Racket again later in their degree
At my school the Programming Languages core curriculum all used Racket. A good percentage of students funneled into at least the first PL-core class as part of their requirements. The class was very popular.
> Students do not like Racket
Sorry, but I don't think we should base our decisions on what Intro students like/dislike. People hate leaving their comfort zone - that doesn't mean they shouldn't be pushed out of it.
> The Design Recipe Is Not Well-Evidenced
Valid criticisms. On the other hand, no evidence is presented that other languages are better.
> At my school the Programming Languages core curriculum all used Racket. A good percentage of students funneled into at least the first PL-core class as part of their requirements. The class was very popular.
Although the article didn't cover it, I think it's important that in the industry, students will be able to find a job/internship that uses Python more than Racket. If both languages achieve the goal of introducing students to CS, why not use something that could benefit students more?
The question is "will teaching python actually benefit students more"?
Having learned Python well before any of the Lisps, today I find it a cumbersome language that doesn't really offer anything above others, and while useful, in an academic setting I'd relegate it to a secondary status of language specific to certain courses that use tooling related to it. I'd probably forgo teaching it at that, as the experience of learning a language on your own (and Python got pretty good materials included for that) is pretty important, and can be supported by one or two workshops to help students struggling with it.
Remember, learning Computing Science at an University is not a vocational course like a bootcamp, that churns out people more or less prepared for churning basic, simple code (not to disparage the students of those, but Bootcamps are by nature simplified). That's not what going to university for a CS degree is for, and every institution that assumed such mindset had their course quality plummet.
> The question is "will teaching python actually benefit students more"?
Is there an argument against it? I ask in genuine curiosity. I am aware that it is not statically-typed and abstract away some of the important concepts in computer science.
What language do you think is more suited? Do keep in mind some of the intro CS classes are also used to warm up non-CS majors to what CS looks like.
The biggest advantage I think it offers is the lowering of barrier to entry. It ignites excitement and removes obstacles to start understanding cs logic so as to say.
Python is definitely more real-world practical. Most students will go on to learn it in future classes anyways though. An Intro class is better off preparing a conceptual foundation that will serve students across many languages and paradigms.
> An Intro class is better off preparing a conceptual foundation that will serve students across many languages and paradigms.
Is there any issue with Python that is against being usable for giving a conceptual foundation? (I understand that it is dynamically typed and abstract away a lot of things in CS) but all of them could be resolved later.
> Students do not like Racket
That is kind of the killer, isn't it? 10+ years of Racket and students still hate it. If they can learn introductory CS without suffering through Racket, why force them to do so? (Disclaimer: I think Racket looks interesting but I have never tried to use it for a project.)
But why not allow students to vote with their feet? Offer Racket and Python and see which course's graduates do better in the rest of the major.
My university has taken this approach. The main intro class is still Racket based, but they offer a Python alternative which satisfies the same requirements. I hope they're tracking the difference in outcomes!
There is no reason computer science needs to be steeped in academia. The only reason why it is so popular in the first place is because it is so practical and applied. Easy to profit from. If you worship your ivory towers, feel free to become a mathematician.
Please don't take HN threads into flamewar. It leads to predictable places, therefore tedious ones, therefore off-topic ones.
I think computer science has every reason to be steeped in academia.
By your logic, the creators of PageRank should have chased after the tenureship rat race like every upstanding academic instead of trying to commercialise.
> By your logic
That does not follow, in any shape or fashion, from what was stated.
I write Python, amongst other things, professionally and have been playing with Racket in the sidelines. I recently started a new project and decided to take the plunge and write it entirely in Racket, so I can actually learn it better: its (extensive) standard library, idioms, quirks, etc. in a real (rather than toy) engineering setting.
Now I love Racket. Whether it’s Racket, or Scheme, or Racket facilitating Scheme, it doesn’t matter, I haven’t had so much fun coding for a long long time! Of course my job isn’t concerned about my enjoyment (at least not primarily), but it turned out to be no harder to code the project than it would have been in Python.
I’m heavily biased towards functional style and I appreciate that this is completely anecdotal, but I’d urge people to jump in :) It took me about a week to become productive in the language and, to be honest, most of that was getting over S-expression syntax and correctly pairing deeply nested parentheses. The documentation alone is a thing to behold! While it’s true that the community is smaller than Python’s, it’s friendly and eager to help; say on StackOverflow, r/Racket or IRC.
I hope I can continue writing it professionally and can convince others in my team to adopt it.
Ive been programming for 20 years and recently started playing in racket and all my faded enthusiasm sprung back and got excited about programming again. Is it that its a new thing to me and we like new shiny things? Well, I find thats not the case. To me it feels that I can express ideas/idioms much much easier within Racket/scheme and after a few weeks i started enjoying the parens quite a bit. I’ve also been playing with htdp libraries and it’s been quite fun, simple and effective. My new personal projects are going to be in Racket now.
Python is a terrible choice as a first language. Idiomatic python is just glue code that obfuscates the underlying algorithms.
Object oriented programming (implementation inheritance) is increasingly regarded as an antipattern, and it encourages that too.
The massive performance penalty of writing logic in python vs calling out to external libraries mostly forces developers to program by lego-brick assembling external modules instead of reasoning about algorithm design.
There’s no concept of types, either, and instead of attempting to detect programming errors early on, it leaves them to runtime.
It’s not surprising that Java and also C/C++ are more popular than python for introductory CS courses.
(I could see using python as an intro course for non-CS majors, fwiw.)
Python is a great first language, because you can learn the basics in an afternoon, but it is still capable of handling (and actually used for) many real-world tasks from robotics to games to scientific computing.
Its low barrier to entry, high reward/effort ratio and quick feedback loop make a good way to recruit potential CS majors!
As others have mentioned, Python's slowness can also require you to pick good algorithms, and its minimal compile-time error checking means that you really need to test your code well and also handle unexpected runtime errors. ;-)
BASIC is a great first language for similar reasons.
I'd say that Python is a good language to learn on your own, but not a good language for teaching computing at higher lever.
Low barrier to entry and quick feedback loop are shared with Racket in this case, and Racket offers much more to learn.
Performance is largely irrelevant for the first teaching language. You can completely ignore OOP (unlike Java) if you want, although you probably should teach students about it at some point. Python doesn't have "no concept of types".
I have TA'd different intro classes that started with those languages, and Python IMHO makes a way better first language than C or Java. Start with it, introduce other languages and their concepts later. I've heard mixed things about starting with functional languages, but I think it can work too.
> Performance is largely irrelevant for the first teaching language. You can completely ignore OOP (unlike Java) if you want, although you probably should teach students about it at some point. Python doesn't have "no concept of types".
That's how my college (Macalester) teaches it. We have two levels of CS class. One in Python, that only covers OOP at the end of the class in regards to GUI/Games.
We have another OOP class where we use Java and we go a little more deeply into CS concepts + Software Engineer Practices.
The first course is intended for anyone wanting to have some view of what CS is. I think it's a good balance.
It also helps that there are good job opportunities with both Python and Java(more so).
> There’s no concept of types
Python is strongly typed, and while it doesn't mandate static type checking, it has several AOT static type checkers available.
It's not Haskell, but then neither are most languages that mandate static type checking.
I disagree, I think python is fine.
Yes, you don't have to complete bonkers OO with multiple inheritance, but in general OO is a win.
Also, python has a pretty good standard library and a pretty elegant module system.
There's also a practical consideration. After you learn python, you will know python. It is a useful language with hooks into just about every endeavor you could do on a computer.
It doesn't matter it’s slower than C/++ or Java . In fact, that’s an advantage; you want your algorithms to be fast because they’re actually good, not just because your hardware is fast. I think you completely missed the point on what algorithms are.
You might look at this answer: https://www.quora.com/Why-is-Python-not-a-suitable-language-...
Object oriented programming is an antipattern?
Can you explain this? I am not a CS major, but I find using classes quite useful.
I suggest searching google for "problems with object oriented programming". There have been countless discussions, articles and videos.
Examples: https://www.youtube.com/watch?v=QM1iUe6IofM https://medium.com/machine-words/the-rise-and-fall-of-object... https://medium.com/@cscalfani/goodbye-object-oriented-progra...
Python has typing as of 3.5, although it’s limited to third party tools. Still useful.
https://docs.python.org/3/library/typing.html
Also why is OOP considered an anti-pattern?
>>>> Specific, formal survey question (T/F style): “Please Indicate if you like and are comfortable with each of the following languages:”
Java: 93% C/C++: 74% Python: 38% JavaScript: 21% Racket: 7%
This is absolutely hilarious. Students are comfortable with C/C++ and Java the most. I guess they haven't seen segmentation faults and null pointer exceptions enough in production ruining businesses yet.
It is kind of funny how almost all of my peers who studied CS ended up wanting to work on ML languages (F#, OCaml, Haskell, etc.) after spending 10+ years with Java, C, C++ or C#. At the time they were learning Prolog and SML they did not like it much. This survey should be done after some time spent on deploying production ready applications for living and see how it will change.
This entire post utterly strains credulity. It has the vibe of a bad Facebook post that your relatives shares that makes you groan.
Halfway through I find myself doubting not merely the authors thesis but wondering if it's meant to poke fun or entertain.
Can statements like
>The hardest thing to capture in this site is the trauma in some students’ eyes.
> I have also seen first-hand the trauma that it has caused students.
possibly be meant seriously?
Was racket the wrong tool to teach programming or did it eat their dog and set fire to their dorm?
I picture Michael Keaton appearing after Geena Davis says c++ c++ c++ saying wait until they get a load of me.
Everything has a certain amount of cognitive overhead. Perceptively python and racket both have fairly low overhead and quick feedback and ought to be in the same ballpark insofar as learning basics.
I wonder if discontent as described derives from dissimilarity with existing material.
A person with some knowledge but not much may be disproportionately dissatisfied with not being able to use such. Speculating that the best students have no problem, the worst students blame the instructor or the materials, the bottom middling who know a little python or Javascript are frustrated that they cannot benefit from existing skills.
Students perception of value of instruction may be a useful metric for the school insofar as attracting students but one questions if the students are the best qualified at the start of their education to access the value of individual components of their education.
"Which programming language" to start with is something people can have strong opinions on. (e.g. I could understand people saying C is a great language to start with, or that C is a terrible language to start with).
There are always going to be reasons why any language will be bad as a first language to learn. I'm sure there will be reasons why a language would be a good one to learn.
Python is a nice language to start with. I think Racket is a nice language to start with, too.
The intro to programming course I took was loosely based off of SICP. (My batch was the last taught using Scheme; the next was taught the same material using a subset of JavaScript).
As an example of something nicer about Racket than Python: There was a nice 'simplicity' to the material. A list is either empty, or some item followed by a list. Computing stuff either deals with a base case, or deals with a recursive case. Almost all the functions we used (car, cdr, map, accumulate, member, etc.) could be implemented with what we'd learned. -- This feels more analogous to seeing how the proof works rather than learning just a bunch of formulae.
Being in lock-down mode, I thought it would be a good time to finish reading (and doing) the "Structure and Interpretation of Computer Programs" that I started many years ago and abandoned. Ever since I read Paul Graham's essays on Lisp, I dreamed that I'd like to be able do build domain specific languages "when I grow up". Life always gets in the way, but I now decided to give Lisp another chance.
And now this. Hm, should I abandon SICP again? Maybe the guy is right that beyond all the grand philosophizing of the amazing power of Lisp there's little substance. On the other hand, I also know the website I'm posting this comment on is built on Lisp. I'm torn.
That's not what he's saying at all. He's saying that it may not be the right language for an intro CS course for typical freshmen. One can argue back and forth about that. But if you want to learn deeper concepts about programming that go beyond a typical intro to CS class, SCIP is a great book and Scheme a great language, and I'm sure the author of this article would agree 100%.
Check out Composing Programs for an SICP in Python https://composingprograms.com
Unfortunately SICP isn't really all that suitable for learning Scheme (or Lisp).
I think most people here are commenting as graduates/professional so I thought I would chime in.
As a student, I love being taught in Python for introductory CS classes. I have been a course assistant as well.
The language is easy to pick and has great/easy applications that doesn't require learning another additional language.
(I am not opposed to learning another and carry the sentiment that you can relatively pick up another language.)
The second part is important to me as a student because I can quickly use it in my web programming projects, in my data-related projects and for scripting purposes as well(I admit I rarely do this).
Great read. I’m a senior studying comp sci at University of Delaware, and I couldn’t agree more! We learned Racket freshmen year - and I can confidently say that Racket had no perceivable advantage to my computer science education over any other language. In fact, the course introduced python towards the end of the semester which made it more of a headache since we had to take a final exam in both syntaxes. It would’ve been better to have used python from the start.
Note: the title is overstated, this is actually a pretty good discussion of Racket and not just the kind of bashing you would think from a title “I hate Racket”.
We did CS courses in C and C++ 22 years ago. I recently did an MsC program at the same University and most courses are being done using Java. But for assignments teachers allow any programming language - if the task permits - so I did mine in C#. Some colleagues used Java, one guy used Python.
How did they handle grading?
Not the commenter you were replying to, but at my uni it's usually feature based. Basically, you are evaluated on whether your code accomplished the task and not code quality.
I've never heard of people having that choice in intro classes though.
Could not agree more. Top schools like MIT gave up on their silly dedication to obscure languages in introductory programming classes and switched to Python. It seems like there was a generation of professors who decided there was a “correct” way to teach computer science and it involved languages completely isolated from the mainstream industry. It’s like teaching someone grammar by forcing them to use Esperanto because it’s “The Best” language (according to tenured professor who doesn’t give a shit about their students).
All Turing complete languages can execute any program. The fundamentals of programming exist in all languages. Teach students using languages with the absolute minimal friction so they aren’t spooked in their first exposure to programming.
Academia has scared away an untold number of aspiring students with their nonsense languages. Such a damn waste of talent. The absolute worst programmers in terms of craftsmen-ship are academics - if you want to see some truly WTF code look at what underpins research papers.
That's ridiculous. It's computer science, not computer programming technician. You teach with the tool that most clearly distills the principles of what you're trying to teach. Racket and Scheme arguably do that much better than Python.
In fact, Racket 15 years ago still has more cutting edge features than Python has to this day. There is simply no language that provides the breadth of features available in Racket, and I don't even use it.
> Academia has scared away an untold number of aspiring students with their nonsense languages
A programmer that's scared or intimidated by learning a new language does not belong in this industry. You might as well say that we should coddle civil engineering students that are scared of computers. If this is a barrier you can't surmount, consider another career.
I thought the person that you're replying to made a very good point about Esperanto. Why do we teach linguistics with messy real-world languages instead of conlangs that most clearly distill the principles we want to teach?
One of the chief concerns in introductory linguistics programs is introducing students to the great typological diversity of the world's languages. There are a number of different ways in which languages can inflect (or not), structure word order, derive new words from existing vocabulary, etc. Conlangs, however, tend to choose a very limited set of approaches, for example agglutinative inflection is popular because creators feel it makes the language easier to learn. Just as some North American departments have been mocked for doing all their theoretical work purely on the basis of English (or other European languages), using a conlang would make students miss out on the full range of human linguistic expression.
All human languages have at least some irregularities, and the way in which speakers deal with those irregularities is an interesting series of phenomena in itself, but most conlangs aim to be fully regular. A similar situation holds for phonology in which most languages have a developed system of allophony and sandhi, but conlangs typically don't aim to represent those phenomena at all.
Right. And doesn't that apply to programming languages too? Aren't the ways that Python is irregular to support real-world needs (the Zen of Python even says "Practicality beats purity") worth CS students studying?
No, because this is computer science and not software engineering. The best introductory language is the one that allows to express the concepts that are presented in the cleanest way possible. If you want "real-world needs" then drop out and work for a software company. The purpose of universities is not to cater to the needs of industry - to pump out code monkeys.
Just to make sure I understand you correctly - you're arguing that it is not the place of universities to address real-world needs? History and economics faculty should have nothing to offer to politicians? Biologists in universities should study model organisms, leaving the study of humans to the medical industry, and biology degree programs should not pump out health monkeys? Law professors should discuss specially-constructed legal systems that are not used by real-world jurisdictions so that concepts can be presented in the cleanest way possible? Music programs should avoid teaching actual Bach chorales because his real-world music sometimes included parallel fifths?
I didn't say anything about areas whose research focus coincides with 'real-world needs', I specifically talked about programming languages and concepts. And no, universities should not teach micro services, enterprise Java code, or the latest frontend frameworks. But yeah, keep twisting my words around.
Sorry, I'm still not sure I understand. You're saying that computer science is one of the specific areas whose research focus does not and should not coincide with "real-world needs," in contrast to history, economics, biology, law, and music? Or am I misunderstanding you badly?
What other fields of study are like computer science in that they shouldn't be about real-world needs? For a given discipline, how do you tell which of the two categories it falls into?
Interesting point. You are mixing up teaching language with teaching linguistics. Teaching linguistics usually includes phonetics, phonology, morphology, syntax, semantics, pragmatics, discourse, typology and semiotics. Quite similar to teaching computer science. The concepts are independent of the implementation. In this context using Python is bad because it has a very limited set of concepts that worth knowing. Racket has many more. In the context of working in the industry Python _experience_ might be more valuable, but it has nothing to do with how good it is to tech computer science.
https://ufal.mff.cuni.cz/~hana/teaching/2015wi-ling/01-Intro...
OK, so you're saying that in universities that teach linguistics (instead of teaching languages), they do in fact strongly prefer to teach in idealized conlangs like Esperanto and avoid working with irregular real-world languages?
Can you give me an example of such a university curriculum?
No, I am saying, universities teaching linguistics are teaching concepts. They might teach how some of these concepts are in a particular language, quite often they choose the language of the country they reside in. It would be hard to teach advanced concepts in Python. That is all.
What advanced concepts are hard to teach in Python?
Also, do you generally teach advanced concepts in an introductory CS class?
> Also, do you generally teach advanced concepts in an introductory CS class?
This is also what I struggled to understand with other comments. An introductory CS class's purpose to introduce, warmup and invite students (most often w/ no background) to the world of CS. This means low barrier of entry. (which Python is well suited for).
Yes, there are other languages that offer more features and more explicitly but the point of intro CS classes is to spark the curiosity with a great feedback loop, while eliminating obstacles to learn.
> Why do we teach linguistics with messy real-world languages instead of conlangs that most clearly distill the principles we want to teach?
Because we're not teaching language science in that case, we're teaching proficiency in an actual language.
An industry language is fine for a software engineering degree, or a technician degree of some sort.
Just to make sure I understand you right - you're claiming that the academic discipline of linguistics is not "language science," it's "proficiency in an actual language", and a school with a "language science" program instead of a linguistics program would teach introductory language science in a conlang?
You can teach the principles of computer science without forcing some obscure and difficult language on new programmers. Learning programming is hard enough, no need to add more bullshit on top of it!
What is particularly more difficult about Racket, other tha maybe using a paradigm you are not familiar with?
Did you read the linked article? It is a pretty thorough explanation along with surveys of students. Only 22% liked racket!
So most people who know almost nothing about programming hate Racket. Can't say I find that compelling.
But they prefer Python.
I think we need to note that the specific population you are referring to is directly the ones who are being affected. It might also be a good idea to consider their input.
I remember in high school when only 20% of my class liked math. We should stop teaching math, right?
> It’s like teaching someone grammar by forcing them to use Esperanto
Or Latin, which for the longest time wasn't called "Latin", but simply something that was taught in "grammar school", because it addresses the underlying fundamentals quite clearly without getting bogged down with semantics. Latin is still used for that, btw, but only in "top schools".
>Teach students using languages with the absolute minimal friction
Say, something with a trivial syntax; something that is easy to express any construct in without too many preconceptions of what a programming language should look like.
If only there was a language like that!
You have an ivory tower elite mindset. My mindset is to actually help students learn and get excited without being scared on day 1.
Save whatever functional nonsense you want to teach for “Obscure Languages 401” class. CS101 should be getting people into programming and teaching them using languages that they can actually do stuff with. If you teach someone python they can do statistical analysis and have a huge number of libraries to start making fun projects with. Teach them Scheme and they switch to the school of communications.
> Save whatever functional nonsense you want to teach for “Obscure Languages 401” class.
Do you also talk to your students like that when, say, one of them mentions an interest in different languages or mentions anything that doesn't agree with your "mindset"?
> using languages that they can actually do stuff with
Didn't you just state: "The fundamentals of programming exist in all languages." ?
I was only commenting on your "minimal friction" that scheme naturally provides and how elegantly fundamentals can be demonstrated by it (right up to and including meta-circular evaluators).
If your argument is that teaching Scheme is as good an idea as teaching Latin, I think there will be no disagreement....