Scala levels: beginner to expert, application programmer to library designer

Scala is a bit of a chameleon. It makes many programming tasks refreshingly easy and at the same time contains some pretty intricate constructs that allow experts to design truly advanced typesafe libraries. This means that, depending at what piece of code you look at, Scala might look very simple or very complex. But which pieces exactly are easy for beginners and which are more advanced? In the end, everybody will have their own yardstick. Nevertheless, I am trying here to give a rough categorization.

I hope this will help newcomers to the language decide in what order to pick subjects to learn, and that it will give some advice to teachers and book authors in what order to present the material.

I assume that programmers have already a good knowledge of Java, so we can take at least pre-generics Java 1.4 for granted. If that's not the case, some of the entry-level concepts such as classes and exceptions would need to be moved to more advanced levels.

Also, I distinguish between Scala application programmers and Scala library designers, because the required skill sets are really quite different. A first shot at a categorization has been discussed last month on the scala-debate mailing list. The current categorization incorporates some of the suggestions that were made then. So, here we go:

[b]Level A1: Beginning application programmer[/b]

Java-like statements and expressions: standard operators, method calls, conditionals, loops, try/catch
class, object, def, val, var, import, package
Infix notation for method calls
Simple closures
Collections with map, filter, etc
for-expressions

[b]Level A2: Intermediate application programmer[/b]

Pattern matching
Trait composition
Recursion, in particular tail recursion
XML literals

[b]Level A3: Expert application programmer[/b]

Folds, i.e. methods such as foldLeft, foldRight
Streams and other lazy data structures
Actors
Combinator parsers

[b]Level L1: Junior library designer[/b]

Type parameters
Traits
Lazy vals
Control abstraction, currying
By-name parameters
[b]
Level L2: Senior library designer
[/b]
Variance annotations
Existential types (e.g., to interface with Java wildcards)
Self type annotations and the cake pattern for dependency injection
Structural types (aka static duck typing)
Defining map/flatmap/withFilter for new kinds of for-expressions
Extractors

[b]Level L3: Expert library designer[/b]

Early initializers
Abstract types
Implicit definitions
Higher-kinded types

As I wrote above, the skill sets required from application programmers and library designers are really quite different. But if I should throw them into the same baskets, I would group like this:

A1, A2/L1, A3/L2, L3

That is, intermediate application programming is about on the same level of difficulty as junior library design, and advanced application programming is on the same level as senior library design.

To clarify: One can program very productively in Scala on level A1, which one should be able to pick up in a day or so, coming from Java. Mastering A2 will doubtlessly increase programmer productivity. A3 is for expert programmers with more specialized tasks, not everyone needs to get to that level. The same holds for library design. There are great libraries designed with the tools on level L1 and L2. Some libraries require L3 elements such as implicits and higher-kinded types, but a library does not automatically get better if it uses these elements -- often the opposite is true.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值