This document summarizes key similarities and differences between Scala and Java types, variables, methods, classes, collections, control structures, and other language features. Some of the main points covered include:
- Type definitions, variables, and methods are defined similarly but with different syntax in Scala vs Java
- Classes and traits in Scala are like classes and interfaces in Java
- Scala avoids static methods and instead uses singleton objects
- Control structures like if/else, for loops, and exceptions work similarly
- Scala supports features like tuples, pattern matching, and expression-oriented programming that have no direct equivalent in Java
Scala is a multi-paradigm programming language that runs on the Java Virtual Machine. It is intended to be both object-oriented and functional. Scala is compatible with Java and allows Java code to interoperate with Scala code. Some key features of Scala include type inference, lazy evaluation, treating methods as variables, and support for both object-oriented and functional programming paradigms.
This document provides a summary of key Scala basics and comparisons to Java, including:
1) It describes type definitions, variables, methods and how they are defined in Scala versus Java. It also covers method invocation syntax differences.
2) It explains classes and constructors, traits versus interfaces, and static methods in Scala versus Java.
3) It provides examples of control structures like if/else, for loops, while loops and exceptions in both languages.
Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It has established itself as one of the main alternative languages on the Java Virtual Machine, being used by companies like Twitter and LinkedIn. Scala fuses functional programming (from which it borrows higher-order functions and closures, generic typing and immutable data structures) and object-oriented programming programming (from which it takes inheritance and encapsulation). It interoperates fully with Java, allowing a smooth transition and access to all existing Java libraries.
Scala’s lightweight syntax makes it easy to extend the language through DSLs. In this talk we are going to have a quick overview of Scala’s main features (closures, higher-order functions, implicits), and collection classes in the standard library. We’ll see how a new concurrency model, such as actors, can be added to the language through a library.
Day 1 covered variables, methods, classes, tuples, options, functions, pattern matching, traits and the schedule for the rest of the day which includes higher order functions, implicit conversions, XML support and building a quiz game.
This document provides an overview of the Scala programming language and discusses its usage on Android. Scala is a multi-paradigm language that integrates object-oriented and functional programming. It runs on the Java Virtual Machine and is used by companies like LinkedIn, Twitter, and The Guardian. Scala's features include being object-oriented, functional, statically typed, and expressive while allowing concise code. It supports classes, traits, pattern matching, and lazy evaluation among other things.
Scaladroids: Developing Android Apps with ScalaOstap Andrusiv
Android is a fast-growing mobile operating system with millions of users worldwide.
Scala is a modern programming language designed to express common programming patterns in a concise, elegant, and type-safe way. Why not combine both of them?
Slides from my talk at the Junction (Jan 24, 2013)
Single-core performance has hit a ceiling, and building web-scale multi-core applications using imperative programming models is nightmarishly difficult. Parallel programming creates a new set of challenges, best practices and design patterns. Scala is designed to enable building scalable systems, elegantly blending functional and object oriented paradigms into an expressive and concise language, while retaining interoperability with Java. Scala is the fastest growing JVM programming language, being rapidly adopted by leading companies such as Twitter, LinkedIn and FourSquare.
This presentation provides a comprehensive overview of the language, which managed to increase type safety while feeling more dynamic, being more concise and improving readability at the same time. We will see how Scala simplifies real life problems by empowering the developer with powerful functional programming primitives, without giving up on the object oriented paradigm. The overview includes tools for multi-core programming in Scala, the type system, collection framework and domain-specific languages. We’ll explore the power of compile-time meta-programming, which is made possible by the newly released Scala 2.10, and get a glimpse into what to expect from 2.11 in 2014.
We will also see how Scala helps overcome the inherent limitations of Java, such as type erasure, array covariance and boxing overhead.
Multiple examples emphasize how Scala pushes the JVM harder than any other mainstream language through the infinite number of boilerplate busters, increased type safety and productivity boosters from a Java developer’s perspective.
This document provides an introduction to Scala. It discusses:
- Who the author is and their background with Scala and Spark
- Why Scala is a scalable language that runs on the JVM and supports object oriented and functional programming
- How to install Scala and use the Scala interpreter
- Basic Scala syntax like defining values and variables, type inference, strings, tuples, objects, importing classes
- Common functions and operations like map, reduce, anonymous functions, pattern matching
- Code samples for RDD relations and SparkPi
- Tips for using Scala in practice including SBT and good IDEs like IntelliJ
Watch video (in Hebrew): http://parleys.com/play/53f7a9cce4b06208c7b7ca1e
Type classes are a fundamental feature of Scala, which allows you to layer new functionality on top of existing types externally, i.e. without modifying or recompiling existing code. When combined with implicits, this is a truly remarkable tool that enables many of the advanced features offered by the Scala library ecosystem. In this talk we'll go back to basics: how type classes are defined and encoded, and cover several prominent use cases.
A talk given at the Underscore meetup on 19 August, 2014.
Scala is a powerful language for the JVM that is compatible with JDK 1.5+. It is a functional language maintained by Typesafe along with the community. Scala compiles to JVM bytecode like Java but has features like objects, traits, pattern matching and functional programming. James Gosling, the creator of Java, said that if he were to pick a language other than Java today, it would be Scala.
Выступление в рамках спецкурса "Немейнстримовые технологии разработки", читаемого в НГУ. http://bit.ly/mainstreamless
Аудио дорожка работает, но нужно иметь некоторое терпение, так как грузится она не моментально.
This document provides an introduction to the Scala programming language. It discusses what Scala is, how to get started, basic concepts like mutability and functions, and Scala features like classes, traits, pattern matching, and collections. Scala combines object-oriented and functional programming. It runs on the Java Virtual Machine and is compatible with Java. The document provides code examples to demonstrate Scala concepts and features.
This document provides an introduction to JavaScript web development. It covers key concepts like AJAX architecture, unobtrusive JavaScript, CSS, and how they interact. JavaScript allows dynamic interaction and filtering of HTML content. The document demonstrates JavaScript features like variables, arrays, objects, JSON, loops, functions, and more. It also discusses advantages of CSS for layout and separation of concerns from HTML.
Intro to Functional Programming in ScalaShai Yallin
Scala is a functional and object-oriented programming language that runs on the Java Virtual Machine. It features type inference, immutable collections, pattern matching, and functions as first-class values. The document provides an overview of Scala's features such as its static typing, traits for multiple inheritance, and case classes for value objects. It also demonstrates Scala's collections API and use of functions and pattern matching.
"The joy of Scala" - Maxim Novak / Wix
Around eight years ago I started my journey as a developer. Since then, I've played around with many languages and thought that C# offers the best developer productivity. After joining Wix two years ago, I was exposed to the amazing world of Scala and Functional Programming and never looked back.
In Scala the code is much more concise, less ceremonious, immutable by default, combines functional with object oriented, seamlessly interoperates with Java, and many software engineering patterns are already baked into the language. Most importantly - Scala is FUN! By the end of the session you too will, hopefully, convert to Scala and never look back.
Recording of the lecture (Hebrew) - https://youtu.be/TcnYTwff2xU
This document discusses Scala features for parallelism, concurrency, and reactive programming. Some key points include:
- Scala supports parallel collections that can perform operations like map, reduce, and filter in parallel.
- Futures represent asynchronous computations whose results are not yet known. They allow non-blocking operations.
- Actors are units of concurrency that communicate asynchronously by message passing. They encapsulate state and behavior.
- Akka is a toolkit for building highly concurrent, distributed, and fault-tolerant event-driven applications using actors. It implements the actor model in Scala.
The document summarizes Scala as a replacement for Java, highlighting its capabilities as both an object-oriented and functional language that compiles to Java bytecode. It provides code examples demonstrating Scala's concise syntax for common tasks like defining classes, filtering collections, string reversal, and exception handling. The document also outlines an agenda for a Scala workshop covering its basic syntax, REPL/IDE setup, functions, pattern matching, OO features, and functional programming concepts.
The Compost Tea Brewer system was designed for the farmers or growers. It was developed to provide an organic solution for caring for our plants and soil to reduce the need for harmful pesticides and fertilizers. It works by inoculating the plants and soil with the necessary microbes and nutrients, often lacking in an urban setting. It provides a safe, natural, and totally organic environment for our plants and soil! For details and inquiry please contact me thru 0919-4619525 or 0916-4148816
This document discusses security issues with Software as a Service (SaaS) and potential solutions. It outlines key security concerns like data integrity, authentication, authorization and security of data transmission. The document also mentions common vulnerabilities like injection attacks, cross-site scripting, broken authentication. Researchers are pointed out to test SaaS applications for security loopholes and help vendors strengthen mechanisms to address vulnerabilities before exploitation. Overall, while SaaS provides benefits, security must be embedded throughout architecture, applications, networks and user access to fully protect from threats.
Delgro beneficial microorganisms are those that can fix atmospheric nitrogen, decompose organic wastes and residues, detoxify pesticides, suppress plant diseases and soil-borne pathogens, enhance nutrient cycling, and produce bioactive compounds such as vitamins, hormones and enzymes that stimulate plant growth.
For further details about Vermiculture and Vermicomposting email me thru emixfactory@yahoo.com or contact me thru 0919-4619525. We conduct trainings and sell ANC worms.
http://inarocket.com
Learn BEM fundamentals as fast as possible. What is BEM (Block, element, modifier), BEM syntax, how it works with a real example, etc.
This document provides a recap of concepts covered on day 1 of a Scala training, including:
- How variables, methods, classes, tuples, and the Option type work differently in Scala compared to Java.
- Key Scala features like first class functions, closures, pattern matching, and traits.
- An overview of the schedule for day 1 which includes higher order functions, implicit conversions, XML support, and building a quiz game task.
Scala is a multi-paradigm programming language that runs on the JVM. It combines object-oriented and functional programming concepts. SBT is the build tool used for Scala projects and allows for incremental compilation. Scala has a uniform approach to collections that emphasizes immutability and uses higher-order
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Java som sprog har ikke bevæget sig meget de seneste år. Vi har stadig ikke closures eller funktionelle aspekter som f.eks. C# har haft siden version 3. Er Scala svaret på enhver Javaudviklers bønner eller er sproget kun interessant for tågehoveder som mig, som begynder at synes bedre og bedre om funktionsorientering? Er den store portion syntaktisk sukker, Scala bringer på bordet, bare tomme kalorier?
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Scala is a programming language that runs on the Java Virtual Machine (JVM) and is designed to express common programming patterns in a concise, elegant, and type-safe way. Some key points about Scala include that it is functional and object-oriented, statically typed, and allows seamless integration with Java. Scala code is often more concise than equivalent Java code through features like pattern matching and immutable data structures. Functional programming principles like pure functions, recursion, and avoiding side effects are emphasized in Scala.
This presentation was presented at OSS camp in New Delhi. It deals with the basics of Scala language and how we can use it to build scalable Applications
Scala for Java Developers provides an overview of Scala for Java developers. It discusses:
- The goals of understanding what Scala is, learning more about it, and installing Scala.
- An introduction to Scala including what it is, its history from 1995 to 2013, and whether it is a good fit for certain uses based on its strengths like functional programming and weaknesses like syntax.
- How to get started with Scala including required and optional software and plugins.
- Key Scala features like objects, classes, traits, pattern matching, and collections.
(How) can we benefit from adopting scala?Tomasz Wrobel
Scala offers benefits from adopting it such as increased productivity through concise and expressive code, static typing with type inference, support for both object-oriented and functional programming paradigms, and interoperability with Java. Switching from Java to Scala involves some changes like using val for immutable variables and var for mutable, but overall the syntax is quite similar which eases the transition.
Softshake 2013: 10 reasons why java developers are jealous of Scala developersMatthew Farwell
Scala provides many features that simplify programming tasks compared to Java such as type inference, less verbose syntax, simpler definition of classes and collections, closures, pattern matching, implicit conversions, and concise concurrency constructs. However, Scala also has disadvantages like less mature tools compared to Java and lack of binary compatibility between major versions.
The document discusses Scala programming concepts including object-oriented programming, functional programming, collections, pattern matching, and more. It provides code examples of defining objects and classes, functions, for expressions, match expressions, case classes, traits, generics, and collections like List and Map.
Martin Odersky received his PhD in 1989 and began designing Scala in 2001 at EPFL. Scala is a functional and object-oriented programming language that runs on the Java Virtual Machine. It is concise, high-level, statically typed, and supports both immutable and mutable data structures. Many large companies use Scala including LinkedIn, Twitter, and Ebay. Scala supports both object-oriented programming with classes, traits, and objects as well as functional programming with immutable data, higher-order functions, and algebraic data types.
The document provides an overview of the Scala programming language. It begins with an agenda that outlines topics like differences between Java and Scala, Scala data types, variables, classes, functions, closures, exception handling and collections. It then discusses specific aspects of Scala like verbosity reduction compared to Java, functional programming influences, object-oriented features, interoperability with Java and compilation to Java bytecode. Examples are provided to illustrate Scala concepts like functions, classes, recursion, higher-order functions and exception handling. The document aims to explain Scala and reasons for differences from Java.
This document summarizes a talk given about Nokia's migration to Scala for its Places API. The key points are:
1) Nokia migrated its Places API codebase to Scala to take advantage of Scala's features like its powerful type system, immutable data structures, and functional programming capabilities.
2) The migration was done gradually over time while continuing to develop new features. They discovered many benefits of Scala along the way like improved test readability and JSON parsing capabilities.
3) Nokia uses Scala features like case classes, options, and functions to model data and add type safety to its codebase. This uncovered bugs that would have been hard to find in Java.
Scala is a multi-paradigm programming language that runs on the Java Virtual Machine. It integrates features of functional programming and object-oriented programming, allowing both procedural and functional styles. Some key benefits of Scala include its ability to handle concurrency and parallelism through actors, support for both static and dynamic typing, and interoperability with Java.
This document provides an introduction to the Scala programming language. It discusses that Scala is a hybrid language that is both object-oriented and functional, runs on the JVM, and provides seamless interoperability with Java. It highlights features of Scala such as pattern matching, traits, case classes, immutable data structures, lazy evaluation, and actors for concurrency.
This document summarizes key features of the Scala programming language. Some key points include:
- Scala runs on the Java Virtual Machine (JVM) and allows for type inference, immutable values, functional programming patterns like pattern matching, and object-oriented features like traits for inheritance.
- Scala favors immutable values over mutable variables for scalability. Features like actors allow for concurrency without shared mutable state.
- Scala code can be compiled to JavaScript using Scala.js, allowing full-stack development in a single language.
- Traits provide a powerful way to do multiple inheritance by combining traits and classes at runtime.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was created in 2001 by Martin Odersky and aims to integrate features of object-oriented and functional languages. Scala code is compiled to JVM bytecode and supports interoperability with Java libraries and frameworks. Some key features of Scala include support for immutable data structures, pattern matching, traits for mixing composition, and functional programming constructs like functions as first-class values. Scala has gained popularity in industry at companies like LinkedIn, Twitter, and The Guardian.
Java Cheat Sheet includes the following contents:
- Data Types
- Statements
- String, ArrayList and HashMap Methods
- Conversion
- Operators
- Exception Handling
4. Variables
Scala: Java:
val s = “Hello World” public final String s = “Hello World”;
var i = 1 public int i = 1;
private var j = 3 private int j = 3;
5. Methods
Scala: Java:
def add(x: Int, y: Int): Int = { public int add(int x, int y) {
x+y return x + y;
} }
def add(x: Int, y: Int) = x + y
def doSomething(text: String) { public void doSometing(String text) {
} }
8. Classes and constructors
Scala: Java:
class Person(val name: String) public class Person {
private final String name;
public Person(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
9. Traits (= Interface + Mixin)
Scala: Java:
trait Shape { interface Shape {
def area: Double public double area();
} }
class Circle extends Object with public class Circle extends Object
Shape implements Shape
10. No “static” in Scala
Scala: Java:
object PersonUtil { public class PersonUtil {
val AgeLimit = 18 public static final int
AGE_LIMIT = 18;
def countPersons(persons:
List[Person]) = ... public static int
countPersons(List<Person>
}
persons) {
...
}
}
11. if-then-else
Scala: Java:
if (foo) { if (foo) {
... ...
} else if (bar) { } else if (bar) {
... ...
} else { } else {
... ...
} }
12. For-loops
Scala: Java:
for (i <- 0 to 3) { for (int i = 0; i < 4; i++) {
... ...
} }
for (s <- args) println(s) for (String s : args) {
System.out.println(s);
}
15. Varargs
def foo(values: String*){ } public void foo(String... values){ }
foo("bar", "baz") foo("bar", "baz");
val arr = Array("bar", "baz") String[] arr = new String[]{"bar", "baz"}
foo(arr: _*) foo(arr);
16. (Almost) everything is an expression
val res = if (foo) x else y
val res = for (i <- 1 to 10) yield i // List(1, ..., 10)
val res = try { x } catch { ...; y } finally { } // x or y
17. Collections – List
Scala: Java:
val numbers = List(1, 2, 3) List<Integer> numbers =
new ArrayList<Integer>();
val numbers = 1 :: 2 :: 3 :: Nil numbers.add(1);
numbers.add(2);
numbers.add(3);
numbers(0) numbers.get(0);
=> 1 => 1
18. Collections – Map
Scala: Java:
var m = Map(1 -> “apple”) Map<Int, String> m =
m += 2 -> “orange” new HashMap<Int, String>();
m.put(1, “apple”);
m.put(2, “orange”);
m(1) m.get(1);
=> “apple” => apple
23. Nice to know
Scala: Java:
Console.println(“Hello”) System.out.println(“Hello”);
println(“Hello”)
val line = Console.readLine() BufferedReader r = new BufferedReader(new
val line = readLine() InputStreamRead(System.in)
String line = r.readLine();
error(“Bad”) throw new RuntimeException(“Bad”)
1+1 new Integer(1).toInt() + new Integer(1).toInt();
1 .+(1)
1 == new Object new Integer(1).equals(new Object());
1 eq new Object new Integer(1) == new Object();
"""Asregex""".r java.util.regex.Pattern.compile(“Asregex”);