• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lecture Notes on Scala

 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cay Horstmann, author of Big Java (which was the textbook I used to learn Java) is teaching a class this semester in Scala. He is making all his lecture notes, labs, and homework available online. It's not a bad way to pick up notes on the language if you're interested. Here is a link to his blog posting, and here is the class schedule including lectures and labs assigned thus far.
[ September 12, 2008: Message edited by: Garrett Rowe ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is really cool. I went through a few of the lectures Saturday.

He says a number of students had difficulty getting Java set up. I have a funny feeling those students aren't going to do well with Scala either.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the links. I'm still not groking this Functional Language stuff. All my real world experience is typically very simple procedural stuff. As a CS course, and one that is really about compilers, they use a lot more data structures and algorithms than I use in years of "real world" work.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still not groking this Functional Language stuff.

Out of curiosity, do you find it difficult to understand the idioms, or the usefulness?
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Garrett Rowe:
Out of curiosity, do you find it difficult to understand the idioms, or the usefulness?

I'm not sure. Perhaps I don't understand the idioms well enough to see the usefullness.

The examples always do a ton of list processing. And while lists are cool and useful, I rarely use them. For 30+ years, I seem to always doing something like:
  • display form to user
  • get wad of fields from user
  • do near trivial amount of processing
  • talk to database
  • get wad of fields from database
  • do near trivial processing
  • repeat until done


  • Once, well over 35 years ago, I wrote a recursive descent parser in Cobol. Since then, I've used many languages more suited to the problem, but never had to write another parser.
     
    Marc Peabody
    pie sneak
    Sheriff
    Posts: 4727
    Mac Ruby VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If you're doing basic CRUD apps, there's very little need for functional, I agree. There's no difficult processing and the server can easily manage each incoming request as a separate thread for you. I've struggled with trying to find the right niche for FP myself.

    I'm a bit surprised that you don't work with collections very frequently. They're all over the place in everything I write and that's a big part of why I'm grokking Groovy so much - because it makes dealing with collections so simple. In fact, it's so simple that I often try to think of how to express things with data structures as frequently as possible (something I also recently read in The Art of Unix Programming as a great idea). Scala has a lot of the same coolness with collections as Groovy but things like Scala's map() don't get much publicity.

    If nothing else, it's cool to see a JVM language replacing Scheme in universities. I'd hate to see students go to the dark side because they were taught F#.
     
    Pat Farrell
    Rancher
    Posts: 4678
    7
    Linux Mac OS X VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Marc Peabody:
    If you're doing basic CRUD apps, there's very little need for functional, I agree. There's no difficult processing and the server can easily manage each incoming request as a separate thread for you. I've struggled with trying to find the right niche for FP myself.

    I'm a bit surprised that you don't work with collections very frequently. They're all over the place in everything I write and that's a big part of why I'm grokking Groovy so much - because it makes dealing with collections so simple.


    I use Collections a fair amount, but its really more like:

  • do select against DB
  • return results in a list
  • use results to fillin form

  • While I hate to think that I've spent 35+ years doing just CRUD, in practice, that's what 99% of business applications are about.

    Most of the time, the closest you get to an "algorithm" is searching through a list for a match or the max.
    [ September 16, 2008: Message edited by: Pat Farrell ]
     
    David Pollak
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    CRUD and FP do mix quite well.

    With normal CRUD apps, one must somehow bind between the model and the generated HTML. In Lift (the web framework that's built on Scala), one does:

    text(record.field, record.field = _)

    This creates an HTML input with the default value of the field. When the form is submitted, the function defined in the second parameter is called. Thus, a function is bound to an HTML form element and the function is called when the form is submitted. This creates a "continuation passing" style of web development by abstracting away the HTTP request/response cycle. Further, because the name of the HTML element is randomly chosen (unless you're running in test-mode), replay attaches become radically more difficult,

    So, even in CRUD-land, FP makes a difference.

    Thanks,

    David
     
    Anirudh Vyas
    Ranch Hand
    Posts: 93
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    pat,

    even in those CRUD apps, i assume you have used javascript once at least? and if i may be a little bold, you'd have prolly encountered nested, anonymous functions etc. Today if you are exposed to an app that uses ajax and fair amount of js, then you have been exposed to FP paradigm, although you are not "formally" aware of it.

    To other poster : Groovy is a decent language, i am not a fanatic on arguments, but I HATE purely dynamic languages with passion; I think a mixed breed works the best.

    Scala is not just any FP language, Haskell is such a language; I don't look for languages that make my life easier, i look for languages that makes my code more re-usable and elegant, Scala is more elegant than Java (at least for the moment) and hey C# is great too, at least for the present; Java needs to grow up a little more.

     
    Anirudh Vyas
    Ranch Hand
    Posts: 93
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Pat,

    Although as an addendum, i understand your ideas "generally"; frankly speaking if you are in commercial applications business and have not designed and developed framework or submitted a patch for language or worked on language specific features or architect'd stuff, then yes, you dont get exposed to those CS concepts that you read up ...

    FP is just another way to broaden your way of thinking; This is what I don't like in work culture in general, ok so I have been doing this for years now, and whats the "use" of the stuff that I learn ... I just learn stuff to know more and more; knowledge is a driver for me, because in effect, it spreads the ideas around and finally if theres a feature in language thats lacking, then a JSR comes up (specifically relating to java) with requests from people like us which integrates features.


    just my two cents.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic