Scala In Financial District

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” ?

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.

Try “atomic scala”

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.

4 Likes

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.

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.

6 Likes

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

Try ‘Functional Programming Simplified’ by Alvin Alexander.

1 Like

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.

2 Likes

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”.)

2 Likes

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 )

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.

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.

1 Like

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

I am not trying to put anyone down but i own quite a few books on Scala and have been learning it for a while. Many books and articles are written by knowledgeable smart people. The problem is these people forget how much they know and how to translate it into something new people can understand. It seems too many books and learning materials ASSUME too much too often. They assume you know Java. They assume you know all of the highly academic and technical jargon, like through osmosis it goes from their brain to yours or something. I spend much of my time googling terms and concepts like type classes and implicits.

I’ve learned at least 8 programming languages and scala is by far the most academic and frustrating of all, like a sea of special terms. You damn near need a dictionary of terms. It’s not just the syntax, it’s the fact that so much is not explained in so many of the texts, they assume you know what is in their head. Many authors seem to be more interested in showing how smart they are too,limiting the usefulness of the book, (some of my books are full of curse words now) One of my favorite lines “ah a bunch of ******* words that explain a bunch of ******* nothing, how beautiful” That is the feeling I get when reading some Scala books, this is not something I have noticed in other languages.

Many of the examples are tiny, it is hard to find an example of how to build things in Scala, like a full app. There are so many ways to do everything that you constantly see things done differently, often with little to know explanation because once again it is ASSUMED you know what they are talking about. Like the type keyword, you see it used in text but not explained why. I’ll write an article about this soon.

The lack of proper documentation really ******** irks me. Just type Scala documentation, you get a tour. A tour that leaves so much out it frustrates you, look how lacking the info on Traits is for example is sad. I find Alvin Alexanders site the most helpful.

In the Scala developer forum, on a thread named “How can we make scala more popular” I mentioned that scala needs real documentation, they should change the tour, either rename it a tour and remove the documentation wording or create a second in depth documentation and link from the tour to the in depth documentation. But I was kind of rudely told “that is exactly what we shouldn’t do” in those exact words too, which quickly ended all interest I had in helping the community with documentation whatsoever at all. That is like telling someone “you are stupid go away”. It makes it feel like a closed community. Honestly new comers to a language probably have a lot more insight into what documentation needs than a bunch of people that already know Scala. So I started my own websiteakashicseer.com. I plan on writing mostly about medium to advanced topics since the basics are all over.

I am also not the first to mention such an idea. I was trying to help them understand that a great language needs great documentation in order to get more people interested. That didn’t seem to register, as I got lots of links to Scala courses and was told about books I already own. They didn’t understand that I was not asking for help myself but pointing out a major problem for new comers to Scala and trying to help Scala become more popular in a thread titled “What can we do to make scala more popular” . Well here is a hint, try listening to new people. I even tried pointing out that the community should see documentation as a way to promote the features of the language, a way to show it off.

A language needs proper documentation. Documentation is not for learning a language, it is also for reviewing after you take a break from a language and come back or finding new things you didn’t know existed. But if Scala is the only language you have ever learned or used, maybe that doesn’t make sense. Developers like myself use multiple languages at one time when building apps. I will often use Scala in the back and Javascript in the front. I need good documentation to reflect on because I have not reached “Rain man” status with Scala yet, Javascript and Scala start looking a lot alike, especially the Functional parts.

Maybe I am one of the only people that has to use more than one programming language at one time. Does anyone else use 2, 3, 4 or more languages within a year? When you become a mature programmer you realize that documentation of your own code is important so that when you come back 6 to 12 months later you can quickly understand it, why is that any different for a full on programming language? Seriously?

I don’t own the red functional programming book yet. However Alvin Alexanders Functional programming book kicks ass. I can’t say enough good about that book. This guy has a knack for breaking down complicated subjects without the use of off putting technical jargon, just simple words for concepts. He often tells a story to explain a concept, before using the word. For example he gives you a story about why something like .map is needed by telling the story of how .map came to exist. Monads, functors, explained with stories not jargon. I love this book because it explains things in very short 1 to 5 page chapters, it breaks things down in tiny chunks with stories. This makes reading the book fun and seems like it takes less time. It is a GIANT 800+ page book. If I write a book I am following that short chapter layout for sure. Out of the hundreds of technical books I have read( I literally own hundreds) that is the only book I have ever seen with tons of tiny chapters. I love it.

Alvin Alexanders other book Scala cookbook is another must have. Want to know how to do something in Scala, that is the book.

Another book about Functional programming that I love is “Functional and Reactive Domain Modeling” That book covers Monads, functors, Scalaz and how to model systems with Scala. That book with Alvins functional book are super helpful.

Lack of proper documentation has lead to the death of other languages in the past. Scala is a great language for concurrency and parallel programming it has so much to offer, it would be sad to see it slowly die. If I didn’t see so much potential I would not waste so much time learning a language that is so hard to learn. Perl for example can be cryptic, but it is very easy to learn. I created my first social network with PERL and Javascript.

People that claim Scala is easy are probably doing it wrong, using idioms, techniques and practices they learned in other languages. I could be up and programming with Scala in an OOP Java style in no time, but that would mean missing out on tons of Scala power, the collection classes alone are super time savers.

You really have to learn the functional parts to harness the best of Scala. The functional parts were not so hard for me since I have many years of Javascript, Higher order functions were a nice discovery in Scala. You also need to learn when to use OOP and when to use Functional. Use functional in the small and OOP in the large, Alvins book on Functional programming points this out.

I chose to use Scala to build my latest project after much research. I didn’t just pick it because I thought, “Oh this language looks fun” I picked it for its power, strong typing, functional support, flexibility, scalability, akka actors, play framework and other frameworks and libraries. It was the actor framework, Kafka and Pulsar that pulled me in, that and Neo4j having a scala client.

I prototyped the app I am about to build in PHP, but I am building it in Scala for the above reasons. I like Scala because It has an in depth collection support and I can do much more with much less code. <- that is one main reason. A programmer only has so many lines of code in them, most of mine were wasted on Java and PHP, that is why Scala for me. LOL

Next year I plan on releasing a partial app with authentication, login/registration etc, just a basic app built with AKKA as a nearly complete example of how to actually structure a Scala app. The example app will also tie into a Social platform, so it will be a way for new comers to learn Scala in a very interesting, possibly money earning way. It should increase the popularity of scala, which is one reason I am writing articles about scala for future new comers. I want to try to explain things people will need to know to quickly understand Scala and get to building an app that ties into a larger system. This will help new people learn concepts quickly. One of the things that led to PHP’s massive explosive growth and popularity was Wordpress. I want to do the same for Scala, that is the goal anyways.

I just put up my blog where I will be writing articles about Scala, currently I am working on an article about Scala value classes, what they are and how they are used. I’m also about to finish an article about Modular software design, which is important with Scala. I’ll also be writing about case classes and when to use them or not use them. Basically articles like that, things I need to remember etc. I have a notebook that I have been keeping track of what I read in what book in order to find it again, so those become articles. I’ll often talk about books and post links to articles. Check it in a week or two once I get some content completed and published. akashicseer.com

2 Likes

Functional Programming for Mortals seems to me like a good intermediate-Scala-expertise introduction to functional programming. It isn’t aimed at complete beginners, but it’s also not aimed at experts, and the parts I’ve read are particularly good at motivating why you should care (in contrast to FPiS which mostly assumes you already do).

I like the Wampler book it has tons of useful information.

I was going to buy the Functional programming red book, but even used it was the same as new at the time so I bought Alvin Alexanders functional programming book and I am glad I did. That is a super introduction to functional programming one of the best I can find.

Exponential growth in books on functional programming https://www.linkedin.com/pulse/books-practical-functional-programming-sergei-winitzki/

Sergei Winitzki’s update on his book: “I embarked on deriving everything in FP from scratch, - no stone left unturned and no claims taken on faith. In my book, if something is not used for writing code or for reasoning about code, it does not exist…” https://www.linkedin.com/posts/sergei-winitzki-11a6431_winitzkisofp-activity-6586658545809391616-63Ai/

https://sites.google.com/site/winitzki/sofp

I fear that you remembered incorrectly. You said:

Tour of Scala is the closest I have found to documentation. The tour of Scala needs to be renamed “Documentation” to make it clear that is the documentation.

To which someone replied:

Actually, while I think you’ve identified a problem, this is exactly not the solution. The Tour of Scala probably ought to be labeled something that makes it sound less like “documentation”, because it isn’t – it’s a fine high-level overview, but is quite incomplete, and isn’t trying to be otherwise. It’s intended to be digestible, not comprehensive. My experience from helping folks on the Users Forum is that people tend to think the Tour is the documentation (and is therefore reasonably complete), and wind up pretty confused as a result. Putting the label of Documentation on it would, I think, make this far worse.

So in hindsight it seems that you very much agree, and that when put into context that line shouldn’t be interpreted as “you are stupid go away”.

1 Like