At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
Pattern Matching: Small Enhancement or Major Feature? (talk from jLove 2021)🎤 Hanno Embregts 🎸
At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
The document discusses aliasing in Python programming. It explains that an alias is a second name for a piece of data. It provides examples of how aliasing can cause bugs when working with mutable data like lists, but not with immutable data. It also discusses why Python allows aliasing despite the potential for bugs - for efficiency when working with large data structures and because sometimes in-place updates are desired.
MC Squared is a musical instrument that detects motion and generates sounds. It can be played with any part of the body or an object. Each of the six sides is embedded with an infrared sensor that triggers a different sound sample when motion is detected near that side. The instrument was inspired by devices like the theremin and Groovebox that incorporate motion sensing. It allows intuitive and playful musical exploration and expression for both musicians and non-musicians alike.
Conférence des Geeks Anonymes sur " le langage Go ", par Thomas Hayen le 23 septembre 2020.
Cette conférence est disponible en vidéo sur Youtube : https://youtu.be/AlGGneVGTJk
The document discusses a prettier printer, a tool for formatting code to be more readable. It focuses on consistency, teachability, and freedom in code formatting. It describes handling various code structures like function calls, member expressions, comments, and conditionals. It also mentions new features like TypeScript and CSS support in the latest 1.4.0 release.
Unit testing with PHPUnit allows developers to automate testing of classes and functions. Tests can validate expected outputs and behaviors and catch bugs. PHPUnit provides assertions to validate results and annotations to organize tests, mark them as incomplete, or specify expected exceptions. Fixtures can set up and tear down test environments and data. Writing thorough automated tests improves code quality and prevents regressions.
The document discusses slicing in Python. It explains that lists, strings, and tuples can be sliced using a range of indices. It provides examples of slicing elements and strings, demonstrating how slicing returns a substring or subsequence. It notes that slicing always creates a new collection, rather than being an alias, so changes to a slice do not affect the original object.
Pattern Matching: Small Enhancement or Major Feature? (talk from jLove 2021)🎤 Hanno Embregts 🎸
At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
The document discusses aliasing in Python programming. It explains that an alias is a second name for a piece of data. It provides examples of how aliasing can cause bugs when working with mutable data like lists, but not with immutable data. It also discusses why Python allows aliasing despite the potential for bugs - for efficiency when working with large data structures and because sometimes in-place updates are desired.
MC Squared is a musical instrument that detects motion and generates sounds. It can be played with any part of the body or an object. Each of the six sides is embedded with an infrared sensor that triggers a different sound sample when motion is detected near that side. The instrument was inspired by devices like the theremin and Groovebox that incorporate motion sensing. It allows intuitive and playful musical exploration and expression for both musicians and non-musicians alike.
Conférence des Geeks Anonymes sur " le langage Go ", par Thomas Hayen le 23 septembre 2020.
Cette conférence est disponible en vidéo sur Youtube : https://youtu.be/AlGGneVGTJk
The document discusses a prettier printer, a tool for formatting code to be more readable. It focuses on consistency, teachability, and freedom in code formatting. It describes handling various code structures like function calls, member expressions, comments, and conditionals. It also mentions new features like TypeScript and CSS support in the latest 1.4.0 release.
Unit testing with PHPUnit allows developers to automate testing of classes and functions. Tests can validate expected outputs and behaviors and catch bugs. PHPUnit provides assertions to validate results and annotations to organize tests, mark them as incomplete, or specify expected exceptions. Fixtures can set up and tear down test environments and data. Writing thorough automated tests improves code quality and prevents regressions.
The document discusses slicing in Python. It explains that lists, strings, and tuples can be sliced using a range of indices. It provides examples of slicing elements and strings, demonstrating how slicing returns a substring or subsequence. It notes that slicing always creates a new collection, rather than being an alias, so changes to a slice do not affect the original object.
An approach for load-time hacking using LD_PRELOAD is presented.
We discuss a simple, yet intriguing, strategy for overcoming the limitations discussed in Part 1 (i.e., the first publication given in the reference) of reverse engineering and exploitation using LD_PRELOAD, a dynamic linking technique. In particular, we relax the need for exit(1) in the main function. The essence of the technique is that both the stack pointer (esp) and the base frame pointer (ebp) are carefully adjusted when the wrapper to the library function is called. The proposed solution allows us to safely return to libc after dynamically modifying the control flow in the wrapper to (library) functions.
Go uses goroutines and channels for concurrency. Goroutines are lightweight threads that communicate through channels, which are typed queues that allow synchronous message passing. Channels can be used to synchronize access to shared memory, allowing both shared memory and message passing for concurrency. The language is designed for scalable fine-grained concurrency but further improvements are still needed, especially to the goroutine scheduler.
This document contains source code for various components of a Java program that implements grammatical optimization. It includes the main class with the main method that initializes variables and objects. It also includes classes for the genotype, grammar, initializer, and mapper components. The classes define methods for initializing objects, mapping between genotypes and phenotypes, checking validity, and accessing attributes.
The document discusses various methods for reading data from files in Python, including reading the entire file content into a string, reading the file in chunks, reading one line at a time, and reading all lines at once into a list. It demonstrates counting the total number of characters or getting the average line length for a sample haiku file using different reading methods.
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best PracticesJohannes Hoppe
The document provides JavaScript best practices focusing on code quality, avoiding antipatterns like implied globals and eval, and recommendations for style like indentation and naming conventions. It also discusses testing with Jasmine including writing tests, making them pass, refactoring code, and repeating the test-driven development process. Modular code organization techniques like revealing module pattern and event publishing are also covered.
The document provides an overview of functional programming in Java. It discusses functional programming concepts like higher-order functions and avoiding side effects. It gives examples of functional-style code in Java for filtering lists and transforming objects. It also discusses how functional programming can be used to implement customizable business logic by passing functions as parameters and looking up functions through a dependency injection container.
This document summarizes key concepts about strings in Python. It explains that strings are sequences of characters that can be indexed and iterated over like lists. Strings are immutable and concatenated using +. Formatting uses % operator. Escape characters represent special characters. Triple quotes allow multi-line strings. Strings have useful methods like upper(), lower(), find(), replace(), etc. that can be chained together.
The document discusses the history and evolution of testing in Perl from its early days in the 1980s to modern techniques. It covers key topics like the development of Test Anything Protocol (TAP), important testing modules like Test::More, Test::Simple, and tools for testing documentation, code quality, and more. Various commands for running tests are also presented.
This document discusses Python control flow and various looping and conditional structures in Python like while loops, if/elif/else statements, and nested blocks. It provides examples of how while loops can execute zero times if the condition is never true, or forever if the condition is never made false. It also discusses why Python uses indentation rather than braces to define blocks and recommends using 4 spaces of indentation.
Functional programming is all the rage. It can undoubtedly produce cleaner and more expressive code, but why switch to Scala or wait for Java 8? In fact, there are many ways to dramatically improve your Java code quality by using a more functional style today. This presentation discusses how techniques such as functional programming, using fluent APIs, and other clean coding practices can make your code more concise, more readable, and much easier to maintain. But more importantly, you will learn about libraries such as LambdaJ and Google Guava that make this possible today with your existing Java code base.
The document discusses pattern matching in Java. It provides examples of using type patterns to bind variables in if/else statements and instanceof checks. Switch expressions are demonstrated as another way to perform pattern matching by matching on an object's type and extracting variables. The benefits of pattern matching such as conciseness, safety and reducing errors are outlined. It also shows how to handle null values in a switch expression.
Pattern Matching - Small Enhancement or Major Feature? from Developer Week 202🎤 Hanno Embregts 🎸
At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
Perl 5.10 introduces several new features including say for easy printing, smart matching with ~~, switch statement, defined-or operator //, and state variables for persistent data within subs. It also includes improvements to the regex engine, modules like Hash::Util::FieldHash, better Windows support and a faster UTF-8 implementation. The release timeline is 5.8.9 stable by April 1st 2006, 5.10 after lunch before Christmas 2006, and Perl 6 after lunch before Christmas 2006.
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.
This document summarizes Hamlet D'Arcy's presentation on AST transformations using tools like Lombok, Groovy, CodeNarc, and Mirah. It discusses how these tools allow manipulating abstract syntax trees to add functionality like automatic property generation, static analysis, and embedded domain-specific languages. Local AST transformations are performed without changing bytecode or requiring new semantics. Type checking can also be added through transformations. Mirah compiles to pure Java classes without additional syntax.
This document summarizes key points about working with Marionette.js views:
1) Views have a lifecycle of initialize(), render(), onRender(), destroy(), with events handled in onRender() rather than render().
2) Templates can be JavaScript functions or require'd .ejs files, with .ejs preferred. getTemplate() provides the view's scope.
3) Listen to model events in index.js rather than views, and call sandbox.showContent() rather than view.render() on changes.
4) Marionette has specialized view types - ItemView renders a single model, CollectionView manages child views in a collection, CompositeView is a hybrid, and LayoutView
Android & Kotlin - The code awakens #03Omar Miatello
A series of 3 events for building apps with Kotlin on Android.
Introduction to Kotlin, a modern language, developed by JetBrains (those who developed the IDE on which is based Android Studio) that compared to Java is more concise, versatile and with better error handling. The code is 100% interoperable with Java, and can be used to write native Android apps or small component.
Groovy is a dynamic language for the Java Virtual Machine that aims to provide a concise, readable syntax with features like closures, metaprogramming and domain-specific language support. Some key features include dynamic typing, operator overloading, builders for generating XML/Swing code and the ability to extend any class or category of objects with additional methods. Groovy aims to be fully interoperable with Java while allowing more compact representations of common patterns.
Slides from talk given at Ithaca Web Group and GORGES on CoffeeScript.
The focus is on explaining to people who haven't tried it yet that it's more than syntactic sugar. There are several real life code examples but they were explained verbally so they may not be super helpful if you don't know CoffeeScript yet.
It's an overview, not a tutorial.
The document discusses the authors' initial naive expectations for using Scala and Clojure compared to their actual experience. They initially thought the languages would solve issues like boilerplate code and Java compiler problems, but found they still had to deal with interoperability, immutability, and other functional programming concepts. In the end, Clojure met more of their needs due to its emphasis on seamless interoperability, traits, and pattern matching.
- The document discusses model-driven testing using "filmstrips" and "snapshots" to generate test cases from models of a system. Filmstrips are sequences of snapshot patterns that represent system states.
- A case study is presented that uses extended use cases with filmstrips to test a hotel booking system. An approach to defining a domain-specific language for filmstrips is also described.
- A demo is presented of a language for testing Java applications using filmstrips to specify test cases and connect them to a Java application and test reporting.
An approach for load-time hacking using LD_PRELOAD is presented.
We discuss a simple, yet intriguing, strategy for overcoming the limitations discussed in Part 1 (i.e., the first publication given in the reference) of reverse engineering and exploitation using LD_PRELOAD, a dynamic linking technique. In particular, we relax the need for exit(1) in the main function. The essence of the technique is that both the stack pointer (esp) and the base frame pointer (ebp) are carefully adjusted when the wrapper to the library function is called. The proposed solution allows us to safely return to libc after dynamically modifying the control flow in the wrapper to (library) functions.
Go uses goroutines and channels for concurrency. Goroutines are lightweight threads that communicate through channels, which are typed queues that allow synchronous message passing. Channels can be used to synchronize access to shared memory, allowing both shared memory and message passing for concurrency. The language is designed for scalable fine-grained concurrency but further improvements are still needed, especially to the goroutine scheduler.
This document contains source code for various components of a Java program that implements grammatical optimization. It includes the main class with the main method that initializes variables and objects. It also includes classes for the genotype, grammar, initializer, and mapper components. The classes define methods for initializing objects, mapping between genotypes and phenotypes, checking validity, and accessing attributes.
The document discusses various methods for reading data from files in Python, including reading the entire file content into a string, reading the file in chunks, reading one line at a time, and reading all lines at once into a list. It demonstrates counting the total number of characters or getting the average line length for a sample haiku file using different reading methods.
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best PracticesJohannes Hoppe
The document provides JavaScript best practices focusing on code quality, avoiding antipatterns like implied globals and eval, and recommendations for style like indentation and naming conventions. It also discusses testing with Jasmine including writing tests, making them pass, refactoring code, and repeating the test-driven development process. Modular code organization techniques like revealing module pattern and event publishing are also covered.
The document provides an overview of functional programming in Java. It discusses functional programming concepts like higher-order functions and avoiding side effects. It gives examples of functional-style code in Java for filtering lists and transforming objects. It also discusses how functional programming can be used to implement customizable business logic by passing functions as parameters and looking up functions through a dependency injection container.
This document summarizes key concepts about strings in Python. It explains that strings are sequences of characters that can be indexed and iterated over like lists. Strings are immutable and concatenated using +. Formatting uses % operator. Escape characters represent special characters. Triple quotes allow multi-line strings. Strings have useful methods like upper(), lower(), find(), replace(), etc. that can be chained together.
The document discusses the history and evolution of testing in Perl from its early days in the 1980s to modern techniques. It covers key topics like the development of Test Anything Protocol (TAP), important testing modules like Test::More, Test::Simple, and tools for testing documentation, code quality, and more. Various commands for running tests are also presented.
This document discusses Python control flow and various looping and conditional structures in Python like while loops, if/elif/else statements, and nested blocks. It provides examples of how while loops can execute zero times if the condition is never true, or forever if the condition is never made false. It also discusses why Python uses indentation rather than braces to define blocks and recommends using 4 spaces of indentation.
Functional programming is all the rage. It can undoubtedly produce cleaner and more expressive code, but why switch to Scala or wait for Java 8? In fact, there are many ways to dramatically improve your Java code quality by using a more functional style today. This presentation discusses how techniques such as functional programming, using fluent APIs, and other clean coding practices can make your code more concise, more readable, and much easier to maintain. But more importantly, you will learn about libraries such as LambdaJ and Google Guava that make this possible today with your existing Java code base.
The document discusses pattern matching in Java. It provides examples of using type patterns to bind variables in if/else statements and instanceof checks. Switch expressions are demonstrated as another way to perform pattern matching by matching on an object's type and extracting variables. The benefits of pattern matching such as conciseness, safety and reducing errors are outlined. It also shows how to handle null values in a switch expression.
Pattern Matching - Small Enhancement or Major Feature? from Developer Week 202🎤 Hanno Embregts 🎸
At first it seemed to be just a small enhancement: the addition of “Pattern Matching for instanceof” (JEP 305) in Java 14. No more unnecessary casting after an instanceof, that ought to save us a few seconds a day! However, upon further investigation you’ll quickly discover that pattern matching is not just an enhancement, but rather a vital puzzle piece in the grander scheme of things.
Why were switch expressions added to Java, for example? To make them support pattern matching in a later release! And why did Java 14 bring us records and will Java 15 contain sealed types? Because they could work really well with pattern matching in a later release! These new concepts are the foundation upon which advanced pattern matching features will be built.
So attend this session to get all caught up! You’ll hear about type patterns, deconstruction patterns, nested patterns and even how pattern matching could improve serialization in the future. Live coding included, of course!
Perl 5.10 introduces several new features including say for easy printing, smart matching with ~~, switch statement, defined-or operator //, and state variables for persistent data within subs. It also includes improvements to the regex engine, modules like Hash::Util::FieldHash, better Windows support and a faster UTF-8 implementation. The release timeline is 5.8.9 stable by April 1st 2006, 5.10 after lunch before Christmas 2006, and Perl 6 after lunch before Christmas 2006.
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.
This document summarizes Hamlet D'Arcy's presentation on AST transformations using tools like Lombok, Groovy, CodeNarc, and Mirah. It discusses how these tools allow manipulating abstract syntax trees to add functionality like automatic property generation, static analysis, and embedded domain-specific languages. Local AST transformations are performed without changing bytecode or requiring new semantics. Type checking can also be added through transformations. Mirah compiles to pure Java classes without additional syntax.
This document summarizes key points about working with Marionette.js views:
1) Views have a lifecycle of initialize(), render(), onRender(), destroy(), with events handled in onRender() rather than render().
2) Templates can be JavaScript functions or require'd .ejs files, with .ejs preferred. getTemplate() provides the view's scope.
3) Listen to model events in index.js rather than views, and call sandbox.showContent() rather than view.render() on changes.
4) Marionette has specialized view types - ItemView renders a single model, CollectionView manages child views in a collection, CompositeView is a hybrid, and LayoutView
Android & Kotlin - The code awakens #03Omar Miatello
A series of 3 events for building apps with Kotlin on Android.
Introduction to Kotlin, a modern language, developed by JetBrains (those who developed the IDE on which is based Android Studio) that compared to Java is more concise, versatile and with better error handling. The code is 100% interoperable with Java, and can be used to write native Android apps or small component.
Groovy is a dynamic language for the Java Virtual Machine that aims to provide a concise, readable syntax with features like closures, metaprogramming and domain-specific language support. Some key features include dynamic typing, operator overloading, builders for generating XML/Swing code and the ability to extend any class or category of objects with additional methods. Groovy aims to be fully interoperable with Java while allowing more compact representations of common patterns.
Slides from talk given at Ithaca Web Group and GORGES on CoffeeScript.
The focus is on explaining to people who haven't tried it yet that it's more than syntactic sugar. There are several real life code examples but they were explained verbally so they may not be super helpful if you don't know CoffeeScript yet.
It's an overview, not a tutorial.
The document discusses the authors' initial naive expectations for using Scala and Clojure compared to their actual experience. They initially thought the languages would solve issues like boilerplate code and Java compiler problems, but found they still had to deal with interoperability, immutability, and other functional programming concepts. In the end, Clojure met more of their needs due to its emphasis on seamless interoperability, traits, and pattern matching.
- The document discusses model-driven testing using "filmstrips" and "snapshots" to generate test cases from models of a system. Filmstrips are sequences of snapshot patterns that represent system states.
- A case study is presented that uses extended use cases with filmstrips to test a hotel booking system. An approach to defining a domain-specific language for filmstrips is also described.
- A demo is presented of a language for testing Java applications using filmstrips to specify test cases and connect them to a Java application and test reporting.
The document discusses implementing domain specific languages (DSLs) using Groovy. It defines DSLs as languages that clearly express the ideas of a particular domain. It outlines several advantages of Groovy for building DSLs, including its flexibility, Java interoperability, and features that support DSL development like introspection, syntactic sugar, and operator overloading. Examples are provided of internal DSLs implemented in Groovy for tasks like querying a database and defining recipes.
Given at GopherFest 2015. This is an updated version of the talk I gave in NYC Nov 14 at GothamGo.
“We need to think about failure differently. Most people think mistakes are a necessary evil. Mistakes aren't a necessary evil, they aren't evil at all. They are an inevitable consequence of doing something new and as such should be seen as valuable. “ - Ed Catmull
As Go is a "new" programming language we are all experimenting and learning how to write better Go. While most presentations focus on the destination, this presentation focuses on the journey of learning Go and the mistakes I personally made while developing Hugo, Cobra, Viper, Afero & Docker.
This document discusses JavaScript and the Dojo toolkit. It emphasizes that JavaScript is very flexible and powerful on its own, beyond just manipulating the DOM. Dojo takes advantage of JavaScript's capabilities by providing utilities like pub/sub, object-oriented programming, function binding, and extending native prototypes. Overall, the key message is that JavaScript can do a lot more than people realize and libraries like Dojo help unlock its full potential.
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...Fwdays
Probably every backend developer had to face the frontend. I am sure that this interaction did not always end without mental trauma. However, today, thanks to Full Stack frameworks, we can forget about this headache, because we have the opportunity to describe and generate a frontend on the PHP side.
The document discusses FuseJS, a JavaScript framework that aims to improve performance and compatibility across browsers. It includes sandboxed native objects to prevent namespace pollution, modular builds, and various selector engines. It also details optimizations for quirks mode, events, caching, and performance benchmarks showing FuseJS has lower execution times than other frameworks.
Ultimate Node.js countdown: the coolest Application Express examplesAlan Arentsen
Node.js is hot and that's not without a reason. There are numerous examples of large websites using Node.js and there is some pretty cool stuff out there.
Since Application Express is officially 'Awesome' and Node.js is 'hot', why not combine the two? With node-oracledb and websockets you can do awesome things, but there is more Node.js has to offer!
In this presentation you will get a short introduction on Node.js. After that I will show you a handful of Node.js applications in Application Express sorted on awesomeness from cool to sub zero.
PHP has its own treasure chest of classic mistakes that surprises even the most seasoned expert : code that dies just by changing its namespace, strpos() that fails to find strings or arrays that changes without touching them.
Do that get on your nerves too ? Let’s make a list of them, so we can always teach them to the new guys, spot them during code reviews and kick them out of our code once and for all. Come on, you’re not frightening us !
Similar to Pattern Matching: From Small Enhancement to Major Feature (talk from JavaLand 2021) (20)
"Will Git Be Around Forever? A List of Possible Successors" from Devoxx 2022🎤 Hanno Embregts 🎸
Ten years ago, only Linux kernel committers and other early adopters used Git. Almost everyone else used Subversion. Ten years later, Git is the most popular product. Which makes me wonder: what will we use another ten years from now? And what features would YOU want from your version control software in 2032? No history rewrites? Faster? No merge conflicts ever?
In this talk I'll discuss a few post-Git products, including Fossil, Plastic and Pijul, and their support for the features we so dearly desire. I'll also try to predict which one will be 'the top dog' in 2032.
So attend this session if you're excited about the future of version control and if you want to have a shot at beating even (!) the early adopters. Now if it turns out I was right, remember that you heard it here first. 😀
"Will Git Be Around Forever? A List of Possible Successors" from FrontMania 2022🎤 Hanno Embregts 🎸
Ten years ago, only Linux kernel committers and other early adopters used Git. Almost everyone else used Subversion. Ten years later, Git is the most popular product. Which makes me wonder: what will we use another ten years from now? And what features would YOU want from your version control software in 2032? No history rewrites? Faster? No merge conflicts ever?
In this talk I'll discuss a few post-Git products, including Fossil, Plastic and Pijul, and their support for the features we so dearly desire. I'll also try to predict which one will be 'the top dog' in 2032.
So attend this session if you're excited about the future of version control and if you want to have a shot at beating even (!) the early adopters. Now if it turns out I was right, remember that you heard it here first. 😀
JCON 2021 talk - "Wil Git Be Around Forever? A List of Possible Successors"🎤 Hanno Embregts 🎸
What source control software did you use in 2010? Possibly Git, if you were an early adopter or a Linux kernel committer. But chances are you were using Subversion, as this was the product of choice for the majority of the software developers. Ten years later, Git is the most popular product. Which makes me wonder: what will we use another ten years from now?
In this talk we will think about what features we want from our source control software in 2030. More speed? Better collaboration support? No merge conflicts ever?
I’ll also discuss a few products that have been published after Git emerged, including Plastic, Fossil and Pijul. I’ll talk about the extent to which they contain the features we so dearly desire and I’ll demonstrate a few typical use cases. To conclude, I’ll try to predict which one will be ‘the top dog’ in 2030 (all information is provided “as is”, no guarantees etc. etc.).
So attend this session if you’re excited about the future of version control and if you want to have a shot at beating even (!) the early adopters. Now if it turns out I was right, remember that you heard it here first.
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG🎤 Hanno Embregts 🎸
What source control software did you use in 2010? Possibly Git, if you were an early adopter or a Linux kernel committer. But chances are you were using Subversion, as this was the product of choice for the majority of the software developers. Ten years later, Git is the most popular product. Which makes me wonder: what will we use another ten years from now?
In this talk we will think about what features we want from our source control software in 2030. More speed? Better collaboration support? No merge conflicts ever?
I’ll also discuss a few products that have been published after Git emerged, including Plastic, Fossil and Pijul. I’ll talk about the extent to which they contain the features we so dearly desire and I’ll demonstrate a few typical use cases. To conclude, I’ll try to predict which one will be ‘the top dog’ in 2030 (all information is provided “as is”, no guarantees etc. etc.).
So attend this session if you’re excited about the future of version control and if you want to have a shot at beating even (!) the early adopters. Now if it turns out I was right, remember that you heard it here first.
Optical Character Recognition has evolved into a mature computer science field, with applications in financial transfers, book digitisation and passport scanning. Now if you would want to add OCR to your Java application, you have lots of options; one of which is Tesseract.
Tesseract has become quite popular amongst software developers because of its accuracy, its open-source status and its active development by Google. By using the Tess4J JNA wrapper it is easily integrated into your Java project.
During this session, I will introduce Tesseract, its pros and cons and how & when to use it. I will compare it to its competitors and I will explain why and how we used it in a case study. To top it off I will live-code a Java application that uses Tesseract and Tess4J to process some example images, so you’ll be able to assess its accuracy for yourself.
Now in geometry, a ‘tesseract’ is the four-dimensional analog of a cube. So will Tesseract live up to its name and help your project to ‘enter the fourth dimension’? Attend this session and find out!
When I return from a conference I am dying to try out the new ideas I brought home and convince my colleagues that we should start using them. Turns out my hard skills only get me *so* far. Soft skills play a vital part in the development of a great product.
We need to be able to motivate people, listen to them and treat them with respect. So how do we get there?
The few things I have learned about soft skills came through improving upon my mistakes and asking other developers about it.
So bring your questions to this meetup and let's see if we can put the 'soft' in software development together.
Beware of Survivorship Bias! (conference talk at J-Fall 2019)🎤 Hanno Embregts 🎸
Most talks on a typical conference schedule contain success stories of technology. This could lead to survivorship bias. Survivorship bias causes you to draw false conclusions because you mostly heard about successes, but hardly ever about failures. Yet failures provide us with lots of valuable knowledge: when not to apply a certain technique, pattern or process.
So no success stories in this talk! Just some ‘silver bullets’ we tried to use to solve our problems, but turned out to be Very Bad Ideas™. We’ll share how survivorship bias can easily influence your ideas and cloud your judgement.
After attending this talk you’ll be more aware of survivorship bias and what you can do to keep your head cool, no matter how many ‘silver bullets’ are fired at you.
Will Git Be Around Forever? A List of Possible Successors🎤 Hanno Embregts 🎸
What source control software did you use in 2008? Possibly Git, if you were an early adopter or a Linux kernel committer. But chances are you were using Subversion, as this was the product of choice for the majority of the software developers. Ten years later, Git is the most popular product. Which makes me wonder: what will we use another ten years from now?
In this talk we will think about what features we want from our source control software in 2028. More speed? Better collaboration support? No merge conflicts ever?
I’ll also discuss a few products that have been published after Git emerged, including Fossil, Veracity and Pijul. I’ll talk about the extent to which they contain the features we so dearly desire and I’ll demonstrate a few typical use cases. To conclude, I’ll try to predict which one will be ‘the top dog’ in 2028 (all information is provided “as is”, no guarantees etc. etc.).
So attend this session if you’re excited about the future of version control and if you want to have a shot at beating even (!) the early adopters. Now if it turns out I was right, remember that you heard it here first.
Entering the Fourth Dimension of OCR with Tesseract - Talk from Voxxed Days B...🎤 Hanno Embregts 🎸
This document provides an overview of optical character recognition (OCR) and the Tesseract OCR engine. It discusses the basics of OCR, the history and development of Tesseract, its features such as character recognition and language support, and advanced topics like reporting confidence, image optimization, and custom training. The document also compares Tesseract to competitors like ABBYY FineReader and Google Cloud Vision in terms of cost, capabilities, and accuracy.
QWERTY or DVORAK? Debunking the Keyboard Layout Myths -- from GeeCON 2018🎤 Hanno Embregts 🎸
If you’re reading this summary on a computer, chances are there is a QWERTY keyboard on your desk. This keyboard layout has been around since 1873, and it has been widely adopted ever since. However, its popularity has always remained a mystery to me. Why is everyone using a keyboard layout that doesn’t look that efficient on first sight? I’m not the only one asking this question. A lot of myths exist on the QWERTY keyboard layout, including the one that it was specifically designed to slow down typists. In preparation for a switch to the DVORAK layout, I did some research and found out that a lot of these myths are riddled with factual errors. Also, I started learning DVORAK and kept track of my progress and what I thought were the pros and cons. So was QWERTY designed to slow us down? Is it feasible to adopt an alternative layout like DVORAK? If so, how long will it take you to learn it, and should everyone consider it? Join this session to have your questions answered, and feel free to bring your keyboard layout of choice. :-)
Building a Spring Boot 2 Application - Ask the Audience! (from Voxxed Days Vi...🎤 Hanno Embregts 🎸
Spring Boot makes it easy to create stand-alone Spring-based applications that you can ‘just run’. It uses a ‘convention over configuration’ approach to get you up and running in no-time. And with the release of Spring Boot 2 in February 2018 all Spring 5.0 features will be available for Spring Boot users, as well as Kotlin support. In this session I will demonstrate this by live-coding a Spring Boot 2 application that will ‘just work’.
But audience beware, this is not your standard ‘live-coding session’. Attendees will have a vital say in the session’s content by defining the application’s requirements. Do you want a simple task planner? Or track your favourite movies? It’s up to you! Should it use MongoDB or JPA? You decide! Built with Java or Kotlin? I don’t care! Do you want an Angular front-end with a RESTful back-end or do you prefer a classic web app with Thymeleaf templates? It’s your call! Seriously.
During the session you get to make these decisions by participating in an online vote. And you will discover that Spring Boot is up to the task no matter what choices you make.
So what are you waiting for? Bring your own device, help shape the application that we’re building and learn lots about Spring Boot in the process.
This session is intended for Java software engineers with an interest in Spring Boot. Some Spring experience could come in handy, but is not strictly necessary. After this session, you will know enough to start your own Spring Boot project.
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)🎤 Hanno Embregts 🎸
Spring Boot is a framework for creating stand-alone, production-grade Spring based applications that can be "run" using java -jar without the need for an external web server. It favors convention over configuration and aims to get developers up and running quickly with minimal configuration. Key features include an embedded web server, automatic configuration, and starters that provide prepackaged dependencies. Pros include faster development and deployment, while potential cons include more complex custom configuration and incompatibility with some legacy Spring projects. The documentation provides guidance on creating starter projects with an initial Java file, build script, and dependencies.
Building a Spring Boot Application - Ask the Audience!🎤 Hanno Embregts 🎸
This document provides an overview of building applications with Spring Boot. It discusses key features such as creating stand-alone Spring applications without separate web servers, automatic Spring configuration, and getting started quickly with one Java file and a build script. Pros include faster deployments and no need for web.xml files. Cons can include custom configuration challenges and incompatibility with some legacy Spring projects. The document also demonstrates sample code and references Spring Initializr for project setups.
If you're reading this summary on a computer, chances are there is a QWERTY keyboard on your desk. This keyboard layout has been around since 1873, and it has been widely adopted ever since. However, its popularity has always remained a mystery to me. Why is everyone using a keyboard layout that doesn't look that efficient on first sight?
I'm not the only one asking this question. A lot of myths exist on the QWERTY keyboard layout, including the one that it was specifically designed to slow down typists. In preparation for a switch to the DVORAK layout, I did some research and found out that a lot of these myths are riddled with factual errors. Also, I started learning DVORAK and kept track of my progress and what I thought were the pros and cons.
So was QWERTY designed to slow us down? Is it feasible to adopt an alternative layout like DVORAK? If so, how long will it take you to learn it, and should everyone consider it? Join this session to have your questions answered, and feel free to bring your keyboard layout of choice. :-)
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)🎤 Hanno Embregts 🎸
Spring Boot makes it easy to create stand-alone Spring-based application that you can 'just run'. It uses a 'convention over configuration' approach to get you up and running in no-time, while offering all Spring features that you have grown fond of in the past years. In this session this is demonstrated by live-coding a Spring Boot application that will just work.
But audience beware, this is not your standard live-coding session'. Attendees will have a vital say in the session's content by defining the applications requ irements. Should it be an app to track your kitchen cupboard contents or do you want a simple task planner? It's up to you! Should it use MongoDB or Couchbase? You decide! Do you want an AngularJS front-end with a RESTful backend or do you prefer a classic web app with Thymeleaf templates? It's your call! Seriously.
During the session you get to make these decisions by participating in an online vote. And you will discover that Spring Boot is up to the task no matter what choices you make.
So what are you waiting for? Bring your own device, help shape the application that we're building and learn lots about Spring Boot in the process.
This session is intended for Java software engineers with an interest in Spring Boot. Some Spring experience could come in handy, but is not strictly necessary. After this session, you will know enough to start your own Spring Boot project.
Most developers prefer to spend their time writing code instead of performing build script maintenance. Build scripting may be an essential part of the software development process, but it often lacks maintainability which makes applying and deploying changes a tedious job. So it’s important to make sure your build system encourages simplicity and that changes can be made in a fast and straightforward way. Industry standards Ant and Maven are not quite up to the task; Gradle is a better alternative.
This presentation introduces Gradle – a modern build system that supports all JVM Languages – and shares the result of the Ant-to-Gradle migration that was performed at NS (Dutch Railways). The session will focus on the challenges we faced while trying to replace Ant scripting with the Gradle equivalent and how we handled them.
After attending this session, you will have a good understanding of Gradle and its pros and cons compared to Ant and Maven. On top of that, you will be able to migrate your own project to Gradle, even if your project has a huge code base or relies on ancient technologies. The lessons we learnt at NS could be very helpful to your own situation.
Malibou Pitch Deck For Its €3M Seed Roundsjcobrien
French start-up Malibou raised a €3 million Seed Round to develop its payroll and human resources
management platform for VSEs and SMEs. The financing round was led by investors Breega, Y Combinator, and FCVC.
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfVALiNTRY360
Salesforce Healthcare CRM, implemented by VALiNTRY360, revolutionizes patient management by enhancing patient engagement, streamlining administrative processes, and improving care coordination. Its advanced analytics, robust security, and seamless integration with telehealth services ensure that healthcare providers can deliver personalized, efficient, and secure patient care. By automating routine tasks and providing actionable insights, Salesforce Healthcare CRM enables healthcare providers to focus on delivering high-quality care, leading to better patient outcomes and higher satisfaction. VALiNTRY360's expertise ensures a tailored solution that meets the unique needs of any healthcare practice, from small clinics to large hospital systems.
For more info visit us https://valintry360.com/solutions/health-life-sciences
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
E-commerce Development Services- Hornet DynamicsHornet Dynamics
For any business hoping to succeed in the digital age, having a strong online presence is crucial. We offer Ecommerce Development Services that are customized according to your business requirements and client preferences, enabling you to create a dynamic, safe, and user-friendly online store.
UI5con 2024 - Bring Your Own Design SystemPeter Muessig
How do you combine the OpenUI5/SAPUI5 programming model with a design system that makes its controls available as Web Components? Since OpenUI5/SAPUI5 1.120, the framework supports the integration of any Web Components. This makes it possible, for example, to natively embed own Web Components of your design system which are created with Stencil. The integration embeds the Web Components in a way that they can be used naturally in XMLViews, like with standard UI5 controls, and can be bound with data binding. Learn how you can also make use of the Web Components base class in OpenUI5/SAPUI5 to also integrate your Web Components and get inspired by the solution to generate a custom UI5 library providing the Web Components control wrappers for the native ones.
Unveiling the Advantages of Agile Software Development.pdfbrainerhub1
Learn about Agile Software Development's advantages. Simplify your workflow to spur quicker innovation. Jump right in! We have also discussed the advantages.
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
Transform Your Communication with Cloud-Based IVR SolutionsTheSMSPoint
Discover the power of Cloud-Based IVR Solutions to streamline communication processes. Embrace scalability and cost-efficiency while enhancing customer experiences with features like automated call routing and voice recognition. Accessible from anywhere, these solutions integrate seamlessly with existing systems, providing real-time analytics for continuous improvement. Revolutionize your communication strategy today with Cloud-Based IVR Solutions. Learn more at: https://thesmspoint.com/channel/cloud-telephony
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
13. Type pattern
Type pattern
Type pattern
Type pattern
Type pattern
Consists of a predicate that speci es
a type, along with a single binding
variable.
https://www.pexels.com/photo/person-holding-white-chalk-625219/
14. Pattern matching
Pattern matching
Pattern matching
Pattern matching
Pattern matching
Allows the conditional extraction of
components from objects to be
expressed more concisely and safely.
https://www.pexels.com/photo/person-holding-white-chalk-625219/
15. Declaring 'in the
Declaring 'in the
middle'
middle'
if (product instanceof Guitar lesPaul) {
// use lesPaul
}
1
2
3
16. Scoping
Scoping
'Regular' local variable ('block scoping')
'Regular' local variable ('block scoping')
The block in which it is declared.
void playTunedGuitar() {
Guitar lesPaul = new Guitar("Les Paul");
if (!lesPaul.isInTune()) {
Guitar fenderStrat = new Guitar("Fender Stratocaster");
fenderStrat.play();
}
}
1
2
3
4
5
6
7
8
17. Scoping
Scoping
'Regular' local variable ('block scoping')
'Regular' local variable ('block scoping')
The block in which it is declared.
void playTunedGuitar() {
Guitar lesPaul = new Guitar("Les Paul");
if (!lesPaul.isInTune()) {
Guitar fenderStrat = new Guitar("Fender Stratocaster");
fenderStrat.play();
// fenderStrat is in scope
}
// fenderStrat is not in scope
}
1
2
3
4
5
6
7
8
9
10
18. Scoping
Scoping
Pattern binding variable (' ow scoping')
Pattern binding variable (' ow scoping')
The set of places where it would de nitely be
assigned.
if (product instanceof Guitar lesPaul) {
// can use lesPaul here
} else {
// can't use lesPaul here
}
1
2
3
4
5
19. Scoping
Scoping
Pattern binding variable (' ow scoping')
Pattern binding variable (' ow scoping')
The set of places where it would de nitely be
assigned.
if (product instanceof Guitar lesPaul && lesPaul.isInTune()) {
// can use lesPaul here
} else {
// can't use lesPaul here
}
1
2
3
4
5
20. Scoping
Scoping
Pattern binding variable (' ow scoping')
Pattern binding variable (' ow scoping')
The set of places where it would de nitely be
assigned.
boolean isTunedGuitar(Object product) {
if (!(product instanceof Guitar lesPaul)) {
return false;
}
return lesPaul.isInTune();
}
1
2
3
4
5
6
7
21. Scoping
Scoping
Pattern binding variable (' ow scoping')
Pattern binding variable (' ow scoping')
The set of places where it would de nitely be
assigned.
boolean isTunedGuitar(Object product) {
if (!(product instanceof Guitar lesPaul)) {
return false;
}
// This code is only reachable if 'product' is
// a Guitar, so 'lesPaul' is in scope.
return lesPaul.isInTune();
}
1
2
3
4
5
6
7
8
9
22.
23. Scoping
Scoping
Pattern binding variable (' ow scoping')
Pattern binding variable (' ow scoping')
The set of places where it would de nitely be
assigned.
void test(Effect effect) {
if (effect instanceof Reverb stockEffect)
stockEffect.setRoomSize(25);
else if (effect instanceof Delay stockEffect)
stockEffect.setTimeInMs(200);
}
1
2
3
4
5
6
24.
25. Demo
Demo
Simplify implementation of equals
Loop through a set of Effects and apply 'pattern
matching for instanceof'
https://pxhere.com/en/photo/1458897
26. Bene ts
Bene ts
Nearly 100% of casts will just disappear!
More concise
Eliminates cut/paste errors
27. instanceof
instanceof grammar
grammar
The
The instanceof
instanceof grammar is extended accordingly:
grammar is extended accordingly:
RelationalExpression instanceof Pattern
Pattern:
ReferenceType Identifier
RelationalExpression:
1
...
2
RelationalExpression instanceof ReferenceType
3
4
5
6
7
https://openjdk.java.net/jeps/305
28. It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
type pattern
Guitar lesPaul
https://www.pexels.com/photo/gray-metal-statue-of-man-raising-hand-near-dock-825430/
30. Why so serious?
Why so serious?
Surely a less invasive approach exists?
Flow typing has been considered.
It infers re ned types based on past conditionals.
But... it is suited for instanceof checks only.
And pattern matching can be useful for more
language concepts!
https://pxhere.com/en/photo/835435
39. Switch expression
Switch expression
case Delay de -> String.format("Delay active of %d ms.",
case Reverb re -> String.format("Reverb active of type %s
String apply(Effect effect) {
1
return switch(effect) {
2
3
4
default -> String.format("Unknown effect active: %s
5
};
6
}
7
40. Switch expression
Switch expression
case Overdrive ov -> String.format("Overdrive active with ga
case Tremolo tr -> String.format("Tremolo active with depth
case Tuner tu -> String.format("Tuner active with pitch
String apply(Effect effect) {
1
return switch(effect) {
2
case Delay de -> String.format("Delay active of %d ms.",
3
case Reverb re -> String.format("Reverb active of type %s
4
5
6
7
default -> String.format("Unknown effect active: %
8
};
9
}
10
41. Switch expression
Switch expression
case EffectLoop el -> el.getEffects().stream().map(this::apply
String apply(Effect effect) {
1
return switch(effect) {
2
case Delay de -> String.format("Delay active of %d ms.",
3
case Reverb re -> String.format("Reverb active of type %s
4
case Overdrive ov -> String.format("Overdrive active with ga
5
case Tremolo tr -> String.format("Tremolo active with depth
6
case Tuner tu -> String.format("Tuner active with pitch
7
8
default -> String.format("Unknown effect active: %
9
};
10
}
11
42. Switch expression
Switch expression
String apply(Effect effect) {
return switch(effect) {
case Delay de -> String.format("Delay active of %d ms.",
case Reverb re -> String.format("Reverb active of type %s
case Overdrive ov -> String.format("Overdrive active with ga
case Tremolo tr -> String.format("Tremolo active with depth
case Tuner tu -> String.format("Tuner active with pitch
case EffectLoop el -> el.getEffects().stream().map(this::apply
default -> String.format("Unknown effect active: %
};
}
1
2
3
4
5
6
7
8
9
10
11
43. Bene ts
Bene ts
A single expression instead of many assignments
Less error-prone (in adding cases)
More concise
Safer - the compiler can check for missing cases
47. It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
constant pattern
GuitarType.TELECASTER
https://www.pexels.com/photo/gray-metal-statue-of-man-raising-hand-near-dock-825430/
49. Why so serious?
Why so serious?
Surely a less invasive approach exists?
Type switching has been considered.
It enables case labels to specify types, as well as
constants.
But... it is suited for switch statements only.
And pattern matching can be useful for more
language concepts!
https://pxhere.com/en/photo/835435
51. Here be dragons!
Here be dragons!
Here be dragons!
Here be dragons!
Here be dragons!
We can't be sure at all that the
following features will appear in Java
as depicted. They can change a lot in
the meantime.
https://www.pexels.com/photo/dragon-festival-during-nighttime-6068535/
52. Deconstruction patterns
Deconstruction patterns
String apply(Effect effect) {
return switch(effect) {
case Delay de -> String.format("Delay active of %d ms.",
case Reverb re -> String.format("Reverb active of type %s
case Overdrive ov -> String.format("Overdrive active with ga
case Tremolo tr -> String.format("Tremolo active with depth
case Tuner tu -> String.format("Tuner active with pitch
case EffectLoop el -> el.getEffects().stream().map(this::apply
default -> String.format("Unknown effect active: %
};
}
1
2
3
4
5
6
7
8
9
10
11
53. Deconstruction patterns
Deconstruction patterns
case Overdrive(int gain) -> String.format("Overdrive active w
String apply(Effect effect) {
1
return switch(effect) {
2
case Delay de -> String.format("Delay active of %d ms.",
3
case Reverb re -> String.format("Reverb active of type %s
4
5
case Tremolo tr -> String.format("Tremolo active with depth
6
case Tuner tu -> String.format("Tuner active with pitch
7
case EffectLoop el -> el.getEffects().stream().map(this::apply
8
default -> String.format("Unknown effect active: %
9
};
10
}
11
54. Pattern de nition
Pattern de nition
public class Overdrive implements Effect {
private final int gain;
public Overdrive(int gain) {
this.gain = gain;
}
}
1
2
3
4
5
6
7
55. Pattern de nition
Pattern de nition
public pattern Overdrive(int gain) {
gain = this.gain;
}
public class Overdrive implements Effect {
1
private final int gain;
2
3
public Overdrive(int gain) {
4
this.gain = gain;
5
}
6
7
8
9
10
}
11
56. Deconstruction patterns
Deconstruction patterns
case Overdrive(int gain) -> String.format("Overdrive active w
String apply(Effect effect) {
1
return switch(effect) {
2
case Delay de -> String.format("Delay active of %d ms.",
3
case Reverb re -> String.format("Reverb active of type %s
4
5
case Tremolo tr -> String.format("Tremolo active with depth
6
case Tuner tu -> String.format("Tuner active with pitch
7
case EffectLoop el -> el.getEffects().stream().map(this::apply
8
default -> String.format("Unknown effect active: %
9
};
10
}
11
57. Deconstruction patterns
Deconstruction patterns
String apply(Effect effect) {
return switch(effect) {
case Delay(int timeInMs) -> String.format("Delay active of %d
case Reverb(String name, int roomSize) -> String.format("Reve
case Overdrive(int gain) -> String.format("Overdrive active w
case Tremolo(int depth, int rate) -> String.format("Tremolo ac
case Tuner(int pitchInHz) -> String.format("Tuner active with
case EffectLoop(Set<Effect> effects) -> effects.stream().map(t
default -> String.format("Unknown effect active: %s.", effect
};
}
1
2
3
4
5
6
7
8
9
10
11
61. Var and any patterns
Var and any patterns
// Pre-Java 10
Guitar telecaster = new Guitar("Fender Telecaster Baritone Blacktop", G
// Java 10
var telecaster = new Guitar("Fender Telecaster Baritone Blacktop", Gui
1
2
3
4
5
https://openjdk.java.net/jeps/286
62. Var and any patterns
Var and any patterns
static boolean containsReverbAndDelayWithEqualProperties(EffectLoop ef
if (effectLoop instanceof EffectLoop(Delay(int timeInMs), Reverb(St
return timeInMs == roomSize;
}
return false;
}
1
2
3
4
5
6
63. Var and any patterns
Var and any patterns
if (effectLoop instanceof EffectLoop(Delay(var timeInMs), Reverb(v
static boolean containsReverbAndDelayWithEqualProperties(EffectLoop ef
1
2
return timeInMs == roomSize;
3
}
4
return false;
5
}
6
65. Var and any patterns
Var and any patterns
static boolean containsReverbAndDelayWithEqualProperties(EffectLoop ef
if (effectLoop instanceof EffectLoop(Delay(var timeInMs), Reverb(_
return timeInMs == roomSize;
}
return false;
}
1
2
3
4
5
6
66. Optimization
Optimization
String apply(Effect effect) {
return switch(effect) {
case Delay(int timeInMs) -> String.format("Delay active of %d
case Reverb(String name, int roomSize) -> String.format("Reve
case Overdrive(int gain) -> String.format("Overdrive active w
case Tremolo(int depth, int rate) -> String.format("Tremolo ac
case Tuner(int pitchInHz) -> String.format("Tuner active with
case EffectLoop(Set<Effect> effects) -> effects.stream().map(t
default -> String.format("Unknown effect active: %s.", effect
};
}
1
2
3
4
5
6
7
8
9
10
11
69. Bene ts
Bene ts
Better encapsulation
a case branch only receives data that it actually references.
More elegant logic
by using pattern composition
Optimization
through the use of any patterns
70. It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
deconstruction pattern
Delay(int timeInMs)
https://www.pexels.com/photo/gray-metal-statue-of-man-raising-hand-near-dock-825430/
71. It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
var pattern
var timeInMs
https://www.pexels.com/photo/gray-metal-statue-of-man-raising-hand-near-dock-825430/
72. It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
It's a kind of Pattern
any pattern
_
https://www.pexels.com/photo/gray-metal-statue-of-man-raising-hand-near-dock-825430/
74. Pattern Matching Plays
Pattern Matching Plays
Nice With
Nice With
Sealed Types
Sealed Types
Sealed Types
Sealed Types
Sealed Types
and Records
and Records
and Records
and Records
and Records
https://pxhere.com/en/photo/752901
75. Demo
Demo
Convert e ect classes to a record
Acquire constructor, accessor methods etc.
https://pxhere.com/en/photo/1458897
77. Records
Records
Input:
Input:
Commit to the class being a transparent carrier for
its data.
Output:
Output:
constructors
accessor methods
equals()-implementation
hashCode()-implementation
toString()-implementation
deconstruction pattern
78. Demo
Demo
Make Effect a sealed type
Make subclasses final, sealed or non sealed
https://pxhere.com/en/photo/1458897
79. Exhaustiveness
Exhaustiveness
String apply(Effect effect) {
return switch(effect) {
case Delay(int timeInMs) -> String.format("Delay active of %d
case Reverb(String name, int roomSize) -> String.format("Reve
case Overdrive(int gain) -> String.format("Overdrive active w
case Tremolo(int depth, int rate) -> String.format("Tremolo ac
case Tuner(int pitchInHz) -> String.format("Tuner active with
case EffectLoop(Tuner(int pitchInHz), _) -> String.format("The
case EffectLoop(Set<Effect> effects) -> effects.stream().map(t
default -> String.format("Unknown effect active: %s.", effect
};
}
1
2
3
4
5
6
7
8
9
10
11
12
80. Exhaustiveness
Exhaustiveness
String apply(Effect effect) {
return switch(effect) {
case Delay(int timeInMs) -> String.format("Delay active of %d
case Reverb(String name, int roomSize) -> String.format("Reve
case Overdrive(int gain) -> String.format("Overdrive active w
case Tremolo(int depth, int rate) -> String.format("Tremolo ac
case Tuner(int pitchInHz) -> String.format("Tuner active with
case EffectLoop(Tuner(int pitchInHz), _) -> String.format("The
case EffectLoop(Set<Effect> effects) -> effects.stream().map(t
};
}
1
2
3
4
5
6
7
8
9
10
11
https://cr.openjdk.java.net/~briangoetz/amber/pattern-match.html
82. Feature Status
Feature Status
Sealed Types
Sealed Types
Java version Feature status JEP
15 Preview
16 Second preview
17 Final ...
JEP 360
JEP 397
83. A Better
A Better
A Better
A Better
A Better
Serialization
Serialization
Serialization
Serialization
Serialization
?
?
?
?
?
84. Here be dragons!
Here be dragons!
Here be dragons!
Here be dragons!
Here be dragons!
We can't be sure at all that the
following features will appear in Java
as depicted. They can change a lot in
the meantime.
https://www.pexels.com/photo/dragon-festival-during-nighttime-6068535/
86. Serialization
Serialization
very important feature
but many people hate its current implementation
Drawbacks
Drawbacks
it undermines the accessibility model
serialization logic is not 'readable code'
it bypasses constructors and data validation
87. Serialization
Serialization
public class EffectLoop implements Effect {
private String name;
private Set<Effect> effects;
public EffectLoop(String name) {
this.name = name;
this.effects = new HashSet<>();
}
}
1
2
3
4
5
6
7
8
9
88. Serialization
Serialization
public pattern EffectLoop(String name, Effect[] effects) {
name = this.name;
effects = this.effects.toArray();
}
public class EffectLoop implements Effect {
1
private String name;
2
private Set<Effect> effects;
3
4
public EffectLoop(String name) {
5
this.name = name;
6
this.effects = new HashSet<>();
7
}
8
9
10
11
12
13
}
14
89. Serialization
Serialization
public static Effectloop deserialize(String name, Effect[] effect
EffectLoop effectLoop = new EffectLoop(name);
for (Effect effect : effects) {
this.effects.add(effect);
}
return effectLoop;
public class EffectLoop implements Effect {
1
private String name;
2
private Set<Effect> effects;
3
4
public EffectLoop(String name) {
5
this.name = name;
6
this.effects = new HashSet<>();
7
}
8
9
10
11
12
13
14
15
}
16
90. Serialization
Serialization
public class EffectLoop implements Effect {
private String name;
private Set<Effect> effects;
public EffectLoop(String name) {
this.name = name;
this.effects = new HashSet<>();
}
@Deserializer
public static Effectloop deserialize(String name, Effect[] effect
EffectLoop effectLoop = new EffectLoop(name);
for (Effect effect : effects) {
this.effects.add(effect);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
91. Some challenges remain
Some challenges remain
Q:
Q: How to support multiple versions of one class?
How to support multiple versions of one class?
A: @Serializer and @Deserializer annotations
could get a property version in the future.
94. Here be super dragons!
Here be super dragons!
Here be super dragons!
Here be super dragons!
Here be super dragons!
We can't be sure that the following
features will appear in Java as
depicted, if at all.
Proceed with caution!
https://www.pexels.com/photo/dragon-festival-during-nighttime-6068535/
95. Pattern bind statements
Pattern bind statements
var reverb = new Reverb("ChamberReverb", 2);
__let Reverb(String name, int roomSize) = reverb;
// do something with name & roomSize
1
2
3
4
5
https://cr.openjdk.java.net/~briangoetz/amber/pattern-match.html
96. Pattern bind statements
Pattern bind statements
else throw new IllegalArgumentException("not a Reverb!");
var reverb = new Reverb("ChamberReverb", 2);
1
2
__let Reverb(String name, int roomSize) = reverb;
3
4
5
// do something with name & roomSize
6
97. Guards
Guards
String apply(Effect effect, Guitar guitar) {
1
return switch(effect) {
2
// (...)
3
case Tremolo tr-> String.format("Tremolo active with depth %d
4
case Tuner tu -> String.format("Tuner active with pitch %d. Mut
5
case EffectLoop el -> el.getEffects().stream().map(this::apply
6
default -> String.format("Unknown effect active: %s.", effect)
7
};
8
}
9
https://openjdk.java.net/jeps/8213076
98. Guards
Guards
case Tuner tu && !tu.isInTune(guitar) -> String.format("Guitar
String apply(Effect effect, Guitar guitar) {
1
return switch(effect) {
2
// (...)
3
case Tremolo tr-> String.format("Tremolo active with depth %d
4
5
case EffectLoop el -> el.getEffects().stream().map(this::apply
6
default -> String.format("Unknown effect active: %s.", effect)
7
};
8
}
9
99. Other ideas
Other ideas
Array patterns
Varargs patterns
AND patterns
Patterns in catch clauses
Collection patterns
Record patterns
https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-January/002758.html
101. Pattern Kinds
Pattern Kinds
Pattern kind Example Purpose
type pattern Guitar lesPaul Perform an instanceof test,
cast the target, and bind it
to a pattern variable.
constant
pattern
GuitarType.TELECASTER Test the target for equality
with a constant.
deconstruction
pattern
Delay(int timeInMs) Perform an instanceof test,
cast the target, destructure
the target and recursively
match the components to
subpatterns.
var pattern var timeInMs Match anything and bind its
target.
any pattern _ Match anything, but bind
nothing.
102. Pattern Contexts
Pattern Contexts
Pattern
context
Example Purpose
instanceof
predicate
product instanceof
Guitar guitar
Test if target matches the
indicated pattern.
switch
statement or
expression
switch (effect) {
case Delay d
}
Test if target matches one
(or more) of the indicated
patterns.
bind
statement
let Reverb(var
name, var roomSize) =
reverb;
Destructure a target using a
pattern.
104. Pattern matching...
Pattern matching...
is a rich feature arc that will play out over several
versions.
allows us to use type patterns in instanceof.
improves switch expressions.
makes destructuring objects as easy (and more
similar to) constructing them.
holds the potential to simplify and streamline much
of the code we write today.