Senin, 29 Maret 2010

Begining Scala


Ouch! That hurts my brain! Stop making me think differently. Oh, wait . . . it hurts less now. I get it. This different way of solving the problem has some benefits. I felt that way after my firstz year of law school. I felt that way for a while when I began coding Scala. What’s this Option thingy? Give me back my null! How do you get the fifth element from a Seq? On and on it went. Day after day of head-splitting paradigm changing and breaking 30 years of coding habits, I am somewhat at peace with the Scala way of coding. Yes, my coding habits were borne out of 6800 machine code coding. Talk about imperative coding. That’s all you’ve got when you’ve got an accumulator, a program counter, and an index register. I grew up through BASIC, Pascal, C, C++, Objective-C, and Java. And along comes this Scala stuff, this functional-objective way of thinking, these compositional design patterns. Who thought this wacky stuff up?

After more than two years of coding Scala, I’ve come to understand that the Scala idioms are really better. My brain has finally stopped hurting. I’ve finally stopped fighting for flow of control statements. I see that it’s more important for me to take small elements and compose them together into complex systems. I understand that if a method always returns the same output given the same input, I can safely glue that function together with other functions into a very complex structure. I understand that explicit looping in my code is a distraction from the business logic that is buried in the code. My path was hard, and I hope yours will be easier.

The first step in writing Scala is not being afraid of the fact that Scala’s going to warp your brain. The next step in writing Scala is accepting that your code is going to look like Java, Ruby, Python, whatever code for a while. It will take you time and effort and more time to code Scala using the idioms in this book. It will take you time to design code that fits into Scala paradigms and to discover and devise paradigms of your own. It will take time but hopefully less time thanit took me.

This book is for you. It’s my attempt to show you a different way of thinking about and writing code. I hope that you’ll enjoy our journey through Scala together. I hope that by the end of this book you’ll have a new perspective on coding. I hope that you’ll be writing better code and fewer lines of code yet be happier about the code that you’re writing. So, come along. Stick that little toe in the Scala waters and see if they feel as good for you as they have for me.

Download Ebook Here

Tidak ada komentar:

Posting Komentar