Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 Making the case for O'Caml as an introductory language
Index -> Programming, General Programming -> Functional Programming
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message

PostPosted: Tue Jan 04, 2011 3:54 pm   Post subject: Re: RE:Making the case for O\'Caml as an introductory language

SmokeMonster @ Tue Jan 04, 2011 5:32 am wrote:
wtd @ Sat Jan 01, 2011 9:03 am wrote:
SmokeMonster: which programming languages do you know?

I ask because what we already know biases us, but I am proposing an introductory language and not an only language.

I know VB, Java, C and Ruby (learned in that order). I've done most of my programming recently in C.

bbi5291 @ Sat Jan 01, 2011 2:48 pm wrote:
SmokeMonster @ Sat Jan 01, 2011 6:17 am wrote:
I know tons of people who started off with Java as their first language and turned out to be just fine as programmers.
I'm convinced that there are a lot more people who start off with Java and then don't turn out to be "just fine" as programmers. I'm not really sure why this is. It could be because Java is such a bad language to use to teach programming, or it could be because Java is really easy for people who are n00bs in the first place to understand. Functional languages do seem to do a good job of weeding out students whose motives for studying CS aren't "pure", so to speak.

What is the basis of that remark other than what seems to be a personal hatred and distaste for Java. Do you have any statistics to back that claim up? Java is hardly a noob language, as it has been mentioned in this very thread it has a steeper learning curve due the the fact how engrained OOP is in the design of the language. Sure it's not as hard on you as something like C is but in no way is it a noob language like VB. Also, the second part of your argument does not make a lot of sense, someone doesn't become a programmer by taking that first year course in introductory java, one has to go through exponentially harder stuff like Algorithm Analysis, Compilers, Formal Languages, Operating Systems etc before they graduate and surely those classes would do a better job of weeding out students or toughning them up then any basic first year introductory course using a functional language (or any language for that matter would) ever could.

To address the question of fact: Regardless of whether you start in Java, or C++, or Python, whatever, you're more likely not to be a successful programmer than to be a successful programmer. So in that sense my statement is true at face value. But yes, you're right, I don't have the statistics to back up my real claim, which is that there is a correlation between starting in Java and poor future performance in programming. It's actually based on personal experience. Almost all of the best programmers I know knew how to program before taking high school CS classes, and they rarely choose to learn Java first.

Correlation does not imply causation, which is why I said "I'm not really sure" --- I don't insist that learning Java first tends to make one a bad programmer; rather, I simply consider it likely.
JavaSchools also fail to train the brains of kids to be adept, agile, and flexible enough to do good software design (and I don't mean OO "design", where you spend countless hours rewriting your code to rejiggle your object hierarchy, or you fret about faux "problems" like has-a vs. is-a). You need training to think of things at multiple levels of abstraction simultaneously, and that kind of thinking is exactly what you need to design great software architecture.

(This is from )
What can we take away from this? If you really know in advance what skills you're supposed to be developing, and you work on developing them, then it doesn't matter whether you start in Java or any other language. If you don't, which is generally what happens when people learn to program for the first time, then, in Java, you're more likely to be bogged down by the details of OOP when you should be thinking about abstraction, whereas in a functional language, you're forced to think in abstraction from the beginning.

My second comment is only tangentially related to the first one. Some people want to become great software engineers. Others begin with the aspiration of creating amazing games without the willingness to learn good design technique and difficult math and algorithms. The sooner the latter group figures out that CS/SE is really not for them, the better. I'm not saying this out of contempt, but matter-of-factly; I feel sorry for people who, upon reaching Waterloo CS, realize that CS isn't what they thought it would be. If you start by learning a functional language, you'll figure it out pretty quickly, whereas this isn't true of Java, in which you can start writing crappy games pretty quickly.

PostPosted: Tue Jan 04, 2011 10:23 pm   Post subject: Re: Making the case for O'Caml as an introductory language

jcollins1991 @ Wed Jan 05, 2011 4:34 am wrote:
With the explanation the syntax of O'Caml actually seems pretty nice.


# let baz =
     (let foo = 42
      and bar = 2
         (foo / bar - 5 * 2 + 1))
  and wooble = 4
     (baz - wooble) ;;
- : int = 8

Being able to define local variables within function definitions is extremely nice and could add quite a bit of readability to programs, and feels a lot more intuitive than the equivalents in the Racket teaching languages.

For those wondering, the above would look like the following in Scheme.

(let ((baz (let ((foo 42)
                 (baz  2))
               (+ (- (/ foo bar) (* 5 2)) 1)))
      (wooble 4))
    (- baz wooble))

[quote="jcollins1991 @ Wed Jan 05, 2011 4:34 am"I guess the only problem left would be indentation preference, is there any type of standard for indentation (like with Python)? (In Racket it seemed some profs liked certain indentation while others had really ugly indentation, and I ended up having to completely reformat a lot of code examples to something that my eyes could easily scan through)[/quote]

There are no mandated rules about whitespace. I could write my example as follows and it'd be perfectly valid.

# let baz = let foo = 42 and bar = 2 in foo / bar - 5 * 2 + 1 and wooble = 4 in baz - wooble;;
- : int = 8

That said, I either indent 3-4 spaces (consistently) or if I'm putting arguments to a function on their own lines I use:

foo bar
    (wooble a)

PostPosted: Thu Jan 06, 2011 2:19 pm   Post subject: Re: Making the case for O'Caml as an introductory language

Another update.

O'Caml Intro.txt
Lots more this time!

 Filename:  O'Caml Intro.txt
 Filesize:  29.14 KB
 Downloaded:  346 Time(s)


PostPosted: Wed Mar 09, 2011 10:00 pm   Post subject: RE:Making the case for O\'Caml as an introductory language

As someone taking computer science at Waterloo next year, I would love it for the courses to be taught in O'Caml. I've never used the language myself, but from what I've seen, it looks like it would make a great stepping stone onto "weirder" languages like Haskell.

Regardless of whether or not you'll ever use it outside of academia, just learning a functional language is a great exercise which all programmers should at the very least attempt. I play around with Haskell on occasion, and despite never having used it in a major project, just the process of learning the language has completely changed how I look at certain problems: it requires a completely different mindset which lends itself extremely well to problem solving.

Scheme is also a great introductory language though, and so long as something like Java or C++ isn't taught, I'm happy.

Edit: Just for clarification, I am not advocating Haskell as an introductory language. I love it myself, but it is just way too mystical to teach as an introductory course: by the time the professor got through all of its nuances (monads, the type system, etc), there wouldn't be enough time to actually teach any computer science. Heck, I've been slowly teaching myself for over a year and I feel like I've barely scratched the surface.

PostPosted: Sun Mar 13, 2011 10:47 pm   Post subject: RE:Making the case for O\'Caml as an introductory language

Thanks for the bump, Shanethe13.
Display posts from previous:   
   Index -> Programming, General Programming -> Functional Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 35 Posts ]
Goto page Previous  1, 2, 3
Jump to: