Here's a brief list of some things you can do.
- immutable values: use "final" more.
- no side effects: write more pure functions (no mutable variables) write methods not to use global or instance state, use more recursion.
- Actor model: check out Kilim .
- higher order functions: you can use interfaces, although it is not nearly as convenient. Maybe you will be able to adopt a more functional style in Java if one of the closure proposals gets implemented. In which case after learning Scala you'll be ahead of the game in Java because you will already know how to use higher order functions effectively.
If you learn Scala and use it for a while, you will probably become more comfortable with these approaches.
Perhaps, after reading all of the above, you have decided that you should learn Scala. Great! How can you go about that? My basic advice:
- Read about Scala: articles, blogs, books, newsgroups.
- Write some code. As soon as you can, and as much as you can. Applets, programs, libraries, anything. There is no substitute for writing code.
- Run the Scala interpreter and type things in.
You can download the Scala compiler and other stuff from the official Scala web site .
Here are some pointers to some things you can read to get you started:
- For an overview of Scala's main characteristics: A Tour of Scala .
- For a quick-start guide: First Steps to Scala by Bill Venners, Martin Odersky and Lex Spoon.
- For continued reading: the Scala Reference Manuals on the official Scala web site , including A Brief Scala Tutorial and Scala By Example .
- For a series of articles aimed at Java developers: Ted Neward's Busy Java Developer's Guide To Scala , with 11 articles in the series . Or you can try Daniel Spiewak's Scala for Java Refugees blog entries.
- For in-depth technical details: The Scala Language Specification .
- For a condensed summary of Scala's syntax: my Scala Syntax Primer .
- For the authoritative tutorial: buy the 750 page book Programming in Scala by Martin Odersky, Lex Spoon and Bill Venners, available in both paper and as an eBook.
- For some general programming exercises that you can use when looking for something to code in Scala: Project Euler .
本文提供了一套全面的学习Scala的方法,包括阅读资源推荐、实践建议及如何利用Scala提高编程技能。介绍了Scala的主要特性,并针对Java开发者提供了特定的学习路径。
280

被折叠的 条评论
为什么被折叠?



