Skip to content

Instantly share code, notes, and snippets.

@fehmicansaglam
Last active August 29, 2015 14:00
Show Gist options
  • Save fehmicansaglam/11169158 to your computer and use it in GitHub Desktop.
Save fehmicansaglam/11169158 to your computer and use it in GitHub Desktop.
Why I think scalatutorials.com uses the wrong way to teach Scala
Step by step tutorial, the UX, and the worksheet are great.
(Although the worksheet did not run for some of the lessons on my Chrome, Ubuntu 14.04)
Scala Tutorials does not have an introduction to Scala.
It starts with some arithmetic operations.
This gives the idea that the whole tutorial will be a conversion guide from Java to Scala.
By contrast Twitter Scala School starts with a brief but important introduction.
* Why Scala?
* Think Scala
Scala is not just a nicer Java.
You should learn it with a fresh mind- you will get more out of these classes.
/*It seems to be a tiny detail but teaching vars(Lesson 3) before vals(Lesson 4)
does not match the "importance" of them. And naming vals(values) as final variables makes us be
certain that this is just a conversion guide from Java to Scala.
Combined with "for loops"(Lesson 18) your junior devs will likely produce the horrible code below.*/
case class C(age: Int)
val list = List(C(1), C(2), C(3))
var sum = 0
for ( i <- 0 until list.length) {
var item = list(i)
sum += item.age
}
println(sum)
/*The below code is the only sample for "Loops without loops"(Lesson 19)*/
(0 until 10).sum
/*You should teach higher order functions first.
And you should show how they are important for functional combinators in collections.
Twitter Scala School does this quite well.
http://twitter.github.io/scala_school/collections.html*/
/*Lesson 21 has the title "Match as a Switch". I suggest changing the title.
Teach pattern matching with case classes and the Option type and with its other use cases.
*/
/*Do not teach them loops. Teach them for comprehensions with collections,
with the Option type(which is also a collection) and the Future type, and etc.
Make them have at least a little understanding of what a Monad is.
And ensure that they understand the danger in the code below.*/
var x = 0
async { x = x + 1 }
async { x = x * 2 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment