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 the Scala programming language for Java programmers. It discusses Scala's motivation as a scalable and more productive alternative to Java. Key features covered include static typing, object-oriented and functional programming, traits, pattern matching, and actors. Examples are provided to illustrate concepts like functions as first-class values, partially applied functions, and collection operations. The document concludes by mentioning additional Scala concepts and providing references for further reading.
Scala is a multi-paradigm language that runs on the JVM and interoperates with Java code and libraries. It combines object-oriented and functional programming by allowing functions to be treated as objects and supports features like traits, pattern matching, and immutable data structures. The Scala compiler infers types and generates boilerplate code like getters/setters, making development more productive compared to Java. While Scala has a learning curve, it allows a more concise and scalable language for building applications.
"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
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Starting with Scala : Frontier Developer's Meetup December 2010Derek Chen-Becker
This document provides an overview of the Scala programming language presented at a meetup event. It discusses Scala's history and pedigree, being created by Martin Odersky. It outlines some key aspects of Scala like being object-oriented, functional, and working on the JVM. The talk covers Scala fundamentals like immutable values, mutable variables, functions, and objects. It also discusses traits, classes, case classes and more Scala concepts.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document provides an introduction to the Scala programming language for Java programmers. It discusses Scala's motivation as a scalable and more productive alternative to Java. Key features covered include static typing, object-oriented and functional programming, traits, pattern matching, and actors. Examples are provided to illustrate concepts like functions as first-class values, partially applied functions, and collection operations. The document concludes by mentioning additional Scala concepts and providing references for further reading.
Scala is a multi-paradigm language that runs on the JVM and interoperates with Java code and libraries. It combines object-oriented and functional programming by allowing functions to be treated as objects and supports features like traits, pattern matching, and immutable data structures. The Scala compiler infers types and generates boilerplate code like getters/setters, making development more productive compared to Java. While Scala has a learning curve, it allows a more concise and scalable language for building applications.
"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
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Starting with Scala : Frontier Developer's Meetup December 2010Derek Chen-Becker
This document provides an overview of the Scala programming language presented at a meetup event. It discusses Scala's history and pedigree, being created by Martin Odersky. It outlines some key aspects of Scala like being object-oriented, functional, and working on the JVM. The talk covers Scala fundamentals like immutable values, mutable variables, functions, and objects. It also discusses traits, classes, case classes and more Scala concepts.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document provides an overview and comparison of new features in Java 8 and Scala, with a focus on lambda expressions. It notes that Java 8 adds lambda expressions and default interface methods to provide more expressiveness and concurrency capabilities similar to functional programming languages like Scala. The document discusses how lambda expressions improve on anonymous inner classes in Java and demonstrates various lambda expression forms in both Java 8 and Scala. It also highlights new Java 8 features like method references and parallel streams for easier parallel programming.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was designed by Martin Odersky and developed at EPFL in Switzerland. Scala combines object-oriented and functional programming principles, including support for immutable data structures, pattern matching, and closures. It interoperates seamlessly with existing Java code and libraries.
Functional Objects & Function and ClosuresSandip Kumar
Scala functions are objects that implement traits like Function1. Functions are treated as objects with an apply method. When a function is defined as a method in a class, it is treated differently than a standalone function. Functions can take variable arguments using a * notation and have default parameter values specified.
The Scala programming language has been gaining momentum recently as an alternative (and some might say successor) to Java on the JVM. This talk will start with an introduction to basic Scala syntax and concepts, then delve into some of Scala's more interesting and unique features. At the end we'll show a brief example of how Scala is used by the Lift web framework to simplify dynamic web apps.
Guava is Java libraries by Google.
This is Introduction of Guava with some API and sample codes.
Its samples are here.
http://www.slideshare.net/akirakoyasu/hello-guava-samples
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.
This document provides a dictionary of scala programming concepts including definitions of common jargon like ADT, typeclasses, extension methods, and call-by semantics. It defines ADT as algebraic data types, which were introduced in languages like Algol 60 and ML, and pattern matching which allows decomposing ADT values. Typeclasses are defined as rules for types like equality, with instances providing implementations. Extension methods and implicit conversions add methods to types via implicit parameters. Call-by-name and call-by-need semantics are discussed in relation to lazy evaluation.
Some notes about programming in Scala: it covers Scala syntax and semantics, programming techniques, idioms, patterns. Many Scala features are introduced, from basic to intermediate and advanced. These are not introductory notes, but they assume a working knowledge with some other programming language (Java, C#, C++), object-oriented programming (OOP) concepts, and functional programming (FP) concepts.
The document is a slide presentation on Scala that provides an introduction to the language in 90 minutes or less. It covers Scala basics like being object oriented and functional, static typing, compilation to JVM bytecode, and interoperability with Java. It also discusses Scala tools, its use in open source projects and industry, recommended books, and jobs involving Scala. Code examples are provided to demonstrate Hello World programs, variables, methods, conditionals, sequences, and closures in Scala.
This document provides an introduction to the Scala programming language. It begins with an overview of Scala's motivation and history. It then covers the basics of Scala including simple data structures, loops, objects, types and generics. More advanced topics such as traits, mixins, implicit conversions and sealed classes are also discussed. The document concludes with references for further reading.
Scala Intro training @ Lohika, Odessa, UA.
This is a basic Scala Programming Language overview intended to evangelize the language among any-language programmers.
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.
This document provides a cheat sheet overview of Scala concepts including packages, imports, variables, constants, classes, traits, generics, methods, functions, operators, arrays, main methods, annotations, assignments, selection, iteration and references. Key points are that Scala uses packages similarly to Java but with curly brace delimiters, imports can be used anywhere in a file, variables use 'var', constants use 'val', classes inherit from Any and can use traits for mixins, generics are defined with type parameters, functions are objects, operators are methods, arrays are classes, main returns Unit, and assignments use = while iteration prefers recursion over loops.
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.
A Sceptical Guide to Functional ProgrammingGarth Gilmour
This document provides a skeptical guide to functional programming through a series of slides presented at a BASH event. It begins by acknowledging that the presenter likes FP but is skeptical of FP programmers. It then discusses some functional programming languages like Lisp, Haskell, and Scala. It explores the differences between pure and hybrid languages. Several slides provide examples of code in languages like Clojure and Scala to demonstrate functional concepts. The presentation questions whether the language itself matters and argues the audience may already be using FP techniques without realizing it.
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.
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.
This document summarizes some of the key differences between Scala and Java syntax. It covers topics like type definitions, variables, methods, classes, traits, collections, exceptions, control flow, and packages. Overall, the document shows that Scala code is more concise and expressive than equivalent Java code for many common programming constructs.
Akka, an actor framework written in Scala (that also supports Java) provides you with all the benefits commonly found in actor frameworks, but without the kinks. This presentation will explore actor based concurrency using Akka, and dwell on some of Akka's stregths, culminating in the equation "Transactional Memory + Actors = Transactors".
This document discusses using Akka and actors for building scalable and concurrent applications in Scala. It introduces actors as fundamental units of computation that communicate asynchronously via message passing. Akka provides tools for creating actor systems and hierarchies. The document uses a monitoring application called Scotchdog as an example, with actors to represent services that are monitored by a watchdog actor. It describes how messages are used to start, stop and check services, and how the watchdog can aggregate status from child actors. The document also briefly mentions using Akka's scheduler and finite state machines to implement more complex actor behaviors.
This document provides an overview and comparison of new features in Java 8 and Scala, with a focus on lambda expressions. It notes that Java 8 adds lambda expressions and default interface methods to provide more expressiveness and concurrency capabilities similar to functional programming languages like Scala. The document discusses how lambda expressions improve on anonymous inner classes in Java and demonstrates various lambda expression forms in both Java 8 and Scala. It also highlights new Java 8 features like method references and parallel streams for easier parallel programming.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was designed by Martin Odersky and developed at EPFL in Switzerland. Scala combines object-oriented and functional programming principles, including support for immutable data structures, pattern matching, and closures. It interoperates seamlessly with existing Java code and libraries.
Functional Objects & Function and ClosuresSandip Kumar
Scala functions are objects that implement traits like Function1. Functions are treated as objects with an apply method. When a function is defined as a method in a class, it is treated differently than a standalone function. Functions can take variable arguments using a * notation and have default parameter values specified.
The Scala programming language has been gaining momentum recently as an alternative (and some might say successor) to Java on the JVM. This talk will start with an introduction to basic Scala syntax and concepts, then delve into some of Scala's more interesting and unique features. At the end we'll show a brief example of how Scala is used by the Lift web framework to simplify dynamic web apps.
Guava is Java libraries by Google.
This is Introduction of Guava with some API and sample codes.
Its samples are here.
http://www.slideshare.net/akirakoyasu/hello-guava-samples
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.
This document provides a dictionary of scala programming concepts including definitions of common jargon like ADT, typeclasses, extension methods, and call-by semantics. It defines ADT as algebraic data types, which were introduced in languages like Algol 60 and ML, and pattern matching which allows decomposing ADT values. Typeclasses are defined as rules for types like equality, with instances providing implementations. Extension methods and implicit conversions add methods to types via implicit parameters. Call-by-name and call-by-need semantics are discussed in relation to lazy evaluation.
Some notes about programming in Scala: it covers Scala syntax and semantics, programming techniques, idioms, patterns. Many Scala features are introduced, from basic to intermediate and advanced. These are not introductory notes, but they assume a working knowledge with some other programming language (Java, C#, C++), object-oriented programming (OOP) concepts, and functional programming (FP) concepts.
The document is a slide presentation on Scala that provides an introduction to the language in 90 minutes or less. It covers Scala basics like being object oriented and functional, static typing, compilation to JVM bytecode, and interoperability with Java. It also discusses Scala tools, its use in open source projects and industry, recommended books, and jobs involving Scala. Code examples are provided to demonstrate Hello World programs, variables, methods, conditionals, sequences, and closures in Scala.
This document provides an introduction to the Scala programming language. It begins with an overview of Scala's motivation and history. It then covers the basics of Scala including simple data structures, loops, objects, types and generics. More advanced topics such as traits, mixins, implicit conversions and sealed classes are also discussed. The document concludes with references for further reading.
Scala Intro training @ Lohika, Odessa, UA.
This is a basic Scala Programming Language overview intended to evangelize the language among any-language programmers.
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.
This document provides a cheat sheet overview of Scala concepts including packages, imports, variables, constants, classes, traits, generics, methods, functions, operators, arrays, main methods, annotations, assignments, selection, iteration and references. Key points are that Scala uses packages similarly to Java but with curly brace delimiters, imports can be used anywhere in a file, variables use 'var', constants use 'val', classes inherit from Any and can use traits for mixins, generics are defined with type parameters, functions are objects, operators are methods, arrays are classes, main returns Unit, and assignments use = while iteration prefers recursion over loops.
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.
A Sceptical Guide to Functional ProgrammingGarth Gilmour
This document provides a skeptical guide to functional programming through a series of slides presented at a BASH event. It begins by acknowledging that the presenter likes FP but is skeptical of FP programmers. It then discusses some functional programming languages like Lisp, Haskell, and Scala. It explores the differences between pure and hybrid languages. Several slides provide examples of code in languages like Clojure and Scala to demonstrate functional concepts. The presentation questions whether the language itself matters and argues the audience may already be using FP techniques without realizing it.
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.
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.
This document summarizes some of the key differences between Scala and Java syntax. It covers topics like type definitions, variables, methods, classes, traits, collections, exceptions, control flow, and packages. Overall, the document shows that Scala code is more concise and expressive than equivalent Java code for many common programming constructs.
Akka, an actor framework written in Scala (that also supports Java) provides you with all the benefits commonly found in actor frameworks, but without the kinks. This presentation will explore actor based concurrency using Akka, and dwell on some of Akka's stregths, culminating in the equation "Transactional Memory + Actors = Transactors".
This document discusses using Akka and actors for building scalable and concurrent applications in Scala. It introduces actors as fundamental units of computation that communicate asynchronously via message passing. Akka provides tools for creating actor systems and hierarchies. The document uses a monitoring application called Scotchdog as an example, with actors to represent services that are monitored by a watchdog actor. It describes how messages are used to start, stop and check services, and how the watchdog can aggregate status from child actors. The document also briefly mentions using Akka's scheduler and finite state machines to implement more complex actor behaviors.
A presentation at Twitter's official developer conference, Chirp, about why we use the Scala programming language and how we build services in it. Provides a tour of a number of libraries and tools, both developed at Twitter and otherwise.
Comparing JVM Web Frameworks - Devoxx France 2013Matt Raible
A comparison on JVM Web Frameworks. Includes strategies for choosing and results from research by InfoQ and devrates.com. Also, lots of pretty graphs.
See blog post about this presentation at http://raibledesigns.com/rd/entry/devoxx_france_a_great_conference and video recording at http://raibledesigns.com/rd/entry/video_of_comparing_jvm_web
This document discusses the Emotiv EPOC neuroheadset. It is a 14 sensor wireless headset that detects thoughts, feelings, and expressions. It can detect mental commands like object manipulation and emotional states. The headset comes with demo games and software to control devices. While it has advantages for research and assisting handicaps, the technology is still in early stages with many beta applications and limitations to overcome. Further development could vastly improve detection and expand its uses.
This document discusses asynchronous I/O in Java and Scala using the Play Framework. It describes how LinkedIn uses a service-oriented architecture with hundreds of services making requests to each other. It then covers how Play supports non-blocking I/O using asynchronous code, promises, and futures to allow parallel requests without blocking threads. Key points covered include using map and flatMap to transform promises and futures, handling errors and timeouts, and the benefits of non-blocking I/O for scalability.
Slides for my talk event-sourced architectures with Akka. Discusses Akka Persistence as mechanism to do event-sourcing. Presented at Javaone 2014 and Jfokus 2015.
Akka is using the Actors together with STM to create a unified runtime and programming model for scaling both UP (multi-core) and OUT (grid/cloud). Akka provides location transparency by abstracting away both these tangents of scalability by turning them into an ops task. This gives the Akka runtime freedom to do adaptive automatic load-balancing, cluster rebalancing, replication & partitioning
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.
The document provides an overview of Scala concepts for Java programmers, including object-oriented features, pattern matching, functional programming constructs like immutability and higher-order functions, actors and futures for concurrency, and implicits. Key concepts covered include case classes, lazy evaluation, parallel collections, currying, partial functions, and implicit parameters.
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
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 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 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 document provides an introduction to Groovy for Java developers. It discusses Groovy's features such as closures, optional typing and syntax, and how it compiles to Java bytecode. It then provides examples of writing a simple Groovy script to generate XML, using closures, mocking objects in tests, and building projects with Ant.
The document introduces Scala and provides an overview of Scala basics including variables, functions, objects, classes, traits, pattern matching, for-comprehensions and more. It also discusses Scala's capabilities for generic programming, lazy evaluation, and integration with Java. Examples are provided throughout to demonstrate Scala concepts.
The document discusses code generation and abstract syntax tree (AST) transformations. It provides an overview of Project Lombok, a Java library that generates boilerplate code through annotation processing and AST transformations. It also discusses how to analyze and transform code by visiting and rewriting AST nodes, giving examples of checking for null checks and instanceof expressions.
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.
The document provides an introduction to Groovy, including:
- The presenter's background in programming languages including Java since 1996 and using Groovy since 2009.
- The presentation objectives are to recognize Groovy code, get interested in Groovy coding, and introduce some key Groovy concepts without focusing on Grails, Geb, or Spock yet.
- Groovy is a dynamic language that extends Java with features like closures, GStrings, and optional semicolons to enable less code and more clarity while compiling to Java classes for seamless integration.
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.
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
Kotlin Advanced - Apalon Kotlin Sprint Part 3Kirill Rozov
The document discusses several Kotlin advanced topics including delegated properties, lazy properties, objects, higher-order functions, lambdas, inline functions, and standard library functions like apply, also, let. It explains concepts like lazy initialization with lazy properties, property delegation, object expressions and declarations, functional programming with higher-order functions and lambdas, and inline functions for performance. It also covers utility functions in the standard library for working with objects and collections.
The document discusses abstract syntax tree (AST) transformations in Groovy and Java. It covers several tools and techniques for AST transformations including Lombok, Groovy, CodeNarc, IntelliJ IDEA, Mirah macros, and how they allow generating code, performing static analysis, and rewriting code at compile time through analyzing and modifying the AST. The key topics are how these tools work by compiling code to an AST, analyzing and modifying the AST nodes, and sometimes generating source code from the transformed AST.
The document contains code examples of using the Spring framework for Java applications. It includes code for a basic "Hello World" example using Spring and EJB. It also includes code examples of implementing data access using JDBC templates in Spring to avoid boilerplate JDBC code. The document lists some key features of Spring like its AOP framework, boilerplate reduction through templates, and IOC container. It also includes a YouTube link about Spring AOP.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
Monitoring and Managing Anomaly Detection on OpenShift.pdfTosin Akinosho
Monitoring and Managing Anomaly Detection on OpenShift
Overview
Dive into the world of anomaly detection on edge devices with our comprehensive hands-on tutorial. This SlideShare presentation will guide you through the entire process, from data collection and model training to edge deployment and real-time monitoring. Perfect for those looking to implement robust anomaly detection systems on resource-constrained IoT/edge devices.
Key Topics Covered
1. Introduction to Anomaly Detection
- Understand the fundamentals of anomaly detection and its importance in identifying unusual behavior or failures in systems.
2. Understanding Edge (IoT)
- Learn about edge computing and IoT, and how they enable real-time data processing and decision-making at the source.
3. What is ArgoCD?
- Discover ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes, and its role in deploying applications on edge devices.
4. Deployment Using ArgoCD for Edge Devices
- Step-by-step guide on deploying anomaly detection models on edge devices using ArgoCD.
5. Introduction to Apache Kafka and S3
- Explore Apache Kafka for real-time data streaming and Amazon S3 for scalable storage solutions.
6. Viewing Kafka Messages in the Data Lake
- Learn how to view and analyze Kafka messages stored in a data lake for better insights.
7. What is Prometheus?
- Get to know Prometheus, an open-source monitoring and alerting toolkit, and its application in monitoring edge devices.
8. Monitoring Application Metrics with Prometheus
- Detailed instructions on setting up Prometheus to monitor the performance and health of your anomaly detection system.
9. What is Camel K?
- Introduction to Camel K, a lightweight integration framework built on Apache Camel, designed for Kubernetes.
10. Configuring Camel K Integrations for Data Pipelines
- Learn how to configure Camel K for seamless data pipeline integrations in your anomaly detection workflow.
11. What is a Jupyter Notebook?
- Overview of Jupyter Notebooks, an open-source web application for creating and sharing documents with live code, equations, visualizations, and narrative text.
12. Jupyter Notebooks with Code Examples
- Hands-on examples and code snippets in Jupyter Notebooks to help you implement and test anomaly detection models.
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Tatiana Kojar
Skybuffer AI, built on the robust SAP Business Technology Platform (SAP BTP), is the latest and most advanced version of our AI development, reaffirming our commitment to delivering top-tier AI solutions. Skybuffer AI harnesses all the innovative capabilities of the SAP BTP in the AI domain, from Conversational AI to cutting-edge Generative AI and Retrieval-Augmented Generation (RAG). It also helps SAP customers safeguard their investments into SAP Conversational AI and ensure a seamless, one-click transition to SAP Business AI.
With Skybuffer AI, various AI models can be integrated into a single communication channel such as Microsoft Teams. This integration empowers business users with insights drawn from SAP backend systems, enterprise documents, and the expansive knowledge of Generative AI. And the best part of it is that it is all managed through our intuitive no-code Action Server interface, requiring no extensive coding knowledge and making the advanced AI accessible to more users.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Dive into the realm of operating systems (OS) with Pravash Chandra Das, a seasoned Digital Forensic Analyst, as your guide. 🚀 This comprehensive presentation illuminates the core concepts, types, and evolution of OS, essential for understanding modern computing landscapes.
Beginning with the foundational definition, Das clarifies the pivotal role of OS as system software orchestrating hardware resources, software applications, and user interactions. Through succinct descriptions, he delineates the diverse types of OS, from single-user, single-task environments like early MS-DOS iterations, to multi-user, multi-tasking systems exemplified by modern Linux distributions.
Crucial components like the kernel and shell are dissected, highlighting their indispensable functions in resource management and user interface interaction. Das elucidates how the kernel acts as the central nervous system, orchestrating process scheduling, memory allocation, and device management. Meanwhile, the shell serves as the gateway for user commands, bridging the gap between human input and machine execution. 💻
The narrative then shifts to a captivating exploration of prominent desktop OSs, Windows, macOS, and Linux. Windows, with its globally ubiquitous presence and user-friendly interface, emerges as a cornerstone in personal computing history. macOS, lauded for its sleek design and seamless integration with Apple's ecosystem, stands as a beacon of stability and creativity. Linux, an open-source marvel, offers unparalleled flexibility and security, revolutionizing the computing landscape. 🖥️
Moving to the realm of mobile devices, Das unravels the dominance of Android and iOS. Android's open-source ethos fosters a vibrant ecosystem of customization and innovation, while iOS boasts a seamless user experience and robust security infrastructure. Meanwhile, discontinued platforms like Symbian and Palm OS evoke nostalgia for their pioneering roles in the smartphone revolution.
The journey concludes with a reflection on the ever-evolving landscape of OS, underscored by the emergence of real-time operating systems (RTOS) and the persistent quest for innovation and efficiency. As technology continues to shape our world, understanding the foundations and evolution of operating systems remains paramount. Join Pravash Chandra Das on this illuminating journey through the heart of computing. 🌟
14. Every block returns a value
(no statements, only expressions)
def add (x:Int, y:Int) = x + {val tmp = y; tmp * 3}!
!
if (x > 2) 3 else 4!
!
val doubled = for(i <- (1 to 10)) yield i * 2!
15. Type inference
scala> val x = 3
x: Int = 3
scala> def x(y:Int) = y * 9
x: (y: Int)Int
scala> def x(y:Int) =
if (y == 1) List(y) else Set(y)
x: (y: Int) Iterable[Int]
16. Higher order functions
List(1, 2, 3).map((x: Int) => x + 1)
=
List(1, 2, 3).map(x => x + 1) // type is inferred
=
List(1, 2, 3).map(_ + 1) // placeholder notation
17. Universal access principle
import System._!
!
class Clz {!
def w = currentTimeMillis / 1000!
val x = currentTimeMillis / 1000!
var y = currentTimeMillis / 1000!
lazy val z = currentTimeMillis / 1000!
}!
18. Default methods
apply and unapply
object Square{
def apply(d: Double) = d * d
def unapply(d: Double) = Some(math.sqrt(d))
}
//apply
val s = Square(3) // 9
// unaply
16 match { case Square(x) => x } // 4
19. Curried functions
• Add new flow control and language constructs!
def loop(n: Int)(body: => Any) {!
(0 until n) foreach (n => body)!
}!
!
loop(2) {!
println("IM IN YR LOOP!")!
}!
• Multiple varargs lists are possible!!
def crossProduct[L,R](left: L*)(right: R*) =
for (l <- left; r <- right) yield (l,r)!
crossProduct(1,2,3)(‘a’,’b’,’c’)!
• Partially applied functions!
!
22. Type system
Strong
Explicit + Inferred
Traits
Self types
Static + Dynamic
Functional
Erasure
Nominal + Structural
Type aliases
Nonnullable
Monads
Implicit
Co/Contra-‐‑variant
Existential
Value + Reference
Case classes
Path dependent
Anonymous
23. Type safety (Java example)
// compiles fine in Java (arrays are co-variant!!)
int[] ints = {3};
Object[] objects = ints;
// ArrayStoreException in runtime
objects[0] = new Object();
27. Simpler is safer
Indexing by first character
Java
List<String> keywords = Arrays.asList("Apple", "Banana", "Beer");
Map<Character, List<String>> result = new HashMap<Character, List<String>>();
for(String k : keywords) {
char firstChar = k.charAt(1); Oops, here’s a bug.
if(!result.containsKey(firstChar)) {
Anyone noticed?
result.put(firstChar, new ArrayList<String>());
}
result.get(firstChar).add(k);
}
for (List<String> list : result.values()) {
Collections.sort(list);
}
Scala
val keywords = List("Apple", "Banana", "Beer”)
val result = keywords.sorted.groupBy(_.head)
28. Another example
!
Java!
public List<String> empNames(ArrayList<Employee> employees) {!
!ArrayList<String> result = new ArrayList<String>();!
!for (Employee emp: employees) {!
! !result.add(emp.getName());!
!}!
!return result;!
}!
!
!
!
Scala!
def empNames(employees: List[Employee]) = employees map getName!
29. Map combinator paVern
!
Java!
public List<String> empNames(ArrayList<Employee> employees) {!
!ArrayList<String> res = new ArrayList<String>();!
!for (Employee emp: employees) {!
! !res.add(emp.getName());!
!}!
!return res;!
}!
!
!
! Really need to encapsulate??
Scala!
def empNames(employees: List[Employee]) = employees map getName!
30. Another example
!
Java!
public static int factorial(int n) {!
int res = 1;!
for (int i = 1; i <= n; i++) {!
res *= i;!
}!
return res;!
}!
!
!
Scala!
def factorial(n: Int) = (1 to n).reduce(_*_)!
31. Reduce combinator paVern
!
Java!
public static int factorial(int n) {!
int res = 1;!
for (int i = 1; i <= n; i++) {!
res *= i;!
}!
return res;!
}!
!
!
Scala!
def factorial(n: Int) = (1 to n).reduce(_ * _)!
32. Combinatorics
o (1 to 5) combinations 2
List(Vector(1, 2), Vector(1, 3), Vector(1, 4), Vector(1, 5), Vector(2,
3), Vector(2, 4), Vector(2, 5), Vector(3, 4), Vector(3, 5), Vector(4,
5))
o (1 to 5).permutations
"George W. Bush".split(" ").permutations
List(Array(George, W., Bush), Array(George, Bush, W.), Array(W.,
George, Bush), Array(W., Bush, George), Array(Bush, George,
W.), Array(Bush, W., George))
o "George W. Bush".split(" ").toSet.subsets
List(Set(), Set(George), Set(W.), Set(Bush), Set(George, W.),
Set(George, Bush), Set(W., Bush), Set(George, W., Bush))
34. Placeholder syntax for
anonymous functions
Placeholder
Regular
_ + 1 x => x + 1
_ * _ (x1, x2) => x1 * x2
(_: Int) * 2 (x: Int) => x * 2
if (_) x else y z => if (z) x else y
_.map(f) x => x.map(f)
_.map(_ + 1) x => x.map(y => y + 1)
40. Tail recursion optimization
Recursion in Java has an Achilles’ heel:
the call stack
def factorial(n: Int, res: Long = 1): Long =
if(n == 0) res
else factorial(n - 1, (res * n))
41. Safer string composition
• Standard string composition:
“I’m “ + name + “, “ + age + “ years old”
• Formatted:
“I’m %s, %d years old”.format(name, age)
java.util.IllegalFormatConversionException
• Interpolated:
s“I’m $name, $age years old”
42. Create your own
interpolations
xml”””<body>
<a href = “http://…”> $text</a>
</body> ”””
43. Expression simplification – Java
public Expr simplify(Expr expr) {
if (expr instanceof UnOp) {
UnOp unOp = (UnOp) expr;
if (unOp.getOperator().equals("-")) {
if (unOp.getArg() instanceof UnOp) {
UnOp arg = (UnOp) unOp.getArg();
if (arg.getOperator().equals("-"))
return arg.getArg();
}
}
}
if (expr instanceof BinOp) {
BinOp binOp = (BinOp) expr;
if (binOp.getRight() instanceof Number) {
Number arg = (Number) binOp.getRight();
if (binOp.getOperator().equals("+") && arg.getNum() == 0)
return binOp.getLeft();
}
}
return expr;
}
44. PaVern matching
Expression simplification -‐‑ Scala
def simplify(expr: Expr): Expr = expr match {!
case UnOp("-", UnOp("-", e)) => simplify(e)!
case BinOp("+", e, Number(0)) => simplify(e)!
case _ => expr!
}!
45. Value classes
Extensibility minus boxing overhead!
!
class Meter(val v: Double) extends AnyVal {!
def plus (that: Meter) = new Meter(v + that.v) !
}!
!
Compiler generates!
object Meter {!
def plus(this: Meter, that: Meter) = new Meter(v + that.v)!
}!
46. Compile-‐‑time
Meta-‐‑programming
• Language virtualization (overloading/overriding
semantics of the original programming language to
enable deep embedding of DSLs),
• Program reification (providing programs with means to
inspect their own code),
• Self-optimization (self-application of domain-specific
optimizations based on program reification),
• Algorithmic program construction (generation of
code that is tedious to write with the abstractions
supported by a programming language).
47. Meta programming
Language
Operate on
Type Expressive Runtime
safe
ness
Performance
overhead
Textual C, Scala
Text
✗
Low
No
preprocessors
Template C++
Text
✗
Low
No
systems
Compile-‐‑time Haskell, Abstract (typed) ✔
High
No
meta-‐‑ Scala 2.10, Syntax trees
programming
Nemerle
Byte code Java, Scala
byte-‐‑code
✗
Medium
No
manipulation
“Dynamic” Ruby, Scala
objects
✗
High
Yes
reflection
Run-‐‑time Java, Scala
objects
✗
High
Yes
reflection
48. Scala macros
• Full blown compile time meta-
programming
• Access to the compiler API
• Written in Scala
• Hygienic
• Type-safe
50. Efficient Assert
assert(2 + 2 == 4, "weird arithmetic")
// 2 + 2 == 4 will be evaluated only if
assertions were enabled
51. Macros – units of measure
val gravityOnEarth = u(9.81, "m/s^2")!
!
val heightOfMyOfficeWindow = u(3.5, "m")!
!
val speedOfImpact =
sqrt(2.0 * gravityOnEarth * heightOfMyOfficeWindow)!
!
val monthsInAYear = 10b12!
hVp://scalamacros.org/usecases/units-‐‑of-‐‑measure.html
52. Macros – type providers
type MySqlDb(connString: String) = macro ...!
type MyDb = Base with MySqlDb("Server=127.0.0.1;Database=Foo;”)!
val products = new MyDb().products!
products.filter(p => p.name.startsWith("foo"))!
!
!
!
!
!
http://scalamacros.org/usecases/type-providers.html!
Inspired by F# type providers!
53. Type macros
Injecting async methods
class D extends Lifter {!
!def x = 2!
!// def asyncX = future { 2 }!
}!
!
val d = new D!
d.asyncX onComplete {!
!case Success(x) => println(x)!
!case Failure(_) => println("failed")!
}!
hVp://scalamacros.org/talks/2012-‐‑12-‐‑18-‐‑MacroParadise.pdf
54. More uses of macros
• Ad-hoc code style and code-smell detector
• Advanced domain-specific languages
• Logging with minimal overhead
• Pre-compiled SQL queries
• GPU optimized code (see Scalaxy, ScalaCL)
• Macro annotations
o @Cached
55. Macro annotations
class atomic extends MacroAnnotation {
def complete(defn: _) = macro(“backing field”)
def typeCheck(defn: _) = macro("return defn itself”)
}
@atomic var fld: Int
56. GPU compilation
• Enablers: Immutability, Macros
• ScalaCL Collections
OpenCL-backed collections that look and behave
like standard Scala collections (work in progress).
• ScalaCL Compiler Plugin
optimizes Scala programs at compile-time,
transforming regular Scala loops into faster code
and transforming Scala functions given to ScalaCL
Collections into OpenCL kernels.
57. An extremely hack-‐‑able compiler
> scala -Xshow-phases!
phase name id description!
---------- -- -----------!
parser 1 parse source into ASTs, perform simple desugaring!
namer 2 resolve names, attach symbols to named trees!
packageobjects 3 load package objects!
typer 4 the meat and potatoes: type the trees!
patmat 5 translate match expressions!
superaccessors 6 add super accessors in traits and nested classes!
extmethods 7 add extension methods for inline classes!
pickler 8 serialize symbol tables!
refchecks 9 reference/override checking, translate nested objects!
selectiveanf 10 ANF pre-transform for @cps!
selectivecps 11 @cps-driven transform of selectiveanf assignments!
uncurry 12 uncurry, translate function values to anonymous classes!
tailcalls 13 replace tail calls by jumps!
specialize 14 @specialized-driven class and method specialization!
explicitouter 15 this refs to outer pointers, translate patterns!
erasure 16 erase types, add interfaces for traits!
posterasure 17 clean up erased inline classes!
lazyvals 18 allocate bitmaps, translate lazy vals into lazified defs!
lambdalift 19 move nested functions to top level!
constructors 20 move field definitions into constructors!
flatten 21 eliminate inner classes!
mixin 22 mixin composition!
cleanup 23 platform-specific cleanups, generate reflective calls!
icode 24 generate portable intermediate code!
inliner 25 optimization: do inlining!
inlinehandlers 26 optimization: inline exception handlers!
closelim 27 optimization: eliminate uncalled closures!
dce 28 optimization: eliminate dead code!
jvm 29 generate JVM bytecode!
terminal 30 The last phase in the compiler chain!
59. Implicit parameters
implicit val db = getDB!
def store(employee: Employee)(implicit db: DB)!
!
store(emp1oyee1) //db is passed implicitly!
60. Implicit methods
implicit def toEuro(x: Currency): Euro = …!
!
def transfer(amount: Euro) {!
println(”transferred” + amount)!
}!
!
// dollar is automatically converter to euro!
transfer(Dollar(3.0))!
transferred 2.25 Euros!
61. Implicit classes
!
implicit class StringExtensions(s: String) {!
def words = s split " "!
}!
!
!
“hello world”.words // Array(hello, world)!
62. Environments
-‐‑ Currently the most mature
-‐‑ Formally supported by TypeSafe
ublime
-‐‑ Through Ensime
Scala REPL
63. DSLs (accounting)
Rules to calculate an employee's paycheck:!
employee's gross salary for 2 weeks!
minus deductions for!
federalIncomeTax, which is 25% of gross!
stateIncomeTax, which is 5% of gross!
insurancePremiums, which are 500 in gross’s currency!
retirementFundContributions are 10% of gross!
!
hVp://ofps.oreilly.com/titles/9780596155957/DomainSpecificLanguages.html
65. DSL (XPath / json)
val titles = xml "channel" "item" "title“
val titles2 = json "feed" "entry" "title" @ "$t"
github.com/razie/snakked
66. DSLs
testing frameworks
val emptyStack = new Stack[String]
evaluating { emptyStack.pop() } should
produce [NoSuchElementException]
67. Full access to the compiler
import tools.reflect.ToolBox!
import reflect.runtime.{currentMirror => cm}!
!
val tb = cm.mkToolBox()!
!
scala> val tree = tb parse "(5 + 9) * 3"!
tree: tb.u.Tree = 5.$plus(9).$times(3)!
!
scala> tb eval tree!
res1: Any = 42!
68. Reflection
val take = typeOf[List[_]].member(TermName("take")).asMethod!
!
reflect(List(1,3,2,4)).reflectMethod(take)(2) // List(1,2)!
69. Testing
• ScalaCheck
o Auto-generation of inputs and mocks.
o Composable check units
o Inspired by Haskell QuickCheck
• ScalaTest
o TDD, BDD, FeatureSpec
o Selenium DSL
• Specs2
o TDD, BDD, Datatables support
o Integration with Mockito, EasyMock and JMock
o "hello world" must be matching("h.* w.*")
• JUnit
70. ScalaCheck
(inspired by Haskell QuickCheck)
scala> val sqrt = forAll {(n: Int) => math.sqrt(n*n) == n }
scala> propSqrt.check
! Falsified after 1 passed tests:
> -1
71. BDD with ScalaTest
describe("A Stack") {
it("should throw NoSuchElementException if an empty stack is popped") in {
val emptyStack = new Stack[String]
evaluating { emptyStack.pop() } should produce
[NoSuchElementException]
}
it("should pop values in last-in-first-out order") { … }
}
72. How to learn
• twitter.github.com/scala_school
• Effective Scala
• Coursera Scala course (50K students last year)
• Simply scala (interactive learning)
• Programming in scala book
• Stackoverflow
75. Things to be aware of
✗ Scala Compiler has to do much more => slower
✗ Tooling is not perfect
(debugging, synthetic frames, macros support)
Getting better every day.
✗ Language is rapidly evolving.
Deprecations should be expected.