Scala In Financial District


#1

Not sure if this is actually a question but more of an observation. In being a newbie to Scala I decided to move from Odersky’s book “Programming in Scala 2nd Edition” to a Book on Functional Programming in Scala just to change things up a little for a while. The Book I choose is ( and not was so far :slight_smile: ) Functional Programming In Scala by by Paul Chiusano and Rúnar Bjarnason. This book is written in a very “difficult to understand” manner. It seems almost completely impractical as a text for a beginner to either learn Scala or Functional Programming. I am on chapter 3 at this point and find it somewhat miserable to read. I am curious as to what “Professional Developers” in Scala do in the “Financial District”. Scala is starting to catch on in the Financial District but they cannot seem to find enough people that can actually program in the language in a way that is practical in that environment. How do books, dense books , like Functional Programming In Scala help one to actually learn the language in a way that is practical in a financial environment that could "care less about category theory and/or all that esoterical stuff that many of the authors seem to insist upon ramming down the readers throats? Now … I am not saying that the author stinks because I am sure he/she has good intention and is truly trying to help people learn Scala, functional programming et al. But as a teaching book … does it really make sense to present material in such a dense and difficult way? Is the goal here to create books on Scala that only Guru scala developers and professors can understand? Is it some weird form of contest to see “who can create the most insane book” ?


#2

I like Scala, I really do. Perhaps a bit of that is from Stockholm Syndrome though. Having been forced to use it for work long enough that the concepts that Scala is geared towards of Functional Programming, were able to osmosis their way past my blood brain barrier.

I totally get your frustrations with learning from the existing literature and web tutorials.

Somehow being so different from procedural programming, early adopters of Scala who’ve written most of the docs and dominate the discussion are sort of a breed apart. To some extent I think most of the supposed teaching of Scala is unfortunately often meant to show the intelligence of the author and not to try to see the learning problem from the neophyte perspective and make things clearer.

Scala code can be much more concise. Sticking to ideas of immutable value usage can have huge payoffs for scaling via parallelism. But yeah, it’s hard to learn and much of the existing material doesn’t seem to recall at all what it’s like to be a beginner at it, nor have a very practical approach to training someone in the use of the language.

The main author of useful tidbits I usually find is Alvin Alexander. When you’re on his site you’re usually dealing in practical items solved in Scala.

FWIW I mostly work back in Java again profressinally. Since Java 8 you can take a ton of good ideas from Scala and use them in Java. It’s not quite as clean and cool but you can get a lot of ability to focus on what’s happening in the code without a lot of error prone mechanics in the way. Search “functional programming Java” and you’ll see what I mean. There are some wonderful YouTube videos on the subject by Venkat Subramaniam that really go at doing FP in Java and highlight practicality and why FP is a good thing without any of the I’m-so-smart stuff. He even has a great line: "A tester comes to me and says my code sucks and I say “I know it sucks, but tell me why it sucks today?” That kind of self deprecating humor is pretty handy for teaching.


#3

Try “atomic scala”


#4

You just picked the wrong book for learning Scala. Functional Programming in Scala doesn’t aim to teach a person Scala, but to teach a person pure functional programming and it uses Scala as the tool to do that kind of programming. So if you find the concepts of pure functional programming esoteric hocus-pocus, and just want to learn Scala, the only book you could have picked that is even further of what you’re looking for is a book about Haskell.


#5

Welcome to the world of Scala. I agree that documentation, especially one that‘s focusing on practical application and solving real-life issues is very rare. I can second Bentitos opinion on Alvin Alexander‘s books and blog. So far he‘s one of the few who‘s able and willed to explain things in understandable terms.

If you really want to dig into FP I highly recommend learning Haskell before, as you‘ll find it very difficult to understand those concepts with Scala‘s strange level of documentation. It seems that‘s the path that most authors took and that‘s how they expect that their target audience is skilled. It can get very frustrating.


#6

How do books, dense books , like Functional Programming In Scala help one to actually learn the language in a way that is practical in a financial environment that could "care less about category theory and/or all that esoterical stuff that many of the authors seem to insist upon ramming down the readers throats?

You picked a book that’s called “Functional Progamming in Scala”, of which the very first sentence reads

This is not a book about Scala. This book introduces the concepts and techniques
of functional programming (FP)—we use Scala as the vehicle, but the lessons
herein can be applied to programming in any language.

The book is about functional programming, and does so in scala. If you feel it’s ramming functional programming down your throat, well, that’s right. That what it does. Functional programming. It said so right in the preface. I’m not sure what you expected.

does it really make sense to present material in such a dense and difficult way?

Again, right in the preface, there is

A word of caution: no matter how long you’ve been programming, learning FP
is challenging. Come prepared to be a beginner once again. FP proceeds from a
startling premise—that we construct programs using only pure functions, or
functions that avoid like writing to a database or reading from a file.

The material is difficult. You can’t blame the writers of the book for the material being difficult. And it’s not like they sugar coat that: they warn you in advance.

If you wanted a book that’s not too hard, not primarily about functional programming but about the scala programming language, how did you read the preface, and figured that this probably was the book you wanted?

For a book that teaches you scala, I would highly recommend Programming Scala, by Wampler and Payne: http://shop.oreilly.com/product/0636920033073.do

For general advice: read the preface of a book, and don’t complain when the contents of the book are entirely in line with the preface. Functional Programming in Scala is not a book about Scala. It is a book about functional programming. If you don’t want to learn functional programming, and do want to learn scala, it’s not the book for you.


#7

I didn’t know there was a book by Eckel. Thanks! Reading the sample now.


#8

Try ‘Functional Programming Simplified’ by Alvin Alexander.


#9

I’ve been teaching Scala to novice programmers as their first programming language since 2010. Yes, most of the material written for Scala assumes that you already know how to code. As a result, I had to write my own. The Atomic Scala book has already been mentioned. My own material is textbooks and video lectures, that have been used by quite a few college students at this point. I will note that the purpose of the books is not primarily to teach Scala, but to teach programming in general. Since it aims at the novice programmer though, it teaches Scala from the ground up assuming no previous knowledge. It is not a fast introduction to Scala because it is intended to introduce a lot of general programming. It is not completely functional either. I mix imperative-OO with the functional approach because of the nature of the courses I was writing for. It also does not cover many of the more advanced topics in Scala that go beyond the learning objectives of the first year of college leve CS. If that still sounds interesting to you, you can get more information at http://www.programmingusingscala.net.


#10

Keep in mind, almost nobody who knows what they are doing recommends FPiS to Scala newbies. I’m very explicit with students that you should only crack that book once you know Scala well (the book does not teach Scala, it teaching functional programming using Scala), are seriously interested in learning hardcore Functional Programming, and are willing to put in the work to learn a very different style of coding. If somebody recommended it to you now, they made a mistake.

It’s not that it’s a bad book – IMO, it’s a very good one – it’s that it’s not the right book for your needs. You’re looking for a book that teaches Scala, and this was never intended to be that book. Until and unless all of the above is true, I would set it aside.

(My usual first recommendation for anyone with a Java or C# background is “Scala for the Impatient”.)


#11

Thanks for your advice. I am not saying that it is a bad book at all. In fact, I do not even know enough to determine if it is a bad or good book. I am mainly observing the teaching style. The approach is very different and is not conducive to maintaining the attention span of the typical java ( or any ) developer that is seeking knowledge. I come from a slightly different back-ground. Computer science ( or programming ) is my second career. I have had the opportunity to observe and learn from a wide variety of teachers in many different disciplines. There is a notion of teaching techniques that falls along the scale of 1. bad teacher 2. good teacher 3. master instructor. I am not sure if the author of the book falls in the category of master instructor “yet”. I have not given up on the book yet. And as for “scala for the impatient” and other similar texts that you present , I completely understand what you are saying. As I said in the original posting, I have read almost all of the book “Programming in Scala by O.”, and have devoted a lot of time meticulously going thru each chapter and all of the examples. I decided to pick a different type of text on Scala just for a change and ran into the Enigmatic “Functional Programming in Scala”. I am not one to give up too easily; even if I seemingly appear to dump on the book because of it’s initial teaching style. But now , see this. My first career was that of a very serious musician; one that spent hours and hours sitting in a practice room studying various types of scales, intervals, chords … as an applied Flutist at a music conservatory. Thru that discipline , I can see how the book, FPIS, can be approached. It is actually similar to studying music. I can see how thru practice and careful analysis of the exercises that the author presents one will start to both feel and visualize how the various functional shapes fit together. This is because of my musical background.
Nonetheless, it would be nice if there were a master instructor that could present the material in such a way that anyone, even the most elementary of programmers could easily grasp the material.
An analogy to all of this would be the great Carl Jung, the famous psychoanalyst. He wrote many volumes of text regarding the subconscious mind and created what amounts to a dictionary of primitive archetypes that could be used to interpret dreams. He received many awards for his great discoveries in the area of psychoanalysis. But there was one thing that he always wanted to do: and that was to write a text that people other than those with Phds and other high academic achievement could understand. So he wrote a book called man and his symbols that fully describes his PHD research work in such a way that even “I” could understand it.

That is what want to see in the literature of Scala Development ( and Functional Programming )


#12

Typical Java Developer Does Not have time to learn yet another language like Haskell in order to learn functional programming. But the idea is interesting. I might take a look at Hastell one of these days … when I find the time.


#13

That’s fair, and I suspect it’s doable. The funny part is, though, I suspect that’s easier if it’s aimed at absolute beginners. FPiS is aimed at experienced Scala programmers, so it goes very deep, very fast.

An example that I think is closer to what you’re talking about is Creative Scala. That’s a very friendly little book that teaches basic programming using Scala, using FP as the general approach. It’s much more approachable. (Indeed, in a couple of months I’m helping to mentor a ScalaBridge class aimed at new programmers that is based on it.) The companion book Essential Scala is similarly pretty friendly, and goes rather deeper, but is still only talking about the day-to-day stuff. It’s still generally teaching FP, but focusing on the stuff you need routinely.

Basically, FPiS is primarily aimed at already-skilled Scala programmers who want to gain the skills necessary to write pure-functional libraries – not just creating routine functional application code, but really understanding what’s going on at a deep level. It’s great for that, but overkill for the typical programmer on the street. But the community is gradually creating books like Creative Scala and Atomic Scala, that teach idiomatic FP Scala code in a friendlier way.

As for Haskell, I recommend taking a look at Learn You a Haskell for Great Good! (yes, really). While not everyone I know loves it, I found it a fine introduction to the language.


#14

The best book I that I have used is Learning Scala by Jason Swartz an O’Reilly book. The examples and Exercises are great. Then I would watch the youtube vid by Daniela Sfegola
about Category Theory, an important concept.

https://www.youtube.com/watch?v=Ss149MsZluI