6 ms·
When I took an introduction to Computer Science in college, it was taught in Racket. Over winter break, I then learned Python, and I was baffled -- why would an
by johnloeber 12y ago
When I took an introduction to Computer Science in college, it was taught in Racket. Over winter break, I then learned Python, and I was baffled -- why would any curriculum not start with Python? Python was easy, expressive, and allowed the user to get lots done with little effort. It was great at motivating programming by showing its use and power. It seemed like an ideal introductory language.
Over the last few years, however, I've back-tracked on this opinion: if you really intend to teach, not just motivate, then Python is a poor choice. A language like Racket is great for teaching because it lends itself to exploring so many core concepts: complexity of algorithms, functional programming techniques, recursion, data structures, etc.
A language like C (the next course I was to take in the introductory sequence) is also an excellent language because it forces the user to understand programming at the systems-level.
I don't really think Python is very good for illustrating either the theoretical or the systems-level CS concepts. It's a nice language for motivating programming and showing off how much you can do with little serious investment, but it doesn't really motivate learning Computer Science, i.e. learning Programming on a 'deeper' level.
Thus, I don't really think that learning Python offers solid programming foundations. Consequently, if you really aim to teach, not just to motivate, then use languages that bring the student closer to core CS concepts.
- rattray 12y agoIf "programming foundations" must include memory management etc, you're certainly correct. However, there's a reason they use Python for intro classes at eg; MIT[0] - the language gets out of the way so you can focus on CS basics. Once you get control flow and the like, you can start to explore complexity et al. [0] http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
- hga 12y agoNo, Scheme was that language. MIT now uses Python because when the dot com crash cratered enrollment, which dropped by more than half after being steady and high for decades, the EECS department and I gather some higher ups panicked. They also made the 2 new mandatory introductory courses much more EE and "gadget" heavy. (Another input might have been the school having committed an insane quarter billion dollars to build a "showpiece" (but not very functional) building for CS research.)
- robbrit 12y agoOne of the first steps in teaching is motivation.
- platz 12y agoBeginners that aren't in a formal class setting (and his description more closely describes mentoring someone outside of the classroom (son/daughter)) have not yet made the decision to invest in learning things from first-principles as a university student has already locked into doing. So, for these beginners there must be some kind of reward or immediate application for their efforts if we even expect them to continue past the stage of early burn out. This is what the post speaks to.
- techdragon 12y agoMany university students aren't locked in either, and so are still in need of motivation.
- saraid216 12y agoIt's important to ask "teach what?" There are a lot of foundations that simply aren't going to be relevant to large subsets of students. Teaching C, for instance, is nearly useless if you're trying to convey FP concepts or object-orientation. I certainly support including C as a core part of any university's Computer Science curriculum. But such a curriculum should include as many languages as possible, each deliberately picked for what it can emphasize and convey. For a Computer Science curriculum, any discussion about language choice that doesn't end in at least three picks is, to me, a failure. But there is a lot of learning to program that happens outside of university settings. Students who have no explicit professor or TA to talk with need wider community support. They need more basic guidance. In these cases, a language like C would do poorly: there are too many systems-level concepts that need to be understood before it stops feeling like magic. For this, Python is far superior to C, because it makes understanding what you're doing far more accessible far sooner. Whether or not Javascript is a better choice for this than Python is something I'm undecided on. I can see the merits offered in the OP, but I'm not convinced they outweigh the faults in JS. The newbies I give recommendations to generally have an interest in going into data analysis. I think Python is the better choice for that, as a language that can form a bridge between "whoa, hello world" to, say, playing with scikit, and if they end up going in a different direction, they're unlikely to have picked up any particularly bad habits. Javascript? I am not convinced. (This sort of stopped being a response to you in particular and turned into a response to the OP, but it'd be confusing to move it now. So... whatever.)
- _pmf_ 12y ago> Teaching C, for instance, is nearly useless if you're trying to convey FP concepts or object-orientation. C is superb for teaching how to manually implement polymorphic behavior in the absence of object-oriented features. Using it to demonstrate how (class-based) OO languages work should be standard in any course that has CS in its title. (Using it to demonstrate how to implement prototype-based inheritance would be an advanced course).
- cbd1984 12y ago> C is superb for teaching how to manually implement polymorphic behavior in the absence of object-oriented features. Building a complex language from scratch is fine, but doing it by extending C isn't the best way. I happen to like C. I'm good at C. I understand the C mindset, to the extent it has one, and it isn't especially conducive to OO. (It's absolutely horrible with FP, because the fact you have to manage memory manually does terrible things to function composition.) Which would be fine, if C were actually a low-level language. It isn't. C gives you a simplified, high-level machine model. It isn't that close to the machine; if it were, you'd have access to things like SIMD hardware and everything else C can't give you because it would break portability. (OK, you could possibly have access to them if you used C to implement an interpreter for a virtual machine. But that kind of defeats the purpose.) So sure, implementing a non-trivial programming language is a fine goal; however, I'd do it by generating assembly language, because doing it in terms of C forces the programmer to adopt C's limitations (every function has a single return value because there's no real stack access; there's no access to processor flags; no access to parallelism of any kind; etc. etc. etc.) for no real benefit in that context. (School projects don't have to be portable.) Edited to add: And if you're writing a compiler, C isn't especially interesting. Haskell and parser combinators are interesting; Common Lisp and macros are interesting; Python is, again, not especially interesting, but at least with Python you're debugging errors related to the problem domain, as opposed to errors related to the intricacies of manual memory management. (Edited for comprehensibility as well.)
- fleshweasel 12y agoI am really happy that I took the time to teach myself Racket in supplement to (really more importantly than) my introductory programming classes in Java. I was way better equipped to design programs in a good way because of it.
- fchollet 12y agoTeaching is made of two components: access to knowledge, and motivation. Today, access to knowledge is almost entirely irrelevant: pretty much all knowledge is freely accessible from anywhere, anytime. You just need the motivation to look it up. Teaching yourself can be easy, if only you have the drive to keep at it. It wasn't the case in our past. In the middle ages, before the printing press, teaching was 99% passing on knowledge, and motivation was assumed to be a given. Today, in the post-internet age, access to knowledge is a given, and teaching is 99% motivation.
- yodsanklai 12y agoI think there are other components that are at least as important. You need to know what to learn and be able to organise your time properly. A teacher sets a roadmap and intermediary objectives.
- mkesper 12y agoHonestly, no. If you've got no overview, you'll not "surf the internet" but get drown in irrelevant or outdated stuff which exists in abundance.
- jacquesm 12y ago> pretty much all knowledge is freely accessible from anywhere, anytime. If only that were true. http://data.worldbank.org/indicator/IT.NET.USER.P2/countries?display=map http://data.worldbank.org/indicator/IT.NET.USER.P2/countries... It's getting better every year but we're definitely not there yet.
- TheOtherHobbes 12y agoGuided presentation of knowledge. Not access to knowledge. Admittedly a lot of uni teaching is just a data dump. But the data dump at least tells which topics to investigate, and regular reviews tell you when you're not getting it. Without that you may never know why - say - compiler design is important in CS, and not just to compiler writers.
- dade 12y agoand does JavaScript: the replacement he is going with, offer all these points you articulated that makes Python not much of the best language to bring student closer to core of CS concepts?
- asgard1024 12y ago> Thus, I don't really think that learning Python offers solid programming foundations. I agree. But there is a huge class of people that this argument tends to miss - all the people who learn programming as a tool and not a way of life, like scientists or engineers from other departments. For those, it's ideal to learn one language, and it's OK if they don't completely understand CS. For them it's better to know a language that has wide range of practical applications. So unless you are absolutely sure that you're going to learn CS, I would still suggest Python as a first (and possibly only) language. I would also say that doing GUI in like PyQt is really easy, but the documentation and tutorials are lacking.
- coffeecheque 12y agoThis is a really good point. I am not a programmer at all, but did learn a little bit of ASP.NET at university. I never use it anymore, but I ended up teaching myself PHP. I use PHP regularly, not to build anything grand - but it gets me by. I can write little scripts like working out who's unfollowed me on Twitter, small information systems, reminder applications, hack Wordpress plugins, etc. I wish I was taught Python at uni right out of the blocks. I've tried to learn it a few times, but ended up forgetting to do lessons and just going back the the crutch that is PHP. The theory of CS is way beyond me at this stage of life, but a little bit of programming knowledge is a very useful thing (even if it is only PHP)
- phatfish 12y agoIf you can understand the the core ideas of data structures and how to manipulate them (Arrays, Loops, Conditionals, Objects etc.), and can put that understanding into practice to solve a problem, you really are 90% of the way there. Learning another language is easy, just try it :) Also a language like Python really is a breath of fresh air if your only experience is PHP.
- johnloeber 12y agoYes, that's a good point. Some people might not actually need to cultivate a deep understanding of CS -- they just need a tool to get the job done. Not everyone who uses a hammer needs to take carpentry lessons. In that sense, Python can be a very appropriate choice.
- DanFeldman 12y agoThat's the approach Berkeley CS (and a lot of other CS programs, but I can only speak to UCB's coursework). The first CS course teaches fundamentals of computer science, using (mainly) python, but also Scheme and a declarative language to explore the concepts.The subsequent coursework exploring Data structures/Algorithms uses Java, and then system-level architecture uses C and MIPS. Every professor is extremely careful to make sure nobody leaves the course believing "This was a python course" or "This course taught me Java"; rather they emphasize the topics covered, using whichever language as the tool for exploration. Python is a great choice in this regard BECAUSE of how rapidly prototyping happens, perfect for a course built for exploration.
- sitkack 12y agoScheme is excellent, but Python only lacks a couple features that can mostly be bolted on or used from a different interpreter (tail calls, Stackless, etc). Some languages make exploring certain concepts easier, but the lack of that feature isn't a hard barrier. I think learning efficiency is an exponential function of the latency between hypothesis and result. Python just happens to have great tooling to minimize that.
- SilasX 12y ago> A language like Racket is great for teaching because it lends itself to exploring so many core concepts: complexity of algorithms, functional programming techniques, recursion, data structures, etc. ... >I don't really think Python is very good for illustrating either the theoretical or the systems-level CS concepts. It's a nice language for motivating programming and showing off how much you can do with little serious investment, but it doesn't really motivate learning Computer Science, i.e. learning Programming on a 'deeper' level. Could you explain what you mean by Racket lending itself to algorithm complexity, recursion, etc better than Python? I really don't see why one or the other is more conducive in this respect.
- wedesoft 12y agoRacket has hygienic macros.
- jarcane 12y agoRacket is a descendant of Scheme, and shares its roots as a great playground for fundamental functional programming concepts, while also allowing for impure approaches as well, making it a great chance to compare and contrast styles. It's also tail-call optimized just as Scheme is, so recursion is generally safe. The documentation is also almost obscenely robust, the teaching languages provide a great sandbox for easing into various concepts, and the learning material in How to Design Programs is more or less a complete first-year zero-programming-required CS text.
- DanBC 12y agoHome computers used to boot to a BASIC interpreter. To do anything you needed to use a little bit of BASIC. Looking at HN threads we see many people who claim this one thing created very many programmers. But back when it was happening we had teachers giving remedial classes to force BASIC users to "unlearn" bad habits. (There's probably a "BASIC considered harmful" somewhere). What language would you recommend for 8 year olds?
- the_af 12y ago> (There's probably a "BASIC considered harmful" somewhere). Edsger Dijkstra: "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." I do not subscribe to this opinion. I think BASIC (at least the flavor Dijkstra was talking about) does encourage bad programming habits, but everything can be remedied with exposure to better languages and practices. I actually agree with you: BASIC helped make a lot of people interested in programming. I know GW Basic, and later Quick Basic, did this for me.
- Turing_Machine 12y agoI agree with the article that JavaScript is a good choice. Nothing to install. No way (or there should be no way) to accidentally wipe the disk. Easy to share your code. Now, JavaScript certainly has some ugly parts, but the difference between it and the old-school BASICs is that it's possible (with care) to avoid most of the ugly parts in JavaScript. That wasn't possible with BASIC.
- jbergens 12y agoI totally agree but when they what to use the disk it requires NodeJs or similar and then you can wipe the disk again. But it easy to start safe.
- Turing_Machine 12y agoIf you just want to persist data between sessions, you can do quite a bit with HTML5 localStorage.
- collyw 12y agoAll of the concepts you say Racket is good for could be done in Python (ok, functional programming not so much, but I certainly do bits of functional programming with it). At the end of the day most jobs in the real world want to get stuff done rather than explore CS concepts. Visual Basic was a very popular choice for many years despite being a poor language. I am sure it was simple enough for many people to start programming (that has benefits as well as downsides).
- mamcx 12y agoThat is the assumption that lean to divert the focus to something else, like for example, math (A lot of "intros" to programing are really math with computer). I have a FAR different education. I start with Fox 2.6 (DOS) and Acces. At the end of the semester, We have a FULL done application with: Menus, Forms, Small procedures, database, Reports, with colors and very crude idea of custom controls. From the side of Acces, we get the idea of how a Windows application was done. This was NOT the university. The university teaching was so useless in comparasion (I was the one to teach the OO classes, because the teacher don't have a clue about it. And that was the 2d semester). Then the instrucction of algos was terrible. And so on. ---- Rant objective? Good, focused, NOT DIVERTED, teaching is far better than the core language. I have done some teach, and know dozen languages.. I believe python/pascal are far better to start - and probably pascal, if we want a C-like understanding without the badage of slow tools, weird syntax and crazines of the C family, but well, that my thing- and don't see why it could be problematic to teach any of the fundamental concepts of programing. The key thing, apart of the quality of the teaching, is the focus. I think if the goal is teach "programming" in the general sense, python/pascal are the better. C, C++, Haskell, Java requiere a lot of divertion of the attention (setup and take care of a project, do make files, wait... wait...wait, "monads"?, etc). In contrast, if the teach is learn how "a computer works" so C/C++/Pascal/ADA could be great. Again, is the focus.
- dragonwriter 12y ago> A language like Racket is great for teaching because it lends itself to exploring so many core concepts: complexity of algorithms, functional programming techniques, recursion, data structures, etc. You can explore all of those in Python, even though some may not be idiomatic in Python (many FP approaches), and some may not be suitable for non-trivial use in Python (recursion). And, in fact, there are plenty of introductory CS course that do use Python to explore all of these. > Thus, I don't really think that learning Python offers solid programming foundations. Languages don't offer foundations, curricula do that. And for a solid programming foundation, I think a curriculum that does that can be organized around almost any language -- there's a small set of essential features, but very few languages don't have serviceable implementations of what is minimally needed.
- iwannayoyo 12y agoI agree with everything you said about what makes racket a great fundamentals class, but I think you left out a key advantage. Most people haven't seen racket. Kids who took some basic CS course beforehand, but have to take the college introductory course, are practically level with kids who haven't seen anything.