scala-lang-features
Scala Language Features |
|---|
|
Scala - SCAlable LAnguage built on java provides both Functional programming and Strong static type system |
1. Type Inference - Scala automatically detects data type for an variable from its assigned value or expression
|
| 2. Singleton Object By default every object created is singleton. |
3. Immutability - Every variable(val) in scala is immutable by default.
|
|
4. Lazy Evaluation Scala delays the computing of expressions until it's actually used some where in the code Also called as Call-By-Need. Increases the performance by avoiding repetitive computations
|
|
5. Case class & Pattern matching Case classes are Immutable by default, but parameterized constructors are public. They are extensively used in pattern matching
|
|
6. Higher Order Functions Functions take other functions as parameter or can return some function as ouput.
|
|
7. Traits Similar to Java Interfaces, these Traits contains fields and declarations.
|
|
8. String Interpolation s, f and raw are Interpoletars used to evaluate and replace Place holders in the given strings.
|
|
9. Collections Scala provides variety of Data structures to represent your data. They can be mutable or immutable Array, List, Tuple, Set, Map etc.. |
|
10. Functional Programming Scala supports in many ways to support Functional Programming 1. Provides light weight syntax for anonymous/name less functions, also called as Lambda expressions or Lambda functions. 2. Supports Higher order functions - Treats functions as both parameter and return types. 3. Functions can be nested and currying. 4. Case classes are instantiable classes with auto generated methods, can be used for Pattern matching. |
|
11. Statically Typed Scala has built in support for Parameterized classes with types and Polymorphic methods.
|
Comments
Post a Comment