News for hackers. Stuff that matters.
Re:Python is now the most popular introductory language at t... by fithisux on Monday July 07, 2014 @05:05PM (#8001409)
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.
Re:Python is now the most popular introductory language at t... by dragonwriter on Monday July 07, 2014 @05:41PM (#8001651)
> 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.)

Re:Python is now the most popular introductory language at t... by quasque on Monday July 07, 2014 @07:09PM (#8002142)
The 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.

Re:Python is now the most popular introductory language at t... by danieldk on Tuesday July 08, 2014 @03:03AM (#8003328)
The 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.

Re:Python is now the most popular introductory language at t... by ufo on Monday July 07, 2014 @07:26PM (#8002201)
Rust 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...
Re:Python is now the most popular introductory language at t... by fithisux on Tuesday July 08, 2014 @06:10AM (#8003754)
I 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.
Re:Python is now the most popular introductory language at t... by aruss on Monday July 07, 2014 @05:14PM (#8001468)
Python'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.

Re:Python is now the most popular introductory language at t... by sankethkatta on Monday July 07, 2014 @07:42PM (#8002248)
Berkeley'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
Re:Python is now the most popular introductory language at t... by brianchu on Monday July 07, 2014 @05:32PM (#8001571)
Berkeley'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).
Re:Python is now the most popular introductory language at t... by mimighost on Monday July 07, 2014 @05:36PM (#8001596)
Python 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.
Re:Python is now the most popular introductory language at t... by _delirium on Monday July 07, 2014 @05:51PM (#8001712)
I'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.
Re:Python is now the most popular introductory language at t... by brudgers on Monday July 07, 2014 @06:04PM (#8001798)
Processing 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.
Re:Python is now the most popular introductory language at t... by boomlinde on Tuesday July 08, 2014 @11:01AM (#8004808)
I think 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).
Re:Python is now the most popular introductory language at t... by Goladus on Tuesday July 08, 2014 @10:03AM (#8004541)
Python 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.
Re:Python is now the most popular introductory language at t... by tdicola on Monday July 07, 2014 @05:24PM (#8001521)
Unless 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.
Re:Python is now the most popular introductory language at t... by beamatronic on Monday July 07, 2014 @06:13PM (#8001864)
I would hope that no one in a freshman CS program is "completely green to programming".
Re:Python is now the most popular introductory language at t... by bookface on Monday July 07, 2014 @06:34PM (#8001996)
Seriously? 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.
Re:Python is now the most popular introductory language at t... by npizzolato on Monday July 07, 2014 @06:58PM (#8002092)
That'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.
Re:Python is now the most popular introductory language at t... by Igglyboo on Monday July 07, 2014 @06:34PM (#8001995)
I 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.
Re:Python is now the most popular introductory language at t... by aceofspades19 on Monday July 07, 2014 @06:24PM (#8001936)
Well 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.
Re:Python is now the most popular introductory language at t... by bignaj on Monday July 07, 2014 @10:26PM (#8002740)
The neckbeard is strong with this one.
Re:Python is now the most popular introductory language at t... by baq on Monday July 07, 2014 @05:17PM (#8001486)
rust? 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.
Re:Python is now the most popular introductory language at t... by Igglyboo on Monday July 07, 2014 @05:23PM (#8001514)
It'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);
    }
Re:Python is now the most popular introductory language at t... by aikah on Monday July 07, 2014 @06:15PM (#8001879)
My first language was AS3.And I'm glad it was.

Types dont make things more complicated. Most languages have types and I prefer dealing with them explicitely rather than letting an interpreter do random coercion like Javascript.

Types lead to cleaner programming,instead of shoving random stuffs into an untyped list,a dev has to think about data structures.

Furthermore,as a non native english speaker,I dont find python more readable than staticaly typed languages like C# or Java.Especially when a codebase grows larger. I wish python was statically typed.

Re:Python is now the most popular introductory language at t... by zo1 on Monday July 07, 2014 @07:32PM (#8002217)
"Types lead to cleaner programming,instead of shoving random stuffs into an untyped list,a dev has to think about data structures."

You're more than welcome to not think about what types you put into a structure/list. You'll quickly learn how to use that list/structure without hand-holding. For 90% of the problems out there, you don't need anything other than the basic data structures, and they're pretty straightforward to use without having to think about types.

Note. Please don't confuse Javascript's weak-typing with Python's typing, as Python is strongly-typed.

Re:Python is now the most popular introductory language at t... by dragonwriter on Monday July 07, 2014 @07:40PM (#8002240)
> Types lead to cleaner programming,instead of shoving random stuffs into an untyped list,a dev has to think about data structures.

Once you've learned to think about types -- as most introductory courses, even those taught in dynamically typed languages, will teach you -- you can do that just fine in a language that doesn't put a gun to your head and force you to.

(And you can do so in ways that most statically-typed languages have too limited a type system to let you do, too.)

Re:Python is now the most popular introductory language at t... by cma on Monday July 07, 2014 @08:41PM (#8002460)
Python doesn't do random coercion, except bool to int.
Re:Python is now the most popular introductory language at t... by codygman on Monday July 07, 2014 @05:51PM (#8001715)

    mapM_ 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".
Re:Python is now the most popular introductory language at t... by achal on Monday July 07, 2014 @06:11PM (#8001852)
My first reaction to this was that this was definitely less understandable, but I realized there were two pieces to this. One is banal - mapM_ and putStrLn are not near as simple as `for' and `print' (the latter have English meanings directly).

The second piece is interesting: Is something of the sort "<mapfn> <printfn> <list>" easier to explain to someone who's new to programming than "<foreach> <print>"? I've always thought the latter was easier to understand, but I'm curious which one someone who has no previous programming experience would grasp more immediately.

Re:Python is now the most popular introductory language at t... by codygman on Monday July 07, 2014 @07:14PM (#8002156)
Right, I think that once the concept is taught of what mapM does/means it will be easier to keep applying than something like a foreach loop.

The reason being that "<mapfn> <somefn> <list>" is more declarative, whereas the foreach loop is ambiguous. Something we often take for granted is how hard it was at first to come up with what exactly we need to do or mutate inside that loop to build the right result.

If nothing else, there is interesting discussion to be had ;)

Re:Python is now the most popular introductory language at t... by theaeolist on Tuesday July 08, 2014 @06:33AM (#8003825)
This is because of lexical issues. You can define aliases for mapM_ and putStrLn and get something more approachable to the lexically challenged.

repeat print ["foo"; "bar"; "etc"]

Re:Python is now the most popular introductory language at t... by mickle00 on Monday July 07, 2014 @05:39PM (#8001627)
NameError: name 'string' is not defined. :)

print(word) means it's even easier for grandma to understand!

Re:Python is now the most popular introductory language at t... by valarauca1 on Monday July 07, 2014 @05:35PM (#8001592)

     String[] word_list = {"hat", "dog", "cat"};
     for(String a: word_list)
     {
        System.out.println(a);
     }
extra brackets but pretty identical
Re:Python is now the most popular introductory language at t... by EpicEng on Monday July 07, 2014 @06:10PM (#8001848)
Who cares? If I'm a teacher I don't want to have to update material extensively every semester / year because the language is changing rapidly. Three are plenty of good, stable languages to use.
Re:Python is now the most popular introductory language at t... by Igglyboo on Monday July 07, 2014 @07:14PM (#8002155)
So we should teach the students old stuff because it's easier on the teacher? This isn't history, the tech world is changing daily with new languages and technologies being created. Sticking to one curriculum because it's easier on the teacher is ridiculous.
Re:Python is now the most popular introductory language at t... by EpicEng on Tuesday July 08, 2014 @12:34PM (#8005354)
"Old stuff"? No, necessarily, but the stable stuff, yes.
Re:Python is now the most popular introductory language at t... by lmm on Monday July 07, 2014 @06:27PM (#8001957)
Java is about as stable as it gets; that foreach syntax is ten years old. And if your teaching material stuck to the old-style syntax it wouldn't be wrong, it would still work, it's just not as readable as the new style.
Re:Python is now the most popular introductory language at t... by EpicEng on Tuesday July 08, 2014 @12:35PM (#8005361)
Yes, all languages change over time, butrust is still in its infancy and things have not yet settled. You really don't see the difference?
Re:Python is now the most popular introductory language at t... by benjiweber on Tuesday July 08, 2014 @01:29AM (#8003131)
In modern Java(8) it is now

    asList("hat", "dog", "cat").forEach(System.out::println)
Re:Python is now the most popular introductory language at t... by Dewie on Monday July 07, 2014 @05:27PM (#8001537)
To be fair, couldn't you use java's foreach instead of the regular for-loop? It makes things a bit less noisy.
Re:Python is now the most popular introductory language at t... by Yunk on Monday July 07, 2014 @05:29PM (#8001552)
SML 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.

Re:Python is now the most popular introductory language at t... by brudgers on Monday July 07, 2014 @05:45PM (#8001678)
What 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.

Re:Python is now the most popular introductory language at t... by Yunk on Monday July 07, 2014 @06:14PM (#8001871)
I 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.

Re:Python is now the most popular introductory language at t... by brudgers on Monday July 07, 2014 @06:36PM (#8002004)
I 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.

Re:Python is now the most popular introductory language at t... by freyrs3 on Monday July 07, 2014 @05:53PM (#8001730)
Indeed, 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.
Re:Python is now the most popular introductory language at t... by phkahler on Monday July 07, 2014 @06:06PM (#8001817)
>> 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.

Re:Python is now the most popular introductory language at t... by lmm on Monday July 07, 2014 @06:35PM (#8001999)
I'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.

Re:Python is now the most popular introductory language at t... by dragonwriter on Monday July 07, 2014 @07:04PM (#8002123)
Most 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.

Re:Python is now the most popular introductory language at t... by lmm on Tuesday July 08, 2014 @05:15AM (#8003635)
> preferring, at least initially, recursion to iteration to achieve that -- even though recursion is generally the wrong approach in production Python code

Exactly! Intro courses are usually - with good reason - taught in functional style. Which suggests that a language where that style is more natural and appropriate might be a better fit for those courses than Python.

(Though OTOH I wouldn't advocate a language where IO is anything more complex than a function call)

Re:Python is now the most popular introductory language at t... by phkahler on Wednesday July 09, 2014 @03:31PM (#8011763)
that's assignment AND reassignment. Mutable state is fundamental to how computers work no matter how hard the fans of the current fad of functional programming try to deny it.
Re:Python is now the most popular introductory language at t... by codygman on Wednesday July 09, 2014 @09:40PM (#8013154)
>> I don't think high level abstract concepts like functional programming are even relevant in the real world of software development

This is nothing but FUD and you should be ashamed of yourself.

Re:Python is now the most popular introductory language at t... by ufo on Monday July 07, 2014 @06:16PM (#8001888)
1. 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.
Re:Python is now the most popular introductory language at t... by eru on Monday July 07, 2014 @10:12PM (#8002706)
> 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.

Re:Python is now the most popular introductory language at t... by corford on Tuesday July 08, 2014 @05:47AM (#8003691)
Actually, D has garbage collection.
Re:Python is now the most popular introductory language at t... by baddox on Monday July 07, 2014 @11:55PM (#8002937)
Python has types, and I don't know what you mean by "without extensive research."
Re:Python is now the most popular introductory language at t... by seanmcdirmid on Monday July 07, 2014 @05:19PM (#8001494)
Is 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.

Re:Python is now the most popular introductory language at t... by fjh on Monday July 07, 2014 @05:46PM (#8001679)
Many 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.
Re:Python is now the most popular introductory language at t... by seanmcdirmid on Monday July 07, 2014 @06:03PM (#8001795)
Doesn'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.

Re:Python is now the most popular introductory language at t... by lmm on Monday July 07, 2014 @06:28PM (#8001963)
Cambridge teaches SML, not OCaml, unless it's changed in the last couple of years.
Re:Python is now the most popular introductory language at t... by pjmlp on Monday July 07, 2014 @05:52PM (#8001726)
FCT 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.

Re:Python is now the most popular introductory language at t... by Dewie on Monday July 07, 2014 @05:30PM (#8001560)
It'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.