Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Education Programming

Best Paradigm For a First Programming Course? 592

Keyper7 writes "The first programming course I had during my computer science schooling, aptly named 'Introduction to Programming,' was given in C because its emphasis was on imperative programming. A little before I graduated, though, it was decided that the focus would change to object-oriented programming with Java. (I must emphasize that the change was not made because of any hype about Java or to dumb down the course; back then and still, it's presented by good Java programmers who try to teach good practices and do not encourage excessive reliance on libraries.) But the practices taught are not paradigm-independent, and this sparked a discussion that continues to this day: which paradigm is most appropriate to introduce programming? Besides imperative and object-oriented, I know teachers who firmly believe that functional programming is the best choice. I'm interested in language-independent opinions that Slashdotters might have on this matter. Which paradigm is good to introduce programming while keeping a freshman's mind free enough for him/her to learn other paradigms afterwards?"
This discussion has been archived. No new comments can be posted.

Best Paradigm For a First Programming Course?

Comments Filter:
  • Alice (Score:1, Informative)

    by adnd74 ( 1022357 ) on Wednesday December 10, 2008 @12:12AM (#26055437)
    Alice [alice.org] by Randy Pausch [wikipedia.org] of the Last Lecture [cmu.edu]
  • SICP (Score:2, Informative)

    by Anonymous Coward on Wednesday December 10, 2008 @12:14AM (#26055461)

    Structure and Interpretation of Computer Programs [mit.edu] was my first CS text and it forever changed how thought about computers and programming. I can't recommend it strongly enough.

  • Teach them All (Score:5, Informative)

    by Maple Syrup ( 27770 ) on Wednesday December 10, 2008 @12:15AM (#26055471)

    The classic text SCIP [wikipedia.org] teaches multiple computing paradigms [mit.edu]. A fluent computer scientist should know all of them.

  • Consider Python (Score:5, Informative)

    by Fished ( 574624 ) <amphigory@gmail . c om> on Wednesday December 10, 2008 @12:19AM (#26055497)

    First off, a disclaimer: I'm actually not (much) of a Python programmer--I much prefer Ruby.

    However, my Dad teaches Math & Physics at the high school level, and got tapped to teach an intro to programming class this year. On my advice, he bypassed C++ (which he kind of knew) and Java, and taught it in Python using this book:

    He has been absolutely delighted with the book and with how well the students have done with Python as a first language. His comment has been that he wishes he had been exposed to Python instead of (many years ago) Fortran and (more recently) C++ -- he might have actually learned to program. ;) It seems that Python's a good choice--it's an easy language to learn, supports procedural, object-oriented, and functional programming, and has all the usual advantages of a dynamic language for programmer usability.

    Now if only they would do a version of that book in Ruby... :)

  • by El Cabri ( 13930 ) on Wednesday December 10, 2008 @12:23AM (#26055535) Journal

    +1 for that.

    I love functional programming but let's face it, computers are state machines and you cannot really program them without understanding how programs modify their state. Hoare. Dijkstra. Read them. Embrace them. Feel the pain of bending your mind around them.

  • by Average ( 648 ) on Wednesday December 10, 2008 @12:27AM (#26055571)

    I'm going to agree with that. I had programmed in an imperative to mildly GOSUBby way in various microcomputer BASICs, Pascals, and standard Cs since pre-Kindergarten. However, one of the best college classes I had was the one where we were given a 6800 (later classes it was an 68HC11) on a board, with a few external circuits, and we learned every single op-code. Then, I knew what a computer (and a compiler) was doing.

    They'll have plenty of time to learn paradigms. Make them appreciate what those paradigms actually accomplish.

  • by calmofthestorm ( 1344385 ) on Wednesday December 10, 2008 @12:28AM (#26055583)

    I'm not sure of that, actually. C is not at all functional, and Java is only to a limited degree. In Python, all functions are first-class values. This means you can mix paradigms in a program. You have fully functional closures and capture.

    I grew up on asm and C, now I write Python that looks more like Lisp or Haskell. In the end, I'd say either procedural programming or functional for introduction to programming. OOP is kind of verbose and clunky for an intro class, and while it certainly has its uses in large scale projects, when we were taught it in school I just saw a bunch of cruft obscuring the (simple) tasks that were assigned.

  • by iteyoidar ( 972700 ) on Wednesday December 10, 2008 @12:41AM (#26055667)
    I think the dude who invented Haskell had a pretty good insight in this interview where he was asked about teaching functional programming for a first programming class:

    I don't know - I don't actually have a very strong opinion on that. I think there are a lot of related factors, such as what the students will put up with! I think student motivation is very important, so teaching students a language they have heard of as their first language has a powerful motivational factor. On the other hand, since students come with such diverse experiences (some of them have done heaps of programming and some of them have done none) teaching them a language which all of them aren't familiar with can be a great leveler. So if I was in a university now I'd be arguing the case for teaching functional programming as a first year language, but I don't think itâ(TM)s a sort of unequivocal, "only an idiot would think anything else" kind of thing!

    Teach new students some sort of bizarro language so the ones who have been programming for years will be on the same level as everyone else.

    It was from this interview: http://www.computerworld.com.au/index.php/id;1974033854;fp;;fpid;;pf;1 [computerworld.com.au]
  • by Simina Branzei ( 1413111 ) on Wednesday December 10, 2008 @12:55AM (#26055751)
    What about this: "Storytelling Alice motivates middle school girls to learn computer programming". Kelleher, Pausch, Kiesler. CHI 2007. Seems a useful paradigm for girls.
  • by micromuncher ( 171881 ) on Wednesday December 10, 2008 @01:02AM (#26055783) Homepage

    I went to an unnamed university that did not teach languages specifically. First year was theory, basic architecture, and PDP11 assembler on a simulator. There was one introduction to structured programming with Pascal.

    Year two saw more theory including algorithms and data structures. The language chosen was modula-2 and we were expected to pick it up on our own. There was another low level course on hybrid 6502/68000 machines writing low level I/O in assembly. Again, we had to pick it up ourselves.

    Year three got fun with hardware; async circuits, build your own 68000 based computer, OS (multitasking) and database concepts. We also had our new software engineering courses learning all about CMM and such.

    Fourth year was simulation, HCI, write a compiler, and special projects. It was assumed we'd picked up C/C++ by that point on our own.

    There were three streams at our U; hardware, computer graphics, or knowledge sciences. There was a lot of math - that I didn't appreciate until after I left. But one I learned is why and how things work at a low level. It was a computer science degree.

    Programs like this don't seem to exist anymore; at least if they do they're more in engineering than compsci. This is really too bad. Because as one post already noted; the problem is one of problem solving vs. skills to get a job.

    I still use state machines, optimization, algorithms, data structures knowledge in everything I do. Most of the people I work with have no idea why I care about such things, but usually they're impressed that my stuff just works more better.

    IAE my advice to you is learn as many languages as you can because no one specific language or paradigm encompases computer science. Go do some lisp, smalltalk, java, and assembly programming... you'll see what I mean.

  • by Spazmania ( 174582 ) on Wednesday December 10, 2008 @01:02AM (#26055789) Homepage

    I like C. I'm a C maven. But I'm *really* glad I didn't learn C first. My first programming courses were taught in Pascal. The good habits I learned there have saved me from writing really poor code when I graduated to more flexible languages like C.

  • by francium de neobie ( 590783 ) on Wednesday December 10, 2008 @01:34AM (#26055981)
    Really? Last time I checked...
    1. There's no need to wrap a closure in a "function class" in Python. And I don't have to cast everything down to Object every so often. So while, theoretically, you can do functional programming in both Java and Python, in practice it is much easier in Python.
    2. There's no need to wrap the "main()" function in a class in Python - in fact, I can go without writing the main(). Looks like a minor point but it saves a good portion of your time for trivial programs. Also, I don't need to compile it.
    3. I have list and dictionary literals; I don't have to care what is the "type" of the list and dictionary when I create it - type of elements can be examined by duck typing or isinstance() if I need to - but usually it isn't needed; list comprehension is a really good time saver, makes the code easier to read as well.
    4. I have an interactive command line for doing experiments. I can even read manuals in the command line via the help() function.
    5. I have exec() in Python. It isn't as useful or as dynamic as eval() in Lisp, but that's something Java definitely cannot do on a language level. Sure, you can write a library that calls the Java compiler real time to emulate that... but I'm talking about the language itself.

    Doesn't look very "same class" to me. At least when I'm considering which language to use for solving which problem.

  • Re:SIMPLE (Score:2, Informative)

    by Z00L00K ( 682162 ) on Wednesday December 10, 2008 @03:14AM (#26056581) Homepage Journal

    There are several programming languages around, but one of the classics for learning good methods is actually Pascal. It's readable and structured. And the step from Pascal to C or Java isn't bad enough to cause trouble.

    But as with any programming language you can make a mess out of it.

    For an introduction it's not necessary to start with something object-oriented. It may just be disorienting.

    Then it's worth to realize that in today's world it may be a good idea to already from the beginning think of languages that are suitable for parallel execution. Erlang is one such language. It is of course always possible to program for parallel architectures in languages like C++ and Java, but it's also easy to make a mess out of it in those languages.

  • by jonaskoelker ( 922170 ) <`jonaskoelker' `at' `yahoo.com'> on Wednesday December 10, 2008 @05:06AM (#26057063)

    [C, java, python] are really all the same class of languages

    Really? For three "identical" things, I think they're quite far apart.

    C doesn't have native support for object-oriented programming. If you want to teach the students that, you need to embed pointers to vtables everywhere, you need parent-objects-as-members and you need massive hacks.

    Java doesn't have higher-order functions; you have to put your function pointer arguments inside classes. [C at least has function pointers]. By insisting that everything is put inside an object, procedural programming "looks OO" and might distort the students' view of what "real OO" is.

    Python doesn't have static types. On the other hand, it lets you teach procedural and object-oriented each in their most natural ways. It also lets you teach ideas that will recur in functional languages, such as higher-order functions, closures and lazy lists.

    More importantly, python lets you teach things without having to introduce a lot of overhead: "Why must closed-over variables be final? Why is it smart to feed my own anonymous Function class to MapIterator--a for loop is much shorter? Higher order--but it doesn't take a function, it takes an object! ..."

    I'd advocate python first, because it allows you greater flexibility in the choice of what to teach. Also, it's good for teaching algorithms: http://www.ece.uci.edu/~chou/py02/python.html [uci.edu]

    "The most encouraging part was that more than a few students wanted to implement the algorithms that were not assigned as homework problems. The students said they wanted to see the algorithms run and test their own understanding."

  • Re:The Basics. (Score:2, Informative)

    by KDR_11k ( 778916 ) on Wednesday December 10, 2008 @05:14AM (#26057103)

    "should". From what I've seen of people who join a CS course most have never done any programming.

  • Re:Functional (Score:4, Informative)

    by dkf ( 304284 ) <donal.k.fellows@manchester.ac.uk> on Wednesday December 10, 2008 @05:22AM (#26057135) Homepage

    There are no two things more opposite to each other than OOP and functional programming. Functional programming is about FUNCTIONS, which are those that return a value that is completely determined by their arguments, not depending on, or modifying, any state. OOP is all about calling METHODS, which have values that are determined by both the arguments and the state of the object they're called on, and often are meant to modify that state.

    Not at all. I have used a pure functional OO language in the past (the name of which I forget) and what it did when you did an operation that would "modify the state" is return the new state as the result of the method. The same would be true for any language where all objects are immutable and variables are immutable.

    "Functional" means that the answer to an operation is determined entirely by the arguments to the operation and the nature of the operation itself, and that the operation does not change the state. (Functional languages are usually written in pseudo-mathematical notation, but not always.) "Object-oriented" means that your values (often structured values) know exactly what operations can be performed upon them that don't just see the object as an abstract token, that they encapsulate that notion, and that the language is written in "subject verb" form, not "verb subject". (That last point is just syntactic, but important.) Those two are entirely orthogonal properties.

    Obviously, you've mixed up "OO" and "Imperative OO"; imperative systems are all about state modification.

  • Re:Consider Python (Score:2, Informative)

    by TromboonDotPy ( 861822 ) on Wednesday December 10, 2008 @09:14AM (#26058791) Journal
    This is one of those questions that make people tend to talk past each other because they start talking about their favorite language rather than educational purpose.

    I'm sure that the educational purposes that motivate professors of young adults who have declared themselves computer science majors are rather different than those for high school CS teachers such as myself. I'll talk briefly about teaching high school, and let higher ed folks talk about their educational purposes themselves.

    I've taught procedural, functional (Scheme), and OO to high school students ranging from very young 9th graders to very advanced 12th graders for 18 years. None of these have been an utter train wreck, and all have caused interesting and worthwhile conversations.

    Lately, I have been teaching Python to Non-AP CS-1 for a few years. It has been an almost uninterrupted joy.

    I am totally convinced that ordinary 10th graders benefit from non-oo, state machine programming and tacking on oo late in the day.

    This serves the purpose of reinforcing a high school student's algebra, planning and workplace skills, and a welter of logical thinking skills that I can't believe are merely computer programming, such as understanding the distinction between type and instance.

    Another purpose CS-1 is serving is as a not-really feeder course for APCS. By which I mean it is not a formal requirement, but gives only a few things I have to deal with differently when they become AP students (teaching manifest typing vs. duck typing, for instance. But that's a worthwhile conversation).

    I would strongly encourage secondary CS teachers to investigate Python and perhaps other python-like languages, with the warning that there's no curriculum you can take off the shelf, and will need to reauthor your course so Python works for you. I note in passing that it is also a terribly friendly language for a teacher improvising while students are watching-- it generally does what you think it ought to do.
  • by evanbd ( 210358 ) on Wednesday December 10, 2008 @09:45AM (#26059139)

    C should, in many ways, be thought of as a somewhat easier to read and portable assembly language. It doesn't hide much of anything from you, for better or for worse. Given the number of students who seem to manage to get rather far in their computing career without actually understanding what a pointer is, teaching a very low-level language first or very early has its merits.

    That said, my personal choice would be either a functional programming language or a carefully chosen assembly language -- probably MIPS on an embedded processor. I'd prefer C to things like C++ or Java, though.

FORTRAN is not a flower but a weed -- it is hardy, occasionally blooms, and grows in every computer. -- A.J. Perlis

Working...