7 ms·
a language without types, without extensive research? Then, why not C/D/Pascal. i strongly believe for universities sml/ocaml/haskell or even rust are far bette
by fithisux 12y ago
a language without types, without extensive research? Then, why not C/D/Pascal. i strongly believe for universities sml/ocaml/haskell or even rust are far better choices. I prefer sml.
- aruss 12y agoPython's syntax is a breeze to get ahold of without any experience making it ideal for introducing people to CS and algorithmic thinking without overwhelming them with theory or syntax. Also, a lot of colleges (at least the best ones) offer functional programming in a second semester intro course (Berkeley does Scheme I believe). My own institution uses SML.
- brianchu 12y agoBerkeley's first intro CS course uses Python for 2/3 of the course, then uses Scheme. The final project is writing a limited Scheme interpreter in Python. To further clarify, Java is used in Berkeley's 2nd CS class (followed by C & MIPS in the 3rd intro class).
- sankethkatta 12y agoBerkeley's intro class was entirely in Scheme up until a few years back (2011) when they switched to Python. It switched when the course's professor (Brian Harvey) retired, he wrote a great post of his thoughts on Scheme vs Python http://www.cs.berkeley.edu/~bh/proglang.html http://www.cs.berkeley.edu/~bh/proglang.html
- baq 12y agorust? please. maybe 3 years from now, once it matures. python is good for teaching programming because it's easy to read - a feature that not a single language you mention can brag about.
- Igglyboo 12y agoIt's easy to read and it just makes more sense when someone only knows English. I could show this to my 80 year old grandmother and have her understand what it does with minimal help on my part. word_list = ["hat", "dog", "cat"] for word in word_list: print(word) The same example in Java isn't extremely hard to understand, but it definitely is a decent jump in complexity from the almost plain English syntax of Python. String[] word_list = {"hat", "dog", "cat"} for(int i=0; i < word_list.length; i++){ System.out.println(word_list[i]); } EDIT: Forgot about Java's foreach operator, but even so with java you then have to explain what String[] means and the keyword "in" makes for an easier read than (String string: strings) and System.out.println vs print String[] word_list = {"hat", "dog", "cat"} for(String word: wordlist){ System.out.println(word); }
- Dewie 12y agoTo be fair, couldn't you use java's foreach instead of the regular for-loop? It makes things a bit less noisy.
- valarauca1 12y agoString[] word_list = {"hat", "dog", "cat"}; for(String a: word_list) { System.out.println(a); } extra brackets but pretty identical
- mickle00 12y agoNameError: name 'string' is not defined. :) print(word) means it's even easier for grandma to understand!
- codygman 12y agomapM_ putStrLn ["hat", "dog", "cat"] I'd say the above is pretty simple if explained after: putStrLn "hello world" You don't really have to go into Monads for this to be understood/used. You can just leave it at "you use functions ending with an M if they do something like print out to the screen or get stuff from a web page".
- achal 12y ago
- seanmcdirmid 12y agoIs your name Bob Harper? :) Functional still isn't that popular, in spite of a few vocal supporters. Even MIT went from scheme to Python for their sicp training.
- fjh 12y agoMany of the better European universities teach FP languages in their introductory courses. Off the top of my head, Oxford and Edinburgh use Haskell and Cambridge teaches Ocaml.
- pjmlp 12y agoFCT UNL in Portugal used to have Camllight, Prolog, logic programming and lambda calculus, when I did my degree in the mid 90's. Other Portuguese top level universities offered similar choices.
- seanmcdirmid 12y agoDoesn't Wadler teach at Edinburgh like Harper teaches at CMU? I'm sure many French schools are into OCaml also. European computer science has traditionally been more theoretical than American computer science, but even in Europe you'll find that a lot of 101 courses teach in Python.
- deleted 12y ago[deleted]
- lmm 12y agoCambridge teaches SML, not OCaml, unless it's changed in the last couple of years.
- deleted 12y ago[deleted]
- deleted 12y ago[deleted]
- tdicola 12y agoUnless your university is really weird, I can guarantee you will learn many more languages than just the intro language. When I got my computer engineering degree in the early 2000's I was exposed to C, C++, Java, Scheme & Lisp, SPARC & 68k assembly, and even a bit of Python. Learning Python as the intro language instead of C++ would have been much nicer for folks who were completely green to programming.
- beamatronic 12y agoI would hope that no one in a freshman CS program is "completely green to programming".
- aceofspades19 12y agoWell some introductory CS courses are taken by people in other majors. At my university, all science majors(as far as I know) have to take at least 1 introductory programming course. In that context, it makes sense to use python to introduce the concept of programming to people.
- Igglyboo 12y agoI assure you there are many that are. My first year at uni was filled with classmates that could barely operate a computer, there were many like myself that already had a good handle on programming and cs fundamentals but we weren't the dominant group. Most of the greens dropped out/switched majors after a year once they realized how hard it was. I hear from a lot of parents equating spending a ton of time on a computer with being tech savvy and a natural fit for computer science, this may be why most of them tried it out.
- bookface 12y agoSeriously? What do you think it means to be a freshman? I am getting seriously tired of this attitude in the software community that you're only a legitimate programmer if you've been doing it since you were in diapers.
- npizzolato 12y agoThat's ridiculous. What level of skill do you expect in an introductory program aimed at freshmen? Because that description sure seems like it should be tailored to someone completely green to programming to me.
- Yunk 12y agoSML is great, but based on the UW paradigms course, I'd say it gets a lot of backlash from students wanting something common in industry. Transitioning first classes from C to go would make great sense, but it looks like a lot of schools already replaced C with Java and C++ as first languages. Personally, I do think there is merit in teaching a primarily imperative language first, if only to appreciate other paradigms later and get an inkling of what is really going on beneath your code.
- brudgers 12y agoWhat I took from the Coursera version of the UW course was that SML gets out of the way and let Grossman cover the material at a higher level of abstraction than language syntax. On the other hand, his Programming Languages class is not intended to be introductory. I won't say anything about Python.
- Yunk 12y agoI also thought SML worked quite well at that level, but I think the initial negativity on the forums about an unknown language reflected what to expect from a larger portion of 101 students. > I won't say anything about Python. I will try to learn from your wisdom.
- brudgers 12y agoI was in the second iteration. There were still plenty of people calling for a pony and M&M's for breakfast. I can only imagine the first iteration. SML worked well because it's more or less dead. All the documentation is basically on a single unsexy website. There aren't a bunch of blogs cluttering up Google results or even much on StackOverflow. Racket also has a single Canonical source and good clear documentation and not much noise. I can't say the same about the Ruby ecosystem, where I saw this crazy construct in lieu of a call to super posted in a forum question. The TA asked how the person arrived at it. I knew the answer because I had landed at the same StackOverflow page from Google earlier in the week. Which is not to knock Ruby. I understand why people describe it as beautiful.
- Dewie 12y agoIt's the language for an introductory course, so it's purpose is more of a gateway language than as a be-all-end-all language. Rust would probably be too strict and annoying as a first language. Maybe the same is the case for Haskell, but maybe it isn't such a big deal for those that haven't been "spoiled" by imperative languages and thinking already.
- mimighost 12y agoPython is definitely more friendly than those you've mentioned. I think as introductory courses, the number one goal to achieve is to get students interested, rather than throw every possible details at them and intimidate them away.
- _delirium 12y agoI've seen Processing used in some intro courses for that reason, because the time-to-interesting-experimentation is fairly low (similar to the goal of Logo in the '80s, which was my own first language, although I think Logo was much better as a programming language). I don't think it's a common first language in intro-CS programs, but there are a number of curricula being built around Processing outside the context of CS majors.
- brudgers 12y agoProcessing is a good candidate because it allows a novice to make something interactive and interesting in very few lines of code. The downside is that they wind up typing things about which they understand nothing...e.g void setup {···}. And it's not like void will really make sense after two weeks. On the other hand, placing the mastery in the executing artifact, not the underlying code, might be a good thing.
- boomlinde 12y agoI think pyprocessing (https://code.google.com/p/pyprocessing/ https://code.google.com/p/pyprocessing/) makes an excellent middle ground here. It implements much of the Processing API in Python, without making an effort to hide the underlying principles of the language (like Processing seems to do for better and for worse).
- dragonwriter 12y ago> i strongly believe for universities sml/ocaml/haskell or even rust are far better choices. Rust is a horrible choice now, because it hasn't stabilized. When it has stabilized, it may be a suitable choice (at one point, it looked like it would be too large of a language to a be a great intro language, but since then its been getting smaller, so I'm less convinced that it will remain unsuitable for that role.) Python's a pretty good intro language; as is Scheme, and Haskell might be, though I haven't seen any good intro-to-programming material built around it, and while I think a good intro should prefer a largely-functional style (as the best Python and Scheme-based courses I've seen have), I'm not convinced that a pure FP language is ideal for an intro to the field (though it certainly a good thing to learn in the course of an education in the field.)
- quasque 12y agoThe computing courses at my university use Haskell in the introductory programming course - apparently it works rather well as a vehicle for exploring algorithms and data structures. The students move on to Java, C++, Perl, Prolog and others after that; not sure about Python.
- danieldk 12y agoThe computing courses at my university use Haskell in the introductory programming course - apparently it works rather well as a vehicle for exploring algorithms and data structures. I think a strict language in the ML family would even be nicer, because students wouldn't have to reason about laziness.
- ufo 12y agoRust killer feature is the interaction between the type system and memory management. I don't think this is the sort of thing you want to worry about in an troductory class...
- fithisux 12y agoI made a mistake to suggest it. But the purpose here is to learn something in parallel. Pattern matching/ Types or even lambda calculus are good to introduce with the language. Python is good if you have an algorithms/data structures course, students are not required to optimize for a hardware, only algorithmically.
- freyrs3 12y agoIndeed, the discipline of computer science is really the study of computation and the ideas we want to convey from a first language are things like abstraction, recursion, proof by induction, equational reasoning, sequential/parallel time-complexity. It's much easier to address these foundational concepts in a functional setting (Scheme, SML, etc) and then once undergrads know how to formally reason and do proofs about their programs introduce other languages.
- phkahler 12y ago>> the ideas we want to convey from a first language are things like abstraction, recursion, proof by induction, equational reasoning, sequential/parallel time-complexity. Really? I thought good old imperative programming was the best starting point. Concepts like assignment, branching, looping. IMHO goto is actually useful at that point and structured programming is an abstraction that takes a little while to wrap your head around. Perhaps it's due to the way I learned that I think some things are more basic (no pun intended). Either way I don't think high level abstract concepts like functional programming are even relevant in the real world of software development - abstract stuff is CS, basic stuff is for everyone else who has to take a programming course.
- lmm 12y agoI'd say just the opposite. Variables are hard, in a way that you don't even notice as an experienced programmer, but when we write x = 1 x = 2 that's immediately very confusing for a beginner - are we saying that 1=2? If we stick to immutable values and recursion, and functions that are, well, functions, we get something that corresponds quite closely to first-year mathematics, which makes it easy to learn at the same time.
- dragonwriter 12y agoMost Python material that I've seen that is an intro course makes limited use of changing variable [1] values , being written in a mostly-functional style (generally, preferring, at least initially, recursion to iteration to achieve that -- even though recursion is generally the wrong approach in production Python code.) Using a modern imperative language doesn't prevent you from adding complexity a bit at a time, and -- especially initially -- getting the advantages of teaching things in a functional style. [1] but not object fields, as objects are taught as containers of mutable state, usually late in the course.
- ufo 12y ago1. C, D and Pascal dont have garbage collection. 2. An argument can be made for starting with dynamically typed languages before moving to static typing.
- eru 12y ago> 2. An argument can be made for starting with dynamically typed languages before moving to static typing. As much as I like static typing, I agree that showing people run-time errors seems to do a better job of teaching than letting them know ahead of time via the compiler that their code will likely blow up.
- corford 12y agoActually, D has garbage collection.
- baddox 12y agoPython has types, and I don't know what you mean by "without extensive research."
- Goladus 12y agoPython has types. Python 2.7.1 (r271:86832, Apr 22 2011, 16:34:07) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> type(5) <type 'int'> >>> type('hello world') <type 'str'> >>> type({'key': 'value'}) <type 'dict'> >>> 5 + 'hello world' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'int' and 'str' It just has dynamic typing.