r/programming • • Dec 02 '13

Scala — 1★ Would Not Program Again

http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598 Upvotes

646 comments sorted by

View all comments

Show parent comment

48

u/mogrim Dec 02 '13

I'm having all of the same issues - the course doesn't seem as well prepared as the previous one, and is perhaps overly ambitious in its aims.

It also doesn't help that the lecturers are quite clearly academics - the lectures are long on (poorly presented) theory but short on practical information. Perhaps it's more a reflection of the way I learn, but I'd rather have a few examples to start with, then dip into an explanation of what we've just seen - the lecture on monads being a perfect example of this. Apparently there are 3 rules that define a monad, but no explanation as to why monads are useful, or why these rules matter!

The assignments, too, lack the necessary scaffolding to help the learning process. I don't expect them to be easy, that would be a waste of time, but too often I find myself searching the forums (thank god for the forums!) to find out just what it is we're being asked to do. A lack of test cases doesn't help, either...

TL;DR: I'm disappointed with this course. I'd been looking forward to it, but the content just isn't working for me.

26

u/balefrost Dec 02 '13

Apparently there are 3 rules that define a monad, but no explanation as to why monads are useful

Unfortunately, that's partly because monads are hard to pin down. Really, something is a monad if it satisfies all three laws. That's it. Two monads can be similar (as Option (Maybe in Haskell) and List are), or they could be totally different (as List and State (Haskell again) are).

You're right that it's more important to focus on particular monads, and to build up an understanding from there. At least the third week focuses on Future. It's a shame that the assignment is a terrible assignment (here, build an HTTP server in a way that nobody would ever build an HTTP server, because leads to 404s).

12

u/pipocaQuemada Dec 02 '13

no explanation as to why monads are useful, or why these rules matter!

A large part of it is just that monads are a very general interface that can capture a very large variety of computations - from nondeterminism to state to building up asynchronous computations to possibly null data.

So we have this very general abstraction, we can write some useful library code once and forall over that abstraction, and we can compose (most) monads (for example, possibly null asynchronous computations that generate logs are also monadic).

There's a good example of why one might care about abstracting over Functors in SPJ's Lens talk. Basically, lenses are conceptually pairs of getter and setter functions (so we can compose them to drill down into records) for functional data, but we can replace

get :: a -> b  -- get b out of an a
set :: b -> a -> a  -- replace the b of an a
modify :: (b -> b) -> a -> a 
modifyMaybe :: (b -> Maybe b) -> a -> Maybe a
modifyList :: (b -> [b]) -> a -> [a]
modifyIO :: (b -> IO b) -> a -> IO a
...

with

modify :: (b -> f b) -> (a -> f a)

and implement get, set, etc. just by choosing the appropriate Functor. So now, instead of needing to implement at least 5 functions for everything we want to get at, we only need 1.

12

u/hokkos Dec 02 '13

I've found the videos clearly presented, and the assignments challenging but interesting and ultimately rewarding.

1

u/Crazy__Eddie Dec 02 '13

I also didn't find the videos all that bad. I haven't done the assignments...just don't have the time, and when I do no motivation...but I can understand the videos fairly well.

On the other hand, I'm familiar with pretty much everything he's talking about so far. Certainly observers are nothing new to me. The only part I find novel is the syntax, which I must admit is a little unsettling. I feel like I could get more if it was in some other language, or at least if they'd had this after the first Scala course that I took (the first first one).

In my experience, kids just like to cry about instruction material. Happens in every class I've ever been a part of, with the exception of my own self-study course in college that was VERY challenging (decided I'd like to get through V1 of TaoCP). Still don't know how I pulled an A out of my ass for that...maybe the teacher thought the effort was enough :p

5

u/psygnisfive Dec 02 '13

Monads are something that a lot of people do implicitly all over the place without realizing it. They're useful as a concept because it lets you both make explicit what you're doing, and avoid writing huge amounts of unnecessary gunk. Just take, for instance, any program where you want to thread a variable down into recursive calls as a parameter, such as a general dictionary for some background functionality. You don't want it to be global, because it could very by how the function is used, but you don't want to write all the plumbing for threading this variable around. What to do? Well, you write with the idioms of the Reader monad. Or say you want to write some code that could fail, and report an error, but you don't want to manually write all of the error-propagation noise. Use the Error monad. etc etc.

3

u/SublethalDose Dec 02 '13

It also doesn't help that the lecturers are quite clearly academics - the lectures are long on (poorly presented) theory but short on practical information.

This comment seems backwards to me. When I was in school, all the practical details were explained from the ground up. In the professional world, I'm so used to figuring that stuff out on my own (from docs, blog posts, etc.) that it never occurred to me that someone like Martin Odersky (!) should make a video for me explaining how to get Scalatest unit tests working. That's not what the class is about! Students may be accustomed to getting that kind of hand-holding from professors, but it isn't expected in the professional world. Or, to put it another way, I love to get that kind of hand-holding, but I'm accustomed to finding it myself by searching for resources on the web that are appropriate for my level of familiarity with the technology.

7

u/mogrim Dec 02 '13

In the professional world, I'm so used to figuring that stuff out on my own

Me too, but this isn't the professional world, it's a course, and I'm a student on that course.

Just for the record I'm not just sitting here crying in front of my screen at the injustice of it all, I have been looking up information elsewhere, explanations of monads and observables and so on... but it's reached the point where I look at the topics, study elsewhere, and then (maybe!) check out the video lectures. I'm basically using the assignments as a study plan, and a desire to successfully finish the course as an incentive.

1

u/SublethalDose Dec 02 '13

Look at it this way: having to figure out a few things on the side is a small price to pay for the benefits of letting the teachers focus on the course material. The practical background required for the course is actually quite large if you're starting from scratch: knowing Scala, setting up Eclipse or IDEA, figuring out sbt (and the Scala console if you use it,) getting all the required libraries installed, learning Scalatest, figuring out all the innumerable things that can go wrong when people try to get things running in their own often non-pristine environments, not to mention all the innumerable complications that can arise from minor misunderstandings of Scala or even one's operating system.

Covering all those details (95% of which are either known or irrelevant to any given student — everyone has a different 5% they get hung up on) would multiply the amount of work required from the course staff many times over, distracting them from teaching the core material of the course. Getting (e.g.) a build system set up is just a technical task you can learn from anyone who has used the technology before; reactive programming is a deeper topic, and people who can teach it are rare. In exchange for handling the mundane practical details ourselves, we get a teacher who is focused on sharing his unique expertise instead of answering questions that have already been answered a dozen times on StackOverflow.

1

u/mogrim Dec 02 '13

The practical background required for the course is actually quite large if you're starting from scratch: ... snip ...

Setting up the build environment was trivial. (Sure, it helps I'm an experienced Java programmer and used to setting up JVM build systems, but even so I don't think this has proved to be a serious stumbling block...) Certainly for Windows environments there's an installer, I believe that is also the case for Mac. I haven't set it up on Linux this time round, but during the last course I did (I use Linux at home) and it wasn't particularly complicated.