The document provides an overview of the Kotlin programming language. It discusses Kotlin's motivation as a language targeting the JVM that is safer, more concise and simpler than Java. The document outlines Kotlin's key features such as null safety, properties, generics, type inference, extension functions, and interoperability with Java. It provides code examples demonstrating Kotlin's syntax for functions, classes, null handling, and other language constructs.
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.
The document provides an overview of a presentation on the Groovy ecosystem given by Leonard Axelsson. The presentation covers an introduction to Groovy in the first part, highlighting its dynamic and object oriented nature. The second part maps out the Groovy ecosystem, and the third part invites questions from the audience. Examples of Groovy code are provided throughout to demonstrate features like properties, closures, meta programming with annotations, and built-in support for lists and maps.
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.
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.
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.
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.
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.
Solid and Sustainable Development in Scalascalaconfjp
Kazuhiro Sera introduced several of his Scala projects including ScalikeJDBC, Skinny Framework, and AWScala. He discussed some of his philosophies for solid and sustainable development in Scala including using simplified class-based OOP with immutable data structures, avoiding overkill abstraction, writing tests without question, keeping infrastructure lightweight, and ensuring projects have no surprises for newcomers. He welcomed questions during the upcoming AMA session.
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.
The document provides an overview of a presentation on the Groovy ecosystem given by Leonard Axelsson. The presentation covers an introduction to Groovy in the first part, highlighting its dynamic and object oriented nature. The second part maps out the Groovy ecosystem, and the third part invites questions from the audience. Examples of Groovy code are provided throughout to demonstrate features like properties, closures, meta programming with annotations, and built-in support for lists and maps.
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.
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.
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.
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.
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.
Solid and Sustainable Development in Scalascalaconfjp
Kazuhiro Sera introduced several of his Scala projects including ScalikeJDBC, Skinny Framework, and AWScala. He discussed some of his philosophies for solid and sustainable development in Scala including using simplified class-based OOP with immutable data structures, avoiding overkill abstraction, writing tests without question, keeping infrastructure lightweight, and ensuring projects have no surprises for newcomers. He welcomed questions during the upcoming AMA session.
An Introduction to Scala for Java DevelopersMiles Sabin
The document provides an introduction to Scala for Java developers. It outlines key features of Scala including cleaning up Java syntax, going beyond Java with features like case classes, traits, and pattern matching, and its functional focus including support for higher-order functions, the Option type, and for comprehensions. The document also briefly discusses the Scala IDE for Eclipse.
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...Donny Wals
Learn how to use Combine, SwiftUI and Swift 5.2's callAsFunction to build an experimental localization system and familiarize yourself with these new APIs in iOS 13.
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.
This presentation is based on Joakim\’s experiences from moving from Java to Scala http://www.scala-lang.org/node/960#Joak We will explore how to move from Java to Scala and why. We\’ll look at things that you will run into sooner rather than later such as Scala\’s collection APIs, Options and higher order functions and special syntax. You will leave this presentation with good foundation to use Scala in practice; perhaps even in your current Java project and ideally with an appetite to learn more.
This document summarizes new features being added to Java SE 7, including Project Coin which aims to make small improvements to the Java language. Some changes discussed are binary and underscored number literals, string switches, simplified generics using the diamond operator, and try-with-resources for automatic resource management to simplify file copying and closing streams. The goals are to evolve Java cautiously while growing adoption and maintaining a unified language.
Scala is a multi-paradigm programming language that runs on the Java Virtual Machine. It is both object-oriented and functional, with support for immutable data and concise syntax. Scala has gained popularity due to its advantages like type safety, concurrency support, and interoperability with Java. However, some of Scala's advanced features can be difficult to read and use for beginners, and tooling support is not as robust as Java. Overall, Scala represents a promising approach that prioritizes simplicity over ease of use.
This document provides an overview of Scala and compares it to Java. It discusses Scala's object-oriented and functional capabilities, how it compiles to JVM bytecode, and benefits like less boilerplate code and support for functional programming. Examples are given of implementing a simple Property class in both Java and Scala to illustrate concepts like case classes, immutable fields, and less lines of code in Scala. The document also touches on Java interoperability, learning Scala gradually, XML processing capabilities, testing frameworks, and tool/library support.
Java is an object-oriented programming language created by James Gosling at Sun Microsystems in 1995. It is platform independent, meaning programs written in Java can run on any system that supports Java without needing to be recompiled. The document provides an overview of Java, including its history and development, basic concepts like classes and objects, and how to write simple Java programs. It also discusses Java's advantages like being simple, object-oriented, portable, multithreaded, and secure.
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!
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.
Ceylon is a new programming language for the JVM which was recently released on http://ceylon-lang.org with Eclipse based tooling available from day one.
This talk will introduce you to the goals and some of the features of the language while showing the features of the Eclipse based IDE.
Ceylon is a programming language for writing large programs in a team environment. The language is elegant, highly readable, extremely typesafe, and makes it easy to get things done. And it's easy to learn for programmers who are familiar with mainstream languages used in business computing. Ceylon has a full-featured Eclipse-based development environment, allowing developers to take best advantage of the powerful static type system. Programs written in Ceylon execute on the JVM.
Slides as they were used at EclipseCon 2012
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.
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
In this talk we explain how we use the more recent concepts of the Java programming language in order to improve readability and maintainability of our code.
The document discusses JavaScript and why it is misunderstood. It covers how JavaScript is object-oriented despite appearing procedural, uses functions as first-class objects, and has closures. Early versions had bugs and did not respect standards, but modern JavaScript is a full object-oriented language. The document also discusses JavaScript's loose typing, objects and prototypes, performance issues related to interpretation and scope chains, and memory leaks from circular references.
This document discusses Scala in the wild, focusing on its use at Novell in building Pulse, a next-gen communications platform. It highlights some of the challenges of using Scala in an enterprise setting, including the need for actor recovery mechanisms and better Java interoperability. It also notes tendencies of Java developers new to Scala to write Java-style code in Scala and fail to leverage advanced Scala features. The document proposes adopting conventions to help Scala developers write more idiomatic and effective Scala code.
This document discusses using reactive programming with Scala and Akka to build distributed, concurrent systems. It describes using the actor model and message passing between actors to develop scalable and resilient applications. Key points covered include using actors to build a web scraping system, handling failures through supervision strategies, and testing actor systems.
Object-Oriented Programming with Perl and MooseDave Cross
This document contains the slides from a presentation on object oriented programming with Perl and Moose. The presentation covers an introduction to object oriented programming concepts, how OOP is implemented in Perl, and how the Moose toolkit makes OOP easier in Perl. Specific topics covered include classes and objects, methods, attributes, subclasses, and declarative attributes with Moose.
The document discusses elementary sorting algorithms including selection sort, insertion sort, and shellsort. It provides examples of how sorting can be used to sort various data types like numbers, strings, and files by implementing callbacks that allow the sorting routines to compare objects. The key point is that sorting routines do not need specific information about the types of objects being sorted since clients can pass a compare method through an interface like Comparable.
The document provides an agenda for a talk on effective Scala programming. The agenda covers basic Scala concepts like the REPL and expressions vs statements. It then covers object orientation topics like case classes and composition over inheritance. Later sections will cover implicits, type traits, collections, pattern matching and functional programming.
Hadoop est devenu une référence dans l’univers du BigData, et MapReduce, un nouveau paradigme pour exploiter les données. Implémenter directement les traitements de données avec MapReduce donne certainement le plus de flexibilité, mais cela revient à utiliser de l’assembleur. Cascalog est sans doute l’alternative la plus concise. Basée sur Clojure, cette solution vous laisse dans un environnement familier (la JVM) tout en vous apportant une abstraction fort utile par le biais de la programmation logique.
An Introduction to Scala for Java DevelopersMiles Sabin
The document provides an introduction to Scala for Java developers. It outlines key features of Scala including cleaning up Java syntax, going beyond Java with features like case classes, traits, and pattern matching, and its functional focus including support for higher-order functions, the Option type, and for comprehensions. The document also briefly discusses the Scala IDE for Eclipse.
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...Donny Wals
Learn how to use Combine, SwiftUI and Swift 5.2's callAsFunction to build an experimental localization system and familiarize yourself with these new APIs in iOS 13.
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.
This presentation is based on Joakim\’s experiences from moving from Java to Scala http://www.scala-lang.org/node/960#Joak We will explore how to move from Java to Scala and why. We\’ll look at things that you will run into sooner rather than later such as Scala\’s collection APIs, Options and higher order functions and special syntax. You will leave this presentation with good foundation to use Scala in practice; perhaps even in your current Java project and ideally with an appetite to learn more.
This document summarizes new features being added to Java SE 7, including Project Coin which aims to make small improvements to the Java language. Some changes discussed are binary and underscored number literals, string switches, simplified generics using the diamond operator, and try-with-resources for automatic resource management to simplify file copying and closing streams. The goals are to evolve Java cautiously while growing adoption and maintaining a unified language.
Scala is a multi-paradigm programming language that runs on the Java Virtual Machine. It is both object-oriented and functional, with support for immutable data and concise syntax. Scala has gained popularity due to its advantages like type safety, concurrency support, and interoperability with Java. However, some of Scala's advanced features can be difficult to read and use for beginners, and tooling support is not as robust as Java. Overall, Scala represents a promising approach that prioritizes simplicity over ease of use.
This document provides an overview of Scala and compares it to Java. It discusses Scala's object-oriented and functional capabilities, how it compiles to JVM bytecode, and benefits like less boilerplate code and support for functional programming. Examples are given of implementing a simple Property class in both Java and Scala to illustrate concepts like case classes, immutable fields, and less lines of code in Scala. The document also touches on Java interoperability, learning Scala gradually, XML processing capabilities, testing frameworks, and tool/library support.
Java is an object-oriented programming language created by James Gosling at Sun Microsystems in 1995. It is platform independent, meaning programs written in Java can run on any system that supports Java without needing to be recompiled. The document provides an overview of Java, including its history and development, basic concepts like classes and objects, and how to write simple Java programs. It also discusses Java's advantages like being simple, object-oriented, portable, multithreaded, and secure.
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!
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.
Ceylon is a new programming language for the JVM which was recently released on http://ceylon-lang.org with Eclipse based tooling available from day one.
This talk will introduce you to the goals and some of the features of the language while showing the features of the Eclipse based IDE.
Ceylon is a programming language for writing large programs in a team environment. The language is elegant, highly readable, extremely typesafe, and makes it easy to get things done. And it's easy to learn for programmers who are familiar with mainstream languages used in business computing. Ceylon has a full-featured Eclipse-based development environment, allowing developers to take best advantage of the powerful static type system. Programs written in Ceylon execute on the JVM.
Slides as they were used at EclipseCon 2012
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.
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
In this talk we explain how we use the more recent concepts of the Java programming language in order to improve readability and maintainability of our code.
The document discusses JavaScript and why it is misunderstood. It covers how JavaScript is object-oriented despite appearing procedural, uses functions as first-class objects, and has closures. Early versions had bugs and did not respect standards, but modern JavaScript is a full object-oriented language. The document also discusses JavaScript's loose typing, objects and prototypes, performance issues related to interpretation and scope chains, and memory leaks from circular references.
This document discusses Scala in the wild, focusing on its use at Novell in building Pulse, a next-gen communications platform. It highlights some of the challenges of using Scala in an enterprise setting, including the need for actor recovery mechanisms and better Java interoperability. It also notes tendencies of Java developers new to Scala to write Java-style code in Scala and fail to leverage advanced Scala features. The document proposes adopting conventions to help Scala developers write more idiomatic and effective Scala code.
This document discusses using reactive programming with Scala and Akka to build distributed, concurrent systems. It describes using the actor model and message passing between actors to develop scalable and resilient applications. Key points covered include using actors to build a web scraping system, handling failures through supervision strategies, and testing actor systems.
Object-Oriented Programming with Perl and MooseDave Cross
This document contains the slides from a presentation on object oriented programming with Perl and Moose. The presentation covers an introduction to object oriented programming concepts, how OOP is implemented in Perl, and how the Moose toolkit makes OOP easier in Perl. Specific topics covered include classes and objects, methods, attributes, subclasses, and declarative attributes with Moose.
The document discusses elementary sorting algorithms including selection sort, insertion sort, and shellsort. It provides examples of how sorting can be used to sort various data types like numbers, strings, and files by implementing callbacks that allow the sorting routines to compare objects. The key point is that sorting routines do not need specific information about the types of objects being sorted since clients can pass a compare method through an interface like Comparable.
The document provides an agenda for a talk on effective Scala programming. The agenda covers basic Scala concepts like the REPL and expressions vs statements. It then covers object orientation topics like case classes and composition over inheritance. Later sections will cover implicits, type traits, collections, pattern matching and functional programming.
Hadoop est devenu une référence dans l’univers du BigData, et MapReduce, un nouveau paradigme pour exploiter les données. Implémenter directement les traitements de données avec MapReduce donne certainement le plus de flexibilité, mais cela revient à utiliser de l’assembleur. Cascalog est sans doute l’alternative la plus concise. Basée sur Clojure, cette solution vous laisse dans un environnement familier (la JVM) tout en vous apportant une abstraction fort utile par le biais de la programmation logique.
Martin Odersky created Scala to unify object-oriented and functional programming, which upset advocates of both approaches. Scala provides a lightweight syntax that draws from both Java and functional languages. It supports features like lambdas, traits, pattern matching, and everything being an expression. Scala aims to make Java programming better through concepts like computation composition and generic, type-safe code. However, great power in Scala also requires responsibility to avoid issues like operator overloading abuse.
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.
BCS SPA 2010 - An Introduction to Scala for Java DevelopersMiles Sabin
This document provides an introduction to Scala for Java developers. It outlines how Scala cleans up Java syntax by making semi-colons optional, using == for equals and eq for reference equality, and allowing periods to be omitted. It also describes how Scala goes beyond Java by supporting features like case classes, pattern matching, named and default arguments, and mixin composition with traits. The document provides examples of using these features and explains how Scala seamlessly interoperates with Java.
Miles Sabin Introduction To Scala For Java DevelopersSkills Matter
Scala is a programming language that blends object-oriented and functional programming styles. It is designed to interoperate with Java code and runs on the Java Virtual Machine. Some key features of Scala include case classes, pattern matching, traits for mixing behavior, and immutable data structures. Scala code compiles to Java bytecode, allowing seamless use of Java libraries and tools.
A Brief Introduction to Scala for Java DevelopersMiles Sabin
Scala is a programming language that blends object-oriented and functional programming styles. It is designed to interoperate with Java code and runs on the Java Virtual Machine. Some key features of Scala include case classes, pattern matching, traits for mixing functionality, and immutable data structures. Scala code compiles to Java bytecode, allowing seamless use of Java libraries and tools.
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.
After 20 years, Java seems to feel the weight of the years and his syntax it isn't evolved as we live. But the JVM it is always a stable environment and it is often in production everywhere. In the past years, there were many languages based on the JVM, but they don't have a lot of success. Kotlin conquered Android and, now, thanks to an easy syntax many and big companies behind it, may be used also in web development, also as full stack language. During this talk, we will give a look the language and how to use it to develop a production ready web application.
All code showed during presentation is here: https://github.com/jesty/kotlin-fossavotabona
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.
Dart (https://www.dartlang.org/) is a general-purpose programming language to build web, server, IoT and mobile applications.
Flutter (https://www.flutter.io/) is a promising project to build mobile apps for iOS and Android from a single codebase in Dart.
Dart and Flutter significantly increase the productivity of the developers.
Slides from following meetup
https://www.meetup.com/Luxembourg-Dart-Lang-Meetup/events/235373973/
Dart (https://www.dartlang.org/) is a general-purpose programming language to build web, server, IoT and mobile applications.
AngularDart (https://webdev.dartlang.org/angular) - also called Angular 2 for Dart or simply Angular - is a web app framework that focuses on productivity, performance, and stability. Hundreds of Google engineers use AngularDart to build the sophisticated, mission-critical apps that bring in much of Google’s revenue.
Flutter (https://www.flutter.io/) is a promising project to build mobile apps for iOS and Android from a single codebase in Dart.
Dart, AngularDart and Flutter significantly increase the productivity of the developers.
Slides from following meetup
https://www.meetup.com/Luxembourg-Dart-Lang-Meetup/events/237012072/
Scala is a multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It is designed to integrate features of object-oriented and functional languages. Some key features of Scala include object-oriented programming, strong static typing, functional programming, pattern matching, actor-based concurrency, and more.
This is a reviewed version of our scala-101 presentation with some extra contents. We prepared this version for the Barcelona Developer Conference 2013.
See the original at: http://www.slideshare.net/IgnasiMarimonClos/scala-101
A brief introduction to the Dart programming language. I wrote this talk for FISL 16 (2015) and presented it there. The video is available at http://hemingway.softwarelivre.org/fisl16/high/40t/sala_40t-high-201507101800.ogv
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?
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.
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
Dopo 20 anni Java inizia a sentire il peso degli anni e la sua sintassi non evolve come vorremmo, ma la JVM resta sempre un ambiente affidabile ed è già in produzione presso moltissime aziende. Negli ultimi anni sono usciti molti linguaggi basati sulla JVM, ma non tutti hanno avuto il successo sperato. Kotlin ha conquistato Android e, ora, grazie a una sintassi intuitiva e grandi aziende che lo supportano potrebbe essere molto utilizzato anche nelle applicazioni web. Durante il talk vedremo le basi del linguaggio e come sviluppare una applicazione web pronta ad andare in produzione.
OpenStack Data Processing ("Sahara") project update - December 2014Sergey Lukjanov
Sahara provides scalable data processing in OpenStack by provisioning and operating data processing clusters and scheduling and operating jobs. It implements Elastic Data Processing for workflow management. The Juno release focused on code contributions from 50 people, implementing 32 blueprints and fixing 168 bugs. Plans for the Kilo release include support for new Hadoop/Spark versions, improved dashboards, better Heat integration and Ironic support.
Atlanta OpenStack Summit: Technical Deep Dive: Big Data Computations Using El...Sergey Lukjanov
This document discusses using OpenStack for big data computations with elastic data processing (EDP). It provides an overview of Sahara, the OpenStack project for provisioning and managing Hadoop clusters. EDP allows executing Hadoop jobs like MapReduce on transient clusters through APIs similar to AWS EMR. A demo shows generating sample big data from a pet store, cleaning the data with a Java job, and extracting counts by state with a Pig job. Future work may include additional job execution engines and improved usability for EDP in Sahara.
Atlanta OpenStack Summit: The State of OpenStack Data Processing: Sahara, Now...Sergey Lukjanov
The document discusses Sahara, OpenStack's project for provisioning and managing Hadoop clusters. It provides an overview of Sahara's Icehouse release and the Hortonworks Data Platform plugin. Plans for the upcoming Juno release include further integrating Sahara with other OpenStack components through a distributed architecture, guest agents, and enhancements to Elastic Data Processing. Key topics from the Icehouse release are fixing bugs, adding new features like HBase support, and improving usability. The Hortonworks plugin supports various Hadoop distributions and uses Ambari for cluster provisioning and management.
This document provides updates on the OpenStack Savanna (Data Processing) project for the Havana and Icehouse releases. For Havana, 69 blueprints were implemented, 150 bugs were fixed, and clustering and elastic data processing capabilities were added. For Icehouse, integration with Heat for orchestration is underway, new contributors have been added, and gating Savanna with DevStack and Tempest is in progress.
Hong Kong OpenStack Summit: Savanna - Hadoop on OpenStackSergey Lukjanov
Savanna is an OpenStack project that provides tools for provisioning and managing Hadoop clusters on OpenStack. It allows users to easily run Hadoop jobs without expertise in Hadoop operations. Savanna provides an Elastic Data Processing (EDP) interface that hides cluster management and allows users to focus on their data and questions. The current version of Savanna supports various Hadoop distributions, integration with OpenStack services, and EDP features like executing Pig and Hive jobs. Future plans include further OpenStack integration and improvements to EDP.
Savanna is an OpenStack component that allows elastic provisioning of Hadoop clusters in OpenStack. It has a 3 phase roadmap - phase 1 allows basic cluster provisioning which is complete, phase 2 will add advanced configuration and tool integration currently in progress, and phase 3 will enable analytics as a service with a job execution framework. Savanna uses an extensible plugin architecture to provision Hadoop VMs and configure the clusters, integrating with other OpenStack components like Nova, Glance, and Swift.
The document discusses the Java Memory Model (JMM) and how it defines the interactions between threads through memory. It explains that the JMM guarantees when one thread will see changes made by another thread. It also discusses variable visibility, reordering of operations, happens-before relationships between actions, and how tools like volatile variables can be used to enforce ordering between threads.
The document discusses Twitter Storm, an open source distributed real-time computation system. Storm allows users to reliably process unbounded streams of data, doing tasks like analytics, monitoring, or real-time alerts. It works by coordinating a cluster of machines to reliably process streams of tuples in parallel. Storm topologies are directed graphs of spouts and bolts that process tuples from streams.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive function. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsDianaGray10
Join us to learn how UiPath Apps can directly and easily interact with prebuilt connectors via Integration Service--including Salesforce, ServiceNow, Open GenAI, and more.
The best part is you can achieve this without building a custom workflow! Say goodbye to the hassle of using separate automations to call APIs. By seamlessly integrating within App Studio, you can now easily streamline your workflow, while gaining direct access to our Connector Catalog of popular applications.
We’ll discuss and demo the benefits of UiPath Apps and connectors including:
Creating a compelling user experience for any software, without the limitations of APIs.
Accelerating the app creation process, saving time and effort
Enjoying high-performance CRUD (create, read, update, delete) operations, for
seamless data management.
Speakers:
Russell Alfeche, Technology Leader, RPA at qBotic and UiPath MVP
Charlie Greenberg, host
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.
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/how-axelera-ai-uses-digital-compute-in-memory-to-deliver-fast-and-energy-efficient-computer-vision-a-presentation-from-axelera-ai/
Bram Verhoef, Head of Machine Learning at Axelera AI, presents the “How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-efficient Computer Vision” tutorial at the May 2024 Embedded Vision Summit.
As artificial intelligence inference transitions from cloud environments to edge locations, computer vision applications achieve heightened responsiveness, reliability and privacy. This migration, however, introduces the challenge of operating within the stringent confines of resource constraints typical at the edge, including small form factors, low energy budgets and diminished memory and computational capacities. Axelera AI addresses these challenges through an innovative approach of performing digital computations within memory itself. This technique facilitates the realization of high-performance, energy-efficient and cost-effective computer vision capabilities at the thin and thick edge, extending the frontier of what is achievable with current technologies.
In this presentation, Verhoef unveils his company’s pioneering chip technology and demonstrates its capacity to deliver exceptional frames-per-second performance across a range of standard computer vision networks typical of applications in security, surveillance and the industrial sector. This shows that advanced computer vision can be accessible and efficient, even at the very edge of our technological ecosystem.
In the realm of cybersecurity, offensive security practices act as a critical shield. By simulating real-world attacks in a controlled environment, these techniques expose vulnerabilities before malicious actors can exploit them. This proactive approach allows manufacturers to identify and fix weaknesses, significantly enhancing system security.
This presentation delves into the development of a system designed to mimic Galileo's Open Service signal using software-defined radio (SDR) technology. We'll begin with a foundational overview of both Global Navigation Satellite Systems (GNSS) and the intricacies of digital signal processing.
The presentation culminates in a live demonstration. We'll showcase the manipulation of Galileo's Open Service pilot signal, simulating an attack on various software and hardware systems. This practical demonstration serves to highlight the potential consequences of unaddressed vulnerabilities, emphasizing the importance of offensive security practices in safeguarding critical infrastructure.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
Dandelion Hashtable: beyond billion requests per second on a commodity serverAntonios Katsarakis
This slide deck presents DLHT, a concurrent in-memory hashtable. Despite efforts to optimize hashtables, that go as far as sacrificing core functionality, state-of-the-art designs still incur multiple memory accesses per request and block request processing in three cases. First, most hashtables block while waiting for data to be retrieved from memory. Second, open-addressing designs, which represent the current state-of-the-art, either cannot free index slots on deletes or must block all requests to do so. Third, index resizes block every request until all objects are copied to the new index. Defying folklore wisdom, DLHT forgoes open-addressing and adopts a fully-featured and memory-aware closed-addressing design based on bounded cache-line-chaining. This design offers lock-free index operations and deletes that free slots instantly, (2) completes most requests with a single memory access, (3) utilizes software prefetching to hide memory latencies, and (4) employs a novel non-blocking and parallel resizing. In a commodity server and a memory-resident workload, DLHT surpasses 1.6B requests per second and provides 3.5x (12x) the throughput of the state-of-the-art closed-addressing (open-addressing) resizable hashtable on Gets (Deletes).
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
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.
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
5th LF Energy Power Grid Model Meet-up SlidesDanBrown980551
5th Power Grid Model Meet-up
It is with great pleasure that we extend to you an invitation to the 5th Power Grid Model Meet-up, scheduled for 6th June 2024. This event will adopt a hybrid format, allowing participants to join us either through an online Mircosoft Teams session or in person at TU/e located at Den Dolech 2, Eindhoven, Netherlands. The meet-up will be hosted by Eindhoven University of Technology (TU/e), a research university specializing in engineering science & technology.
Power Grid Model
The global energy transition is placing new and unprecedented demands on Distribution System Operators (DSOs). Alongside upgrades to grid capacity, processes such as digitization, capacity optimization, and congestion management are becoming vital for delivering reliable services.
Power Grid Model is an open source project from Linux Foundation Energy and provides a calculation engine that is increasingly essential for DSOs. It offers a standards-based foundation enabling real-time power systems analysis, simulations of electrical power grids, and sophisticated what-if analysis. In addition, it enables in-depth studies and analysis of the electrical power grid’s behavior and performance. This comprehensive model incorporates essential factors such as power generation capacity, electrical losses, voltage levels, power flows, and system stability.
Power Grid Model is currently being applied in a wide variety of use cases, including grid planning, expansion, reliability, and congestion studies. It can also help in analyzing the impact of renewable energy integration, assessing the effects of disturbances or faults, and developing strategies for grid control and optimization.
What to expect
For the upcoming meetup we are organizing, we have an exciting lineup of activities planned:
-Insightful presentations covering two practical applications of the Power Grid Model.
-An update on the latest advancements in Power Grid -Model technology during the first and second quarters of 2024.
-An interactive brainstorming session to discuss and propose new feature requests.
-An opportunity to connect with fellow Power Grid Model enthusiasts and users.
How information systems are built or acquired puts information, which is what they should be about, in a secondary place. Our language adapted accordingly, and we no longer talk about information systems but applications. Applications evolved in a way to break data into diverse fragments, tightly coupled with applications and expensive to integrate. The result is technical debt, which is re-paid by taking even bigger "loans", resulting in an ever-increasing technical debt. Software engineering and procurement practices work in sync with market forces to maintain this trend. This talk demonstrates how natural this situation is. The question is: can something be done to reverse the trend?
Generating privacy-protected synthetic data using Secludy and MilvusZilliz
During this demo, the founders of Secludy will demonstrate how their system utilizes Milvus to store and manipulate embeddings for generating privacy-protected synthetic data. Their approach not only maintains the confidentiality of the original data but also enhances the utility and scalability of LLMs under privacy constraints. Attendees, including machine learning engineers, data scientists, and data managers, will witness first-hand how Secludy's integration with Milvus empowers organizations to harness the power of LLMs securely and efficiently.
1. THE KOTLIN
PROGRAMMING LANGUAGE
Sergey Lukjanov, 2012
slukjanov@mirantis.com
1
Thursday, February 16, 12
2. WHAT IS KOTLIN?
•JVM-targeted
•Statically typed
•Object-oriented
•General purpose
•Programming language
•Docs available today
•Open source from Feb 14
2
Thursday, February 16, 12
6. MOTIVATION
•IDEA codebase ≥ 200MB Java-code, ≥ 50k classes
•Java libraries and community
4
Thursday, February 16, 12
7. MOTIVATION
•IDEA codebase ≥ 200MB Java-code, ≥ 50k classes
•Java libraries and community
•There are many languages, why not try?
4
Thursday, February 16, 12
10. DESIGN GOALS
•Full Java interoperability
•Compiles as fast as Java
5
Thursday, February 16, 12
11. DESIGN GOALS
•Full Java interoperability
•Compiles as fast as Java
•Safer than Java
5
Thursday, February 16, 12
12. DESIGN GOALS
•Full Java interoperability
•Compiles as fast as Java
•Safer than Java
•More concise than Java
5
Thursday, February 16, 12
13. DESIGN GOALS
•Full Java interoperability
•Compiles as fast as Java
•Safer than Java
•More concise than Java
•Way simpler than Scala
5
Thursday, February 16, 12
20. HELLO, <NAMES>! (REALISTIC)
fun main(args : Array<String>) {
println("Hello, ${args.join(", ")}!")
}
12
Thursday, February 16, 12
21. HELLO, <NAMES>! (REALISTIC)
fun main(args : Array<String>) {
println("Hello, ${args.join(", ")}!")
}
fun <T> Iterable<T>.join(separator : String) : String {
val names = StringBuilder()
forit (this) {
names += it.next()
if (it.hasNext)
names += separator
}
return names.toString() ?: ""
}
fun <T> forit(col : Iterable<T>, f : (Iterator<T>) -> Unit) {
val it = col.iterator()
while (it.hasNext)
f(it)
}
12
Thursday, February 16, 12
22. NULL-SAFETY 1/2
fun parseInt(str : String) : Int? {
try {
return Integer.parseInt(str)
} catch (e : NumberFormatException) {
return null
}
}
13
Thursday, February 16, 12
23. NULL-SAFETY 1/2
fun parseInt(str : String) : Int? {
try {
return Integer.parseInt(str)
} catch (e : NumberFormatException) {
return null
}
}
fun main(args : Array<String>) {
val x = parseInt("1027")
val y = parseInt("Hello, World!") // y == null
println(x?.times(2)) // can’t write x * 2
println(x?.times(y)) // times argument can't be nullable
println(x?.times(y.sure())) // throws NPE if y == null
if (x != null) {
println(x * 2)
}
}
13
Thursday, February 16, 12
24. NULL-SAFETY 2/2
fun String?.isNullOrEmpty() : Boolean {
return this == null || this.trim().length == 0
}
14
Thursday, February 16, 12
25. NULL-SAFETY 2/2
fun String?.isNullOrEmpty() : Boolean {
return this == null || this.trim().length == 0
}
fun main(args : Array<String>) {
println("Hello".isNullOrEmpty()) // false
println(" World ".isNullOrEmpty()) // false
println(" ".isNullOrEmpty()) // true
println(null.isNullOrEmpty()) // true
}
14
Thursday, February 16, 12
26. AUTOMATIC CASTS
fun foo(obj : Any?) {
if (obj is String) {
println(obj.get(0));
}
}
15
Thursday, February 16, 12
27. WHEN STATEMENT
fun foo(obj : Any?) {
val x : Any? = when (obj) {
is String -> obj.get(0) // autocast to String
is Int -> obj + 1 // autocast to Int
!is Boolean -> null
else -> "unknown"
}
val i : Int = when (obj) {
is String -> if(obj.startsWith("a")) 1 else 0
is Int -> obj
else -> -1
}
}
16
Thursday, February 16, 12
28. TYPES 1/2
Syntax
Class types List<Foo>
Nullable types Foo?
Function types (Int) -> String
Tuple types (Int, Int)
Self types This
17
Thursday, February 16, 12
29. TYPES 2/2
Special types
Top Any?
Bottom Nothing
No meaningful return value Unit
18
Thursday, February 16, 12
30. TYPES HIERARCHY
Any?
Int? String? ... Any
Nothing? Int Unit
Nothing
Complete lattice
19
Thursday, February 16, 12
31. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
32. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
33. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
34. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
35. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
36. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
37. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
38. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
39. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
40. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
41. MAPPING TO JAVA TYPES
Kotlin GEN Java LOAD Kotlin
Any Object Any?
Unit void Unit
Int int Int
Int? Integer Int?
String String String?
Array<Foo> Foo[] Array<Foo?>?
Array<Int> int[] Array<Int>?
List<Int> List<Integer> List<Int?>?
Nothing - -
Foo Foo Foo?
20
Thursday, February 16, 12
42. CLASSES
open class Parent(p : Bar) {
open fun foo() {
}
fun bar() {
}
}
class Child(p : Bar) : Parent(p) {
override fun foo() {
}
}
•Any is the default supertype
•Constructors must initialize supertypes
•Final by default, explicit override annotations
21
Thursday, February 16, 12
43. TRAITS
trait T1 : Class1, OtherTrait {
// no state
}
class Foo(p : Bar) : Class1(p), T1, T2 {
// ...
}
class Decorator(p : T2) : Class2(), T2 by p {
// ...
}
22
Thursday, February 16, 12
44. DISAMBIGUATION
trait A {
fun foo() : Int = 1 // open by default
}
open class B() {
open fun foo() : Int = 2 // not open by default
}
class C() : B(), A {
override fun foo() = super<A>.foo() // returns 1
}
23
Thursday, February 16, 12
45. FIRST-CLASS FUNCTIONS
fun foo(arg : String) : Boolean // function
(p : Int) -> Int // function type
(Int) -> Int // function type
(a : Int) -> a + 1 // function literal
(b) : Int -> b * 2 // function literal
c -> c.times(2) // function literal
24
Thursday, February 16, 12
46. HIGH-ORDER FUNS
fun <T> filter( c : Iterable<T>, f: (T)->Boolean):Iterable<T>
filter(list, { s -> s.length < 3 })
25
Thursday, February 16, 12
47. HIGH-ORDER FUNS
fun <T> filter( c : Iterable<T>, f: (T)->Boolean):Iterable<T>
filter(list, { s -> s.length < 3 })
filter(list) { s -> s.length < 3 }
25
Thursday, February 16, 12
48. HIGH-ORDER FUNS
fun <T> filter( c : Iterable<T>, f: (T)->Boolean):Iterable<T>
filter(list, { s -> s.length < 3 })
filter(list) { s -> s.length < 3 }
// if only one arg:
25
Thursday, February 16, 12
49. HIGH-ORDER FUNS
fun <T> filter( c : Iterable<T>, f: (T)->Boolean):Iterable<T>
filter(list, { s -> s.length < 3 })
filter(list) { s -> s.length < 3 }
// if only one arg:
filter(list) { it.length < 3 }
25
Thursday, February 16, 12
50. LOCAL FUNCTIONS
fun reachable(from : Vertex, to : Vertex) : Boolean {
val visited = HashSet<Vertex>()
fun dfs(current : Vertex) {
// here we return from the outer function:
if (current == to) return@reachable true
// And here - from local function:
if (!visited.add(current)) return
for (v in current.neighbors)
dfs(v)
}
dfs(from)
return false // if dfs() did not return true already
}
26
Thursday, February 16, 12
51. INFIX FUNCTION CALLS
// regular call:
a.contains("123")
// infix call:
a contains "123"
27
Thursday, February 16, 12
52. INFIX FUNCTION CALLS
// regular call:
a.contains("123")
// infix call:
a contains "123"
// “LINQ”
users
.filter { it hasPrivilege WRITE }
.map { it -> it.fullName }
.orderBy { it.lastName }
27
Thursday, February 16, 12
53. LOCK EXAMPLE
myLock.lock()
try {
// do something
} finally {
myLock.unlock()
}
28
Thursday, February 16, 12
54. LOCK EXAMPLE
myLock.lock() lock(myLock) {
try { // do something
// do something }
} finally {
myLock.unlock()
}
28
Thursday, February 16, 12
55. LOCK EXAMPLE
myLock.lock() lock(myLock) {
try { // do something
// do something }
} finally {
myLock.unlock()
}
inline fun <T> lock(l : Lock, body : () -> T) : T {
l.lock()
try {
return body()
} finally {
l.unlock()
}
}
28
Thursday, February 16, 12
56. GENERICS: INVARIANCE
class List<T> {
fun add(t : T)
fun get(idx : Int) : T
}
val intList = List<Int>()
// We should not be able to do it:
val anyList : List<Any> = intList
anyList.add("1") // Cause of the problem
val i : Int = intList.get(0) // !!!
29
Thursday, February 16, 12
57. DECLARATION-SITE VARIANCE
class List<T> { val intList = List<Int>()
fun add(t : T) val anyList : List<Any> = intList
fun get(idx : Int) : T
}
30
Thursday, February 16, 12
58. DECLARATION-SITE VARIANCE
class List<T> { val intList = List<Int>()
fun add(t : T) val anyList : List<Any> = intList
fun get(idx : Int) : T
}
class Producer<out T> { val intProd = Producer<Int>()
fun get() : T val anyProd : Producer<Any> = intProd
}
30
Thursday, February 16, 12
59. DECLARATION-SITE VARIANCE
class List<T> { val intList = List<Int>()
fun add(t : T) val anyList : List<Any> = intList
fun get(idx : Int) : T
}
class Producer<out T> { val intProd = Producer<Int>()
fun get() : T val anyProd : Producer<Any> = intProd
}
class Consumer<in T> { val anyCons = Consumer<Any>()
fun add(t : T) val intCons : Consumer<Int> = anyCons
}
30
Thursday, February 16, 12
60. USE-SITE VARIANCE
val intList = List<Int>()
val anyListOut : List<out Any> = intList
anyListOut.add("1") // Not available
val i : Int = intList.get(0) // No problem
val anyList = List<Any>()
val intListIn : List<in Int> = anyList
intListIn.add(123)
val obj = intListIn.get(0) // : Any?
31
Thursday, February 16, 12
61. REIFIED GENERICS
// Type information is retained in runtime
foo is List<T>
Array<T>(10)
T.create()
T.javaClass
32
Thursday, February 16, 12
62. REIFIED GENERICS
// Type information is retained in runtime
foo is List<T>
Array<T>(10)
T.create()
T.javaClass
// Java types is still erased...
foo is java.util.List<*>
32
Thursday, February 16, 12
63. TUPLES
class Tuple2<out T1, out T2>(
val _1 : T1,
val _2 : T2
)
val pair : #(Int, String) = #(1, "")
// same as 'Tuple2<Int, String>(1, "")'
when (x) {
is #(null, *) => throw NullPointerException()
is #(val a, val b) => print(a, b)
}
print("left = ${pair._1}, right = ${pair._2}")
val point : #(x : Int, y : Int) // labeled tuple
print("x = ${point.x}, y = ${point.y}")
val point : #(x : Int, y : Int) = #(y = 10, x = 5)
33
Thursday, February 16, 12
64. PATTERN MATCHING 1/2
when (a) {
is Tree#(*, null) -> print("no right child")
is Tree#(val l is Tree, val r is Tree) -> print("$l and $r")
is Tree -> print("just a tree")
is #(*, val b in 1..100) -> print(b)
else -> print("unknown")
}
34
Thursday, February 16, 12
65. PATTERN MATCHING 1/2
when (a) {
is Tree#(*, null) -> print("no right child")
is Tree#(val l is Tree, val r is Tree) -> print("$l and $r")
is Tree -> print("just a tree")
is #(*, val b in 1..100) -> print(b)
else -> print("unknown")
}
class Tree(val left : Tree?, val right : Tree?)
34
Thursday, February 16, 12
66. PATTERN MATCHING 1/2
when (a) {
is Tree#(*, null) -> print("no right child")
is Tree#(val l is Tree, val r is Tree) -> print("$l and $r")
is Tree -> print("just a tree")
is #(*, val b in 1..100) -> print(b)
else -> print("unknown")
}
class Tree(val left : Tree?, val right : Tree?)
decomposer fun Any?.Tree() : #(Tree?, Tree?)? {
return if (this is Tree) #(this.left, this.right) else null
}
34
Thursday, February 16, 12
67. PATTERN MATCHING 2/2
when (d) {
is mmddyy#(02, 16, val a) -> print("Feb 16th of $a"))
}
class Date(val timestamp : Long) {
fun mmddyy() : #(Int, Int, Int)? = #(month, day, year)
}
fun Date.mmddyy() : #(Int, Int, Int)? = #(month, day, year)
35
Thursday, February 16, 12
68. CLASS OBJECTS 1/2
class Example() {
class object {
fun create() = Example()
}
}
val e = Example.create()
36
Thursday, February 16, 12
69. CLASS OBJECTS 2/2
trait Factory<T> {
fun create() : T
}
class Example2() {
class object : Factory<Example2> {
override fun create() = Example2()
}
}
val factory : Factory<Example2> = Example2
val e2 : Example2 = factory.create()
37
Thursday, February 16, 12