[]1-Introduction to Scala-tour of Scala

Source: Internet
Author: User

Welcome to visit

This journey contains a few streamlined introductions: the most common features of Scala are presented. It is designed to help beginners learn the language.

This is just a brief introduction, not a complete language tutorial. If you can, consider buying a book or reviewing other resources.

What is Scala?

Scala is a modern, multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe manner. It seamlessly integrates the features of object-oriented and functional languages.

Scala is an object-oriented language

Scala is a purely object-oriented language, and in a sense all values are objects. The type and behavior of an object are described by classes and traits. Classes are extended to a complete substitution of multiple inheritance through subclasses and flexible mix-based mechanisms.

Scala is a functional language

Scala is also a functional language, in a sense all functions are values. Scala provides a lightweight syntax for defining anonymous functions, which supports higher-order functions, allows functions to be nested, and supports Curry. Scala's sample class and its built-in support for pattern-matching model algebra types are used in many functional programming languages. Singleton objects provide a convenient way to group functions that are not members of a class.

In addition, Scala's pattern-matching concept extends naturally to XML data processing by ignoring the right sequence pattern, through generic extensions through extractor objects. In this case, the for deduction helps to make the query. These features make Scala an ideal choice for applications such as Web services development.

Scala is a statically typed language

Scala is equipped with an expression system that can statically enforce the use of abstractions in a secure and consistent manner. Specifically, this type of system supports:

    • Generic class

    • Deformation annotations

    • Upper type boundary and bottom type boundary

    • Inner classes and abstract types as Object members

    • Composite type

    • Self-referencing of an explicit type

    • Implicit arguments and implicit conversions

    • Polymorphic method

Type inference means that the user does not need to comment the code with redundant type information. Finally, these features provide a powerful foundation for the safe reuse of programming abstractions and the type-safe expansion of software.

Scala is extensible

In practice, the development of specific domain applications often requires language extensions in specific areas. Scala offers a unique combination of language mechanisms that make it easy to add new language constructs in the form of libraries.

In many cases, this can be done without using a meta-programming tool such as macros. For example:

    • Implicit class: Allows extension methods to be added to existing types.

    • String interpolation: The user can use a custom interpolator for expansion.

Scala is interoperable

Scala is designed to interoperate well with the popular Java Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as smooth as possible. Newer Java features, such as SAM,LAMBDA, annotations, and generics, have direct similar functionality in Scala.

Scala features that do not have Java analogues, such as default parameters and named parameters, are compiled as close to Java as possible. Scala has the same compilation model as Java (individual compilation, dynamic class loading) and allows access to thousands of existing high-quality libraries.

TODO all completed will replace the relevant link in the text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.