Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Best Paradigm For a First Programming Course?

kdawson posted more than 5 years ago | from the buddy-can-you-paradigm dept.

Education 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?"

cancel ×

592 comments

The Basics. (0)

Anonymous Coward | more than 5 years ago | (#26055347)

Basic.

Re:The Basics. (3, Funny)

LaskoVortex (1153471) | more than 5 years ago | (#26055457)

Brainfuck.

Re:The Basics. (2, Funny)

evanbd (210358) | more than 5 years ago | (#26055765)

What's wrong with Malbolge [wikipedia.org] ?

SIMPLE (1)

symbolset (646467) | more than 5 years ago | (#26055351)

Simplified Imaginary Machine Programming Language for Everyone

Re:SIMPLE (0)

Anonymous Coward | more than 5 years ago | (#26055553)

hey....that's not a real programming language...oO

Weakest Precondition Calculus (2, Interesting)

Anonymous Coward | more than 5 years ago | (#26055361)

Easy: follow the Gries book.

Re:Weakest Precondition Calculus (5, Informative)

El Cabri (13930) | more than 5 years ago | (#26055535)

+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.

Re:Weakest Precondition Calculus (2, Interesting)

Anonymous Coward | more than 5 years ago | (#26055791)

functional programming is a reducible state machine. However, we're surrounded by iterative programing (eg, recipes, directions for assembling chairs, map directions, etc.), so that often seems more natural.

Re:Weakest Precondition Calculus (0)

Anonymous Coward | more than 5 years ago | (#26055745)

That's what I had at the University of Buenos Aires as the first programming course for bachelor in CS. Great stuff. Pretty ugly but very important. WPC concepts like pre/post conditions and invariants are fundamental. In hindsight I'm glad I was taught that first, before being exposed to particular languages and their little quirks and vices.

Easy: follow the Gries book.

Some combination? (2)

mathgeek13 (1287912) | more than 5 years ago | (#26055365)

I know that you said it should be language-independant, but some sort of language like Python might be good. With Python you can do object-oriented programming or not. Something with that sort of flexibility might be a good language to teach with.

Re:Some combination? (2, Funny)

ryszard99 (1193131) | more than 5 years ago | (#26055659)

<coff>perl</coff>

mathematica (0)

Anonymous Coward | more than 5 years ago | (#26055369)

the best tool for programming by far.

Re:mathematica (2, Funny)

Anonymous Coward | more than 5 years ago | (#26055533)

I know I'd love to sign up for an intro to programming course whose basic software cost only four figures.

All of them. (4, Insightful)

Tokerat (150341) | more than 5 years ago | (#26055371)

If you go on to do anything comp sci related, you're going to need a good background in all of these methods of programming, their advantages and disadvantages. You'll need to know when it's appropriate to use each one, and why.

Re:All of them. (5, Insightful)

dcollins (135727) | more than 5 years ago | (#26055423)

Unfortunately, they can't all be first.

Re:All of them. (5, Insightful)

mbrubeck (73587) | more than 5 years ago | (#26055747)

Unfortunately, they can't all be first.

But you can still do several in a first programming course. That's exactly what my intro CS course did. We worked with a functional language, an object-oriented language, a low-level assembly language, a logic programming language, and also theoretical constructs like finite automata.

Re:All of them. (5, Insightful)

DerekJ212 (867265) | more than 5 years ago | (#26055813)

That explains why so many kids drop out of CS. I was greatly interested in the subject, but if my CS101 class had tried to throw all that at me and expect me to really grok it all in a single class, I would have been looking for a different major/school.

Re:All of them. (5, Interesting)

i.of.the.storm (907783) | more than 5 years ago | (#26055873)

That's similar to what my first college CS course has been like. We used SICP [mit.edu] and it was a really interesting semester. We did functional, OO, client/server, and logic programming (or well those were the 4 paradigms that the prof considered the main ones) and it was pretty interesting. Since most people came in with OO experience only, doing functional programming through people for a loop at first. Of course, we did it all in Scheme, which is a cool language, too.

Functional (3, Insightful)

Anonymous Coward | more than 5 years ago | (#26055377)

Definitely functional programming. OOP is an extension of this. The methods within an object are, of course, functional. I feel it's like trying to teach someone to drive with a manual transmission, in a city. It's better to let them learn the basics, and THEN learn the more complicated (and better) way to do things. Building upon the prior knowledge.

I am speaking as someone who learned functional first and then OOP, and who is now a (self-described) expert in OOP. Also, as someone who learned on an auto tranny first, and who is now a (self-described) expert at stick.

It's all about steps.

Re:Functional (4, Insightful)

Anonymous Coward | more than 5 years ago | (#26055469)

The methods within an object are, of course, functional.

Despite omnipresent side effects?

Re:Functional (0)

Anonymous Coward | more than 5 years ago | (#26055749)

At their base level, they are still functions.

Functions which take part in a greater whole, but within the braces, they are still functions.

If you don't know how to write a function, then you are fucked either way.

Re:Functional (5, Interesting)

El Cabri (13930) | more than 5 years ago | (#26055491)

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.

Re:Functional (0)

Firehed (942385) | more than 5 years ago | (#26055709)

I'm not sure I'd quite agree with that statement. At least some amount of OOP tends to be just well-organized functional programming. Yes, methods will generally modify the state of an object, but static methods especially will often just return some value based off the parameter they're called with. Granted, they may often be some sort of pseudo-constructors that return an instance of their parent class, but you can do that just as easily with a function as a static method.

Yes, by and large they're two totally different ways of doing things, but you can't pretend that there's no overlap between them.

Re:Functional (3, Interesting)

Eli Gottlieb (917758) | more than 5 years ago | (#26055723)

And yet in an impure functional language a set of closures closing over the same variables are equivalent to an object with those functions implemented as methods.

Re:Functional (0)

Anonymous Coward | more than 5 years ago | (#26055759)

There are no two things more opposite to each other than OOP and functional programming.

I have to disagree here a little bit. People usually learn (and use) OOP with imperative style methods, which directly modify object state, but it doesn't need to be that way.

A method can certainly take an immutable object as its argument and return a transformed copy in the functional style. I don't know if that's very common practice (I don't really have much practical functional programming experience), but SML does provide data hiding and encapsulation mechanisms.

--Justin

Re:Functional (3, Insightful)

PsychosisBoy (1157613) | more than 5 years ago | (#26055793)

Remember, we are talking about people who have NEVER programmed before. And teaching them how to do it.

I believe it is easier for someone to first understand how to program with functions, and then, after they are comfortable, to put these functions into a greater "whole", as part of an object.

It really is all about building upon the fundamentals. Functional programming is a fundamental. OOP is building upon that knowledge.

It's just my opinion, though =)

Re:Functional (1)

TuaAmin13 (1359435) | more than 5 years ago | (#26055719)

I didn't have an ounce of programming until I hit college. I took MATLAB presuming I'd be an engineer, but then I decided to go for CS. I just finished my first semester of Java (Final was today)

Honestly I think learning MATLAB first helped, since I was vaguely familiar with the concepts of conditionals, loops, arrays and whatnot, before I moved into OOP. For me it was just a matter of learning the fundamentals of OO and applying them to what I already knew. It worked for me, though it may not work for anyone else.

Re:Functional (5, Insightful)

johnsonav (1098915) | more than 5 years ago | (#26055753)

Definitely functional programming.

I don't think functional programming is the place to start for the majority of students. A procedural language has a much more direct relationship to the underlying machine code. If you don't want to start in assembler (and I don't advocate assembler for a first language for a lot of reasons), a language like C, which is high-level enough to not get bogged down in irrelevant details while teaching basic algorithms, yet is close enough to the metal to give the students a taste of the underlying hardware, is a good compromise. Functional programming, while closer to the underlying math, is so different from the instructions the machine actually executes that students may finish the class and still not have a clear idea how what they wrote directs the machine.

That said, my first development environment was HyperCard and most of what I have done since has been OOP. When thinking about a problem, my first instinct is to objectify it. But, I think OOP involves learning too much at once to be the ideal teaching paradigm. Think of how many lines of OO exist in a Java Hello World program. And think how much of that is meaningless to the student when they're still trying to learn the basics of println.

Both (2, Insightful)

nog_lorp (896553) | more than 5 years ago | (#26055381)

At my institution, the '101' and '102' courses are taught in C and Java respectively. The class I'm taking right now is these two classes combined, so my 'intro course' is taught in C and then Java. Several projects require writing the same program in each language.

Re:Both (2, Insightful)

Xiroth (917768) | more than 5 years ago | (#26055445)

When I went to university, the first course was in C - which was basically just preparation for the second course, which was in Assembly (specifically, MIPS). I'd say that was the most important part - a good grasp of the fundamentals of computing is really the best thing that you can take away from university. From there, all of the languages (and even paradigms - we covered the main three) were quite a bit simpler to grasp, as you could look a little deeper into them and ask "What are we really doing here?". Stripping away the mystery of compilers and interpreters simplifies understanding dramatically.

Re:Both (1)

lorenlal (164133) | more than 5 years ago | (#26055637)

In my case, I was first taught functional programming, even though it was in C++. It appeared that this was to get us used to taking a problem, and finding a way to solve it using a series of commands (and for getting us to rely on certain basic libraries and where to find them). This was very helpful in figuring out how to read and get a feel for what code was doing, oh and yelling at us constantly to comment our code.

The second course took that functional programming and applied it to OOP. What is each method? It's a function that applies to a specific object. You have an object that you need to work with, and you need it to do certain things, so make a function for each of them and call them methods. This was also in C++.

Later, we delved into C, assembler, and Java. But the emphasis was thinking in terms of problem analysis, design of a solution, and attacking it appropriately in later years. I found it to be very good in my case since OO vs functional is really a matter of what you do.

You don't need a calculator object to write a basic calculator program... But you can write one if you plan on doing things with that calculator object like interact with multiple instances of them.

Re:Both (0)

Anonymous Coward | more than 5 years ago | (#26055771)

I think you're mixing up imperative/procedural programming and functional programming.

Re:Both (2, Insightful)

mrchaotica (681592) | more than 5 years ago | (#26055647)

...C and then Java. Several projects require writing the same program in each language.

Wow, how fucking useless can you get?! I'll bet half the students wrap their C code in a class and think they're done.

Now, if they had to write their programs in LISP and Java (or LISP and C), then they'd be getting somewhere!

Functional languages are phenomenal. (4, Insightful)

HFXPro (581079) | more than 5 years ago | (#26055385)

Procedural is most like instruction list people are used to doing. However, it often leads to bad practices and sloppy coding. Object oriented can be good, but few people use object oriented beyond procedural wrapped in a class. It also is often hard to represent a good object system on paper. Functional languages to vary degrees are very nice if you didn't learn procedural before hand and can think of problems as smaller problems. People usually have trouble with them because they have learned Basic, C, etc. Logic languages are extremely powerful in that you only describe what you want, not how it should go about being computed. That isn't quite true, but think of them as more of set theory and logic. However, they can be somewhat awkward to teach.

Re:Functional languages are phenomenal. (2, Insightful)

HFXPro (581079) | more than 5 years ago | (#26055409)

I should mention anyone who is trying to peddle python against java against c are all barking up the wrong tree. Those are really all the same class of languages and offer no benefits over the other in terms of good practice, smart thinking, and great design.

Re:Functional languages are phenomenal. (3, Informative)

calmofthestorm (1344385) | more than 5 years ago | (#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.

Re:Functional languages are phenomenal. (1)

bondsbw (888959) | more than 5 years ago | (#26055705)

You're right, but you're also wrong. While they are all imperative in style (particularly if you argue that object-oriented languages like Java and Python follow the imperative style of state and iteration instead of the functional style of passing values and recursion), they have differences.

One key difference is memory management. C (and C++) allow direct access to pointers; the other languages only use references.

You can't overlook the power of object-oriented design, as you said, "in terms of good practice, smart thinking, and great design." OOD doesn't force you to write better programs, but it allows you to do so. Reuse is a big deal when talking about design, and C comes nowhere close to modern OO languages. Isolation is also key; the more that your code is broken into distinct, isolated components, the more maintainable it tends to be. OO helps this.

The arguments here deal with how effective the language is at promoting good design, not about whether you can make horrible designs in Java or beautiful designs in C... of course you can.

well update them.... (2, Insightful)

powerspike (729889) | more than 5 years ago | (#26055391)

just give the courses funky and updated names like
"Whiplash and programming, what they have in common"
"the 7 do's and don't of baning your head against a wall learning OOP for beginners"
that should do the trick!

Assembler... seriously (3, Interesting)

EmbeddedJanitor (597831) | more than 5 years ago | (#26055407)

Give them a good understanding as to what is going on under the hood. It really helps them to connect the dots and really helps in the understanding of compiler/OS design, and basic concepts like "what's a stack?".

Choose a simple 8-bit micro such as an AVR first, or an ARM. Something with a RISC architecture is nice and clean.

Introduction to programming isn't what it used to be. Twenty or thirty years back that was often the first exposure a student had to programming. These days you'd be seriously concerned if a student showed up to a programming course and hadn't dabbled a bit at home.

Re:Assembler... seriously (1)

sbilstein (1404155) | more than 5 years ago | (#26055467)

My institution gives you a choice between C++ and python first semester. Second semester is Java in one course and something that goes from basic logic gates and binary to assembly.

Re:Assembler... seriously (2, Insightful)

fuhrysteve (1310621) | more than 5 years ago | (#26055477)

I wonder if something more basic might be in order.. My degree is in Philosophy, so I had to take symbolic logic. There was a CS guy in my course though who actually went to the department and said, "this should be on the CS curriculum, because we really don't formally learn logic." Here's the guy who taught me @ John Carroll: http://www.jcu.edu/philosophy/gensler/lc/index.htm [jcu.edu]

Re:Assembler... seriously (2, Insightful)

cong06 (1000177) | more than 5 years ago | (#26055595)

+1 to that.
Seriously, assembly is great and all, but people are idiots. Assembly would just scare them away.
While I would rather the field be smaller so that there's a higher chance of me being employed, I realize that I would probably not be interested in comp sci if I was thrown assembly the first day.

Logic is important (1)

EmbeddedJanitor (597831) | more than 5 years ago | (#26055609)

It should definitely be in a CS curriculum, bit perhaps not in a first programming course.

If you really want early drop outs ... sure (1)

Pinky's Brain (1158667) | more than 5 years ago | (#26055777)

CS is not about programming I know ... but still, starting off with pure math without any applied courses is just a bad idea (at my uni advanced logic is a freshman course for CS BTW).

Re:Assembler... seriously (2, Informative)

Average (648) | more than 5 years ago | (#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.

Re:Assembler... seriously (1)

fluffykitty1234 (1005053) | more than 5 years ago | (#26055731)

I do agree that assembly is important, it wasn't until I learned assembly (6809 for me) that I understood what a pointer was, or how it worked.

On the other hand, I think language is actually a really small part of comp sci. The language is just a mechanism for expressing the concepts you will learn. It's much much more important to learn and understand the conceptual things, like sorting, searching, trees, etc etc.

Re:Assembler... seriously (1)

forkazoo (138186) | more than 5 years ago | (#26055809)

Choose a simple 8-bit micro such as an AVR first, or an ARM. Something with a RISC architecture is nice and clean.

I agree 100% with the ASM suggestion. Really, seriously. If I were picking the curriculum, it'd probably be S360 or MIPS, but anything would be great. Heck, even just use an emulator for the fictitious assembly language in Knuth's 'The Art of Computer Programming.'

Teach the student what the computer does, then teach them various ways of expressing it like OO. If you try and teach Java as a first course, you force the student to accept too much magic without understanding any of it.

Introduction to programming isn't what it used to be. Twenty or thirty years back that was often the first exposure a student had to programming. These days you'd be seriously concerned if a student showed up to a programming course and hadn't dabbled a bit at home.

Heck, even ten years ago, most students probably had never programmed anything. Twenty years ago, every computer at least came with BASIC or something, so kids could play around. But, computers were still fairly uncommon in the home. Ten years ago, computers were much more common, but having dev tools installed on your computer was not a given. Now, Linux has become common enough that anybody who has never used it just isn't very interested in computers. gcc is available for Windows. Python is available, etc. It's only within the past ten years that it has once again become a given that your ordinary home computer can trivially be used to write programs again.

Alice (2, Informative)

adnd74 (1022357) | more than 5 years ago | (#26055437)

Alice [alice.org] by Randy Pausch [wikipedia.org] of the Last Lecture [cmu.edu]

Dumbest ask slashdot ever.. (1, Insightful)

LingNoi (1066278) | more than 5 years ago | (#26055441)

How about instead of asking this you just go read the article posted hours ago about the creator of c++ and his views on education?

http://news.slashdot.org/article.pl?sid=08/12/09/2017242 [slashdot.org] .

Re:Dumbest ask slashdot ever.. (0)

Anonymous Coward | more than 5 years ago | (#26055675)

Hey, what if he has read that and he still want to ask? Just because Bjarne Stroustrup had created a language doesn't mean he is right at everything you know.

FP FTW (1)

Rodyland (947093) | more than 5 years ago | (#26055447)

My first year, first semester University CS-101 course was in functional programming. I think it was a good idea as it forced us to think in a completely new way - including those of us who had some previous brushes with programming (C64-basic anyone?). Second semester moved on to C, and the joys of pointers and memory management etc.

How about Turing? (1, Interesting)

rcpitt (711863) | more than 5 years ago | (#26055453)

Back in 1979 my first formal course in programming started out with the Turing machine - and frankly I'm glad.
IMHO today's junior programmers don't have nearly enough background in either formal program definition or the underlying hardware that eventually ends up executing whatever the high level language compiles or interprets to.

Assembler (1)

Progman3K (515744) | more than 5 years ago | (#26055455)

Teaching assembler is the base.
After that, all digital representation can be understood as a patter on ones and zeros.
Higher-level languages can then be mastered faster.
Start at the base.

SICP (2, Informative)

Anonymous Coward | more than 5 years ago | (#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.

Re:SICP (1)

andreyvul (1176115) | more than 5 years ago | (#26055707)

Aaaaaahh! Lisp! My eyes!

Orthogonal (1)

QuantumG (50515) | more than 5 years ago | (#26055463)

"imperative" and "object-oriented" are orthogonal concepts.

Wrong question (1)

SanityInAnarchy (655584) | more than 5 years ago | (#26055569)

More than that, there are other concepts, like functional programming, which are somewhat mutually-exclusive with imperative programming.

And I would say, don't teach a paradigm at all. For your very first class, give them something like this introduction to Ruby [hobix.com] . After they have a vague concept of how a program goes together, then you worry about teaching them other paradigms -- ideally, they should learn all of them eventually.

Also, avoid starting them with something like COBOL, Visual Basic, or Java. These things may tend to rot their brains.

Teach them All (4, Informative)

Maple Syrup (27770) | more than 5 years ago | (#26055471)

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

Re:Teach them All (0)

Anonymous Coward | more than 5 years ago | (#26055697)

Exactly. SICP is the way to go. It saddens me greatly that MIT's revised EECS curriculum abandoned it last year. In 6.001 they taught us functional, imperative, object-oriented, and assembly language programming, (and more!) all in one class. It's always puzzled me how at other schools the intro class (apparently) only covers one paradigm; what do they do with the other 10 weeks of the semester?

Linguistics (3, Interesting)

denissmith (31123) | more than 5 years ago | (#26055489)

Ways that meaning are encapsulated in different human languages can be a useful way to demonstrate the structural underpinnings of programming languages. Linguistics is more interesting than reading Boole and gives you a way to think about larger structures without tying you to a particular paradigm. All computer languages have strengths, all are inadequate. But so are human languages. There is a Korean word that expresses this exactly, but it doeasn't translate directly into English. :-)

Consider Python (5, Informative)

Fished (574624) | more than 5 years ago | (#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... :)

Structured programming (2, Insightful)

ishmalius (153450) | more than 5 years ago | (#26055505)

I've always thought that Java as a first language was a mistake. Students are forced to learn two concepts, structured programming and object orientation, at the same time. They should master one, then the other. For object orientation being second, it is not just a programming style, it is also an essential facet of design.

Functional programming can come third. I know that a lot of FP people would disagree. But I really don't think that the beginner student would have a clear grasp of scope, stack frames, or method references until they learn something easier first. But, hey, third semester is not so late.

Re:Structured programming (1)

mrchaotica (681592) | more than 5 years ago | (#26055621)

For object orientation being second, it is not just a programming style, it is also an essential facet of design.

Object orientation is only an essential facet of design if your design is object-oriented.

Yes, it sounds like a tautology, but it's not. Object orientation is not necessarily the best way to solve some problems. For example, I just wrote a structural analysis problem in non-object-oriented Matlab because the point of the thing was to compile all the data into some big matrices and then solve them. The design of the program came straight from the equations in the text book. Similarly, something like a compiler is perhaps best implemented in non-object-oriented LISP.

I like Lisp, Haskell, Erlang, etc. (2, Interesting)

rolfwind (528248) | more than 5 years ago | (#26055511)

Maybe even scheme although it is sometimes too minimalistic. Some languages such as C naturally incline toward a specific structure like imperative, some don't. But avoid C unless they are expected to write low level code.

Why? Because out in the "real world", you are usually assaulted with C or it's derivatives. Not because these are the best languages, but they were faster when developed and took a strong foothold over the thinking of the programming community. It's rather a self perpetuating cycle like Microsoft Windows and operating systems. Another reason is that C/C++ is low level language masquerading as a high level one, with libraries to cover some of it's more glaring defiencies.

Yes, they'll eventually have to learn C/C++ or a descendant, but that is not the point: it is because they'll have to learn C/C++ that you should teach them something else. Otherwise once you teach them C, mental inertia takes over and they'll be stuck in the C mindset for the rest of their lives and cannot imagine anything else. They'll have time enough to learn C in sophomore or later levels.

Also, I wouldn't worry too much about "paradigms". Learn to attack problems one by one, making a program that fits each one best. Throw a lot of small coding problems at them, actually, to scale them up to bigger tasks. Thinking about a problem is great, but no reason not to learn coding by coding. I remember Paul Graham writing he never had used Object Orientation his entire life, although it would have seemed that some problems were initially screaming out for such a solution on paper. IMO, paradigms are usually taught as a way to evolve or grow a program an ongoing problem, so you don't end up with sloppy, spaghetti code - but I think experience and getting to see the big picture is more important than rigid paradigms. Afterall, most paradigms grew up from an person's experiences with one or a set of closely related problems that may not closely relate to another random set of problems.

Stuff like rabid prototyping, etc, are in view more common sense (and better coding methods) than an exact paradigm.

It's easy (1)

squidinkcalligraphy (558677) | more than 5 years ago | (#26055523)

LISP: http://xkcd.com/224/ [xkcd.com]

More seriously, it shouldn't matter too much; a good programmer will pick up a new paradigm when it's needed. Less good programmers will just keep going in whatever they've learnt.

None of them. (4, Insightful)

Metasquares (555685) | more than 5 years ago | (#26055525)

I've found that good students tend to do well with any paradigm you introduce them to, while bad students do poorly no matter the paradigm. Few seem to be in the middle. I would argue that the choice of starting language or paradigm is therefore not as important as people think it is.

*I teach an introductory data structures & algorithms course. The school I teach at just switched from C++ to Java.

SCHEME, FOR THE LOVE OF GOD, SCHEME!!!!!!!!!! (4, Insightful)

mrchaotica (681592) | more than 5 years ago | (#26055563)

My first language was not Scheme -- I learned bits of LOGO and [Q|Visual|Ti-calulator] Basic as a kid. However, my first course at University was taught in Scheme, and it was by far the best computer science class I've ever had. Since then, my school has tried teaching freshmen Python, Java, and Matlab and they've all sucked horribly in comparison.

(LISP, ML, Haskell, etc. would probably be just fine too.)

Re:SCHEME, FOR THE LOVE OF GOD, SCHEME!!!!!!!!!! (1)

thesupraman (179040) | more than 5 years ago | (#26055717)

Eiffel ;)

Re:SCHEME, FOR THE LOVE OF GOD, SCHEME!!!!!!!!!! (1, Insightful)

Anonymous Coward | more than 5 years ago | (#26055843)

Scheme and so on are swell and functional programming is cool... ...but name one significant real world application made in such a language.

Just one. Not some horribly obscure thing, but something you can walk into Best Buy and buy off the shelf. Something non-comp-sci dweebs have *heard of*.

*waits*

*crickets chirp*

*birds tweet*

I wager that about covers it.

Don't teach them a functional language. Teach them something *useful*. For better or worse, that's C++ in the real world, or *maybe* java. I don't think C++ is a particularly good language by any means, but it IS a useful language. Other languages have specialized niche applications, but C++ can build pretty much anything fairly well, from low level systems stuff to commercial games.

Two ways (1)

bigmonachus (1415821) | more than 5 years ago | (#26055573)

A very good read related to this is "The Perils of Javaschools" by Joel Spolsky. http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html [joelonsoftware.com]
I think that paradigm choice is secondary compared to teaching in a way that will stretch the student's mind.
C++ was the language I used when I started getting serious about programming. Before that I used Basic dialects. My experience learning to program in C++ wasn't very enlightening. There were just a lot of compile-time errors, and I spent a lot of time looking for them. If I'd had a teacher it would have been much easier.
I think that if you're going to go imperative, the best choice is a bottom-up approach, in which you start out pretty close to the metal and go up from there, not focusing so much on computer science theory than on pointers.
You don't really appreciate garbage collection unless you have had the pain of managing the memory manually.
The approach that I think is best, is to start with a very high level language in which you can teach basic computer science without the language getting in your way. Preferably a functional language =)

Everyone learns in different ways. (0)

Anonymous Coward | more than 5 years ago | (#26055581)

I first learned programming by reverse-engineering binaries in a hex editor. Starting out, I edited data structures in the program to see the effects; later, I started working with interpreted bytecode and later assembly language. I was 16 at the time. A year earlier I had tried C and just couldn't comprehend how it worked -- but there's no way to learn how computers run that provides the same experience as ASM and hardware manipulation.

I'll freely admit that OOP was a huge leap at first. My brain focused on efficiency in terms of cycles rather than programmer productivity. However, it took less than a year to become proficient in C++ and as a result just about any language that works in a similar way.

Now I'm in college studying engineering. Were it not for learning programming two years ago, I would be nowhere -- probably some liberal arts major with no idea of where to go in life. I can't comprehend learning programming in any way other than this one, and yet I see online people saying, "don't learn assembly, it's too hard and not very useful." It took me a while to realize that different people learn in different ways, and they tend to recommend the way they learned most to others.

Robots (1)

dswt (306037) | more than 5 years ago | (#26055601)

They make a great context for learning, and are fun too, appealing to a broad community at various levels. A number of groups are exploring, researching and promoting robotics-based beginner programming classes. Gaming and multimedia provide other great contexts for learning.

The paradigm is less important IMO -- as someone already said, you ideally need to understand many. Context is the more important factor.

Learn at least two paradigms WELL (5, Interesting)

_greg (130136) | more than 5 years ago | (#26055613)

I recommend learning at least two languages representing significantly different paradigms during a programmer's formative period. In this instance I consider C, C++, Java, C# and the lot to be in the same paradigm - procedural.

Haskell is a good language for exploring the functional paradigm. Smalltalk is good for object oriented. There are many good Prologs for learning logic relational programming. I recommend that a new programmer avoid multiparadigm languages until they have seriously explored programming in a more pure way in two or more paradigms.

I used to recommend SICP, now I recommend CTM [ucl.ac.be] .

Also important is to (1) enjoy the programming you are doing and (2) work on programs which do interesting things and get you feedback from others.

Dijkstra's Method? (1)

BobKagy (25820) | more than 5 years ago | (#26055623)

A couple of days ago Slashdot had Twenty Years of Dijkstra's Cruelty [slashdot.org] . In it, he proposed using a non-executable language to force the students to use formal methods to prove the correctness, rather than trial-and-error testing.

I was quite disappointed to see the conversation devolve into Python -vs- C -vs- Java -vs- Haskell, all of which are not what was proposed.

Has anyone gone to a University that does it the way Dijkstra proposed? (Does the University of Texas at Austin still do it this way? Any comments on it if they do?)

I'd think if your aim is to be a programmer at a commercial house later coursework would need to emphasize the skills needed for making successful software, as Stroustrup [slashdot.org] emphasized. But would Dijkstra's course be a better starting point?

Re:Dijkstra's Method? (1)

vrmlguy (120854) | more than 5 years ago | (#26055869)

A couple of days ago Slashdot had Twenty Years of Dijkstra's Cruelty [slashdot.org] . In it, he proposed using a non-executable language to force the students to use formal methods to prove the correctness, rather than trial-and-error testing. [...] But would Dijkstra's course be a better starting point?

Do you know how LISP was created? http://www-formal.stanford.edu/jmc/history/lisp/node3.html#SECTION00030000000000000000 [stanford.edu]

Another way to show that LISP was neater than Turing machines was to write a universal LISP function [...] Writing eval required inventing a notation representing LISP functions as LISP data, [...] S.R. Russell noticed that eval could serve as an interpreter for LISP, promptly hand coded it, and we now had a programming language with an interpreter.

And that's the problem with Dijkstra's idea. As soon as the non-executable language is specified, some smart-alec's going to code an interpreter for it, and *poof* you're right back where you started.

OOP is imperative programming (0, Redundant)

SpinyNorman (33776) | more than 5 years ago | (#26055629)

OOP isn't an alternative to imperative programmg - it's a form of it.

OOP is contrasted with procedural design - also a type of imperative programming. The classic description of the difference between the two is that to implement a written specification, for OOP you implement the nouns (objects), else for procedural you implement the verbs (procedures).

"excessive" reliance on libraries!?? (2, Insightful)

toby (759) | more than 5 years ago | (#26055633)

Re-inventing the wheel is the pathology.

One of the most significant advantages of Java *is* the availability of mature libraries! They are there to be used.

Separate ideas from the language implementation (2, Interesting)

dougwhitehead (573106) | more than 5 years ago | (#26055635)

I was a CS major in 1979 at VT and we had a beginning course that taught principles in pseudo code and programming language and assignments in Labs. Each student was in one of four labs where they taught implementation of these techniques in: C, Pascal, PL1, or Fortran.

This curriculum was way ahead of its time. I have always felt it gave me an amazing foundation. (Unfortunately it was abandoned as the department watered down the undergraduate program to expand the curriculum into grad school)

The political paradigm (2, Interesting)

GaryOlson (737642) | more than 5 years ago | (#26055651)

Take a little from every one. Then promise you can deliver in whatever language your prospective future employer wants.

Teach students something they aren't familiar with (2, Informative)

iteyoidar (972700) | more than 5 years ago | (#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]

LISP (0)

Anonymous Coward | more than 5 years ago | (#26055673)

programming in *any* language is better than talking about programming...

Stack of Pancakes (0)

Anonymous Coward | more than 5 years ago | (#26055699)

Why do the CS teachers always draw the stack from top to bottom? When I get a stack of anything I start putting stuff on the bottom. If these types of paradigms are used its no wonder people don't get it.

problem solving first, programming second. (2, Insightful)

blackcoot (124938) | more than 5 years ago | (#26055715)

if it were up to me, i would teach a first course in computer science using only pencils (maybe pens for the foolhardy) and paper. i say that as someone who has t.a.'d a lot of programming classes.

the issue, at least as far as i've observed, is that until a student has a solid ability to start decomposing a problem using top-down and bottom-up approaches, trying to teach them any kinds of programming language or algorithms is pointless. it's like having a carburetor and no car.

i would suggest that c.s. instruction, especially at the early phases, should aim to make students spend a lot of time asking questions like: "what information do i need to solve this problem?", "what is the easiest useful thing i can do to help solve this problem?", "what's missing from my solution?", "is it easier to break this step down more or just do it right here?", "how can i join X and Y to do Z?", etc. once you get students asking those questions, picking up programming languages is a lot easier: they know what they want to do, all they need to focus on is how.

Spare me the elitism, please. (0)

Anonymous Coward | more than 5 years ago | (#26055727)

Oh my goodness. What you learned way back when, "when they did things right", or even recently, is not relevant. As someone without a background in programming, and no, not everyone has one, particularly outside of the Slashdot community, I would like to be informed in an introductory language that will be A) useful, B) relatively easy, and C) representative of the broader scope of programming languages.

I don't think it's unreasonable to ask Slashdot for advice in this matter. I can't wrap my mind around this pervasive notion in the computer science/software engineering community that if you don't have knowledge of every language known to man from the get-go, you are a worthless cad.

If someone could just state a language and a justification, I would be everlastingly grateful.

Your first paradigm won't do you much good (0)

Anonymous Coward | more than 5 years ago | (#26055729)

Twenty cents doesn't go very far these days.

*ducks*

Paradigms (1)

stdion (1086389) | more than 5 years ago | (#26055739)

I'd start with the way CPUs process code which is typically imperative, covering Python, assembly then C. Python so they can get the high-level concepts if they are new to programming as a whole. Assembly so they can see how instructions are truly carried out on a machine and issues related to instruction sizes, etc. (mov, cmp, jmp, .. keep it simple). Then C, so they understand why imperative programming is structured the way it is. I'd then cover its perceived weaknesses (I love C but understand its shortcomings) and why C++/Java/others were invented around C. I'd then introduce them to Haskell, Erlang, Scheme/Lisp, etc. that completely break away from this model and why. Give a little history on their purpose and assign real-life examples to work through so they may have a warehouse of tools at their disposal rather than a hammer.

That's the way I wish I would have learned it. If a student is passionate about programming, he'll find reasons to explore more languages and understand their niche regardless, but as I said, the discovery would have gone a lot faster if I had been taught it rather than wondering around without a guide, ie, being self-taught.

Scheme (1)

linuxhansl (764171) | more than 5 years ago | (#26055741)

I am forever grateful to my professor (at a German university) to have started all of us with Scheme to learn the basic principles of programming, complexity, computability, etc.

She even taught object oriented programming using Scheme (yes, you can implement encapsulation and message passing using lambda calculus quite easily).
Later we applied those principles to other languages (the most popular choices at that point were Modula-2, C, and of course C++).

I have never used Scheme in a professional environment since, but the lessons learned then still stick with me almost 20 years later.

Storytelling Alice (2, Informative)

Simina Branzei (1413111) | more than 5 years ago | (#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.

A language no one knows about (1)

SkinnyKid63 (1104787) | more than 5 years ago | (#26055763)

My first language at the university level was Meta. Technically, it was Scheme/Lisp. From there on out it has been all C/C++. I'm finishing a course in Assembly.

Procedural, then object orentied, and lots more (1)

poundjd (1286272) | more than 5 years ago | (#26055769)

A computer is a turning machine, and people easily relate to procedure based programing at first. Object programing encapsulated procedures in side of objects methods for various good reasons. the concept of objects is just a little harder for students to grasp at first. once they have a decent handle on those then I'd introduce the concept of recursive programing, and then stack based programing. Once they had the basic concepts form these four approaches to programing then really start expanding their awareness of other types of programing models and exposure to many languages. On of the most educational classes I had in collage was comparative languages. In that class we solved the same 10 problems in 10 different programing languages. Really opened my mind to the fact that every problem is different and while there are approaches that allow the problem to be addressed in any given language, there were some problems that were obviously much simpler to some in some languages than in others. Any competent programmer today is a multi language programmer and picks up the next language quite easily and quickly. This is where the college would really excel at providing graduates that were really ready to enter industry as productive people. -jeff

back in the old days... (4, Informative)

micromuncher (171881) | more than 5 years ago | (#26055783)

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.

C in intro to programming? Yikes! (3, Informative)

Spazmania (174582) | more than 5 years ago | (#26055789)

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.

Math (3, Interesting)

spydabyte (1032538) | more than 5 years ago | (#26055805)

The basics of all computing, why we started building circuits, was mathematics. Algorithms was originally "dirty math" but now contains some of the most elegant mathematical proofs ever, due to the expansion of computing.

An era ago computing majors were unheard of, they were applied mathematics majors.

Re:Math (1)

spydabyte (1032538) | more than 5 years ago | (#26055817)

Although my first official schooling of computers was C++ and the hanoi towers paradigm. Recursion brought out some beauty concepts. It wasn't until several years later that I learned about OS and language designs.

Well, that's your problem then ... (2, Insightful)

gordguide (307383) | more than 5 years ago | (#26055849)

" ... I'm interested in language-independent opinions that Slashdotters might have on this matter. ..."

Slashdotters don't have any language-independent opinions. Sorry.

Our U. has the same problem (1)

d3ckard (1428067) | more than 5 years ago | (#26055851)

The university where I work on IT Staff tries to thread the needle on this. I am taking a beginning programming class for the first time in 20 years. While I did some BASIC and Pascal (I even just rediscovered Logo from my prepubescent days!), I had long gotten away from programming, turning into a hardware geek. But I went back to pick up some new skills ... the school uses Java for most of its classes, including the first two intro classes. Later, for the majors there is some C, Python and Assembly. But the instructor I had this semester tried to teach code first, emphasis on getting things working, before picking up classes and objects late in the semester. Contrast that with other instructors teaching different sections of the same course that go all out for the OO approach. Still, the focus of the major is that a student should be able to step out into the real world and adapt to any number of languages within about a week;s time.

Not sure about others, pleased with Python (3, Insightful)

KingAlanI (1270538) | more than 5 years ago | (#26055879)

In my senior year of high school, my senior project was essentially an independent-study intro to programming.
My advisor suggested Python (version 2.4 at the time), and thought that C/C++ was a bad idea for an intro language (C++ had been my initial suggestion)

I was pleased with the result; I felt that Python's straightforward English-like syntax, lack of funky punctuation as a structural construct, as well as not having to start scripts with declarations or somesuch, meant that I didn't get bogged down in arcane language features as I was trying to practice basic concepts.

(I came into that with no code-writing experience beyond simple HTML/CSS/JavaScript)

Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...