==>Introduction to the
Scala language
--The Scala programming language captures many developers ' eyeballs. If you skim through Scala's website, you'll think Scala is a purely object-oriented programming language that seamlessly combines imperative programming with functional programming styles
and not too long ago, programming languages could be categorized as "imperative" or "functional" or "object-oriented" without any doubt. Scala represents a new language variety, which erases the boundaries of these human divisions.
==> Scala has several key features that demonstrate its object-oriented nature .
each value in Scala is an object, including the base data type (Boolean, number, and so on), and the hyphen is also the object.
- class can be quilt-like, and Scala also offers a mixin-based combination (mixin-based composition)
Scala has a more extensive class reuse than only support for single-inheritance languages. Scala allows you to define new classes by reusing "new member definitions in a class (that is, compared to the differences in their parent class)". Scala calls the Mixin class combination.
Scala also contains key concepts for several functional languages, including higher order functions (Higher-order function), local apply (currying), nested functions (Nested function), and sequence interpretation (Sequence comprehensions) and so on.
- Scala is statically typed, which allows it to provide generic classes, inner classes, and even polymorphic methods (Polymorphic method). It is also worth mentioning that Scala was deliberately designed to interoperate with Java and. Net. The current version of Scala is not yet running on. NET (although the previous version can be-_-b), but it will be available in the future as planned. NET runs on.
-Scala can interoperate with Java. It uses the Scalac compiler to compile the source file into a Java class file (the bytecode that runs on the JVM). You can call all Java class libraries from Scala, and you can call Scala's code from a Java application as well.
==> Why do I need to use Scala?
- Scala's design always runs through the idea of creating a language that better supports components. ("The Scala programming Language", Donna malayeri) means that the software should be constructed from reusable parts. Scala is designed to provide a programming language that unifies and generalizes key concepts from two different styles, object-oriented and functional, respectively.
==> Scala offers some outstanding features.
-Object oriented style
--Functional style
-More high-level concurrency models
-Scala brings the Erlang-style actor-based concurrency into the JVM. Developers can leverage Scala's actor model to design scalable concurrent applications on the JVM that automatically gain the benefits of a multi-core processor without having to write programs according to a complex Java threading model.
--Lightweight function syntax
-High order
--nesting
--local apply (currying)
--Anonymous
--Integration with XML
-You can write XML directly in a Scala program
--Convert XML to Scala class
--seamlessly interoperate with Java
==> Scala is a multi-paradigm programming language designed to integrate the various features of object-oriented programming and functional programming
==> Tips
-
--don't fall into the same, growing problem of C + +, leaving too many choices and no clear best practices. This causes everyone to choose a different subset. To provide guidance for adaptation.
and remember, the anti-bad design features are just as important as adding new features-it's brutal.
--Consider splitting the language to create a workable standard for the resulting environment. Saving money for the academic world is a wise choice. To meet the needs of enterprises, to achieve greater adoption.
--Library writers should look at the Java API to see if there should be functional calls or structured functions for better reading. Don't compete with Ruby for liquidity to jump too big.
-Finally, don't be disappointed when people make constructive criticisms. If the same complaint keeps appearing, it should be taken seriously.
==> Environment Deployment
- because Scala is run on the JVM, you need to configure the Java environment, which is not repeated here
--Install Scala: Download http://www.scala-lang.org/download/
Note: Versions are consistent with the Scala version of Spark
Scala-2.11.8.zip
-Scala's running environment (development tools)
--command line: REPL
--- entry: Scala
--- exit:: Quit
--- (*) Paste mode: equivalent to VI editor
--- entry::p aste
--- exit: ctrl+d
--Idea
--- default: No Scala environment
--- need to install plug-ins: SBT (requires networking, a bit slow)
(3) Scala IDE: Eclipse-based
- refer to this link: http://blog.csdn.net/yuanguangyu1221/article/details/50889522
Scala Language Learning Environment installation (1)