Ten common mistakes made with Functional Java JBCNConf18Brian Vermeer
Slides from my talk "Ten common mistakes made with Functional Java" @ JBCNConf 2018 Barcelona.
Beware that the slides are just here as a reference to people who attended this particular version of the talk. Please do not make assumptions purely from the slides alone ... there is a story with it ...really ;)
Ten common mistakes made in Function JavaBrian Vermeer
1. Ten common mistakes made when using Functional Java are: doing too much in a single lambda expression, mutating objects, returning streams instead of collecting them, not consuming streams, overusing forEach, incorrect order of stream operations, infinite streams, unpacking Optionals incorrectly, not handling exceptions properly, and not using alternative flows for Optionals like orElse and orElseGet.
2. Some ways to avoid these mistakes include breaking lambda expressions into smaller functions, returning copies of objects instead of mutating, collecting streams after operations, consuming all streams, using intermediate and terminal operations appropriately, and wrapping checked exceptions.
Ten common mistakes made in Function Java - iSense Java SummitBrian Vermeer
The document discusses 10 common mistakes made when using functions and streams in Java. It covers issues such as doing too much in a lambda expression, mutating objects in streams, not consuming streams, incorrect ordering of stream operations, and improperly unpacking Optional values. Examples are provided to illustrate correct usage and avoid the mistakes.
The document discusses functional programming concepts in Java, including lambda expressions, streams, and immutable objects. It provides examples of using lambda expressions to pass functions as arguments. It emphasizes that streams should not mutate objects and explains how to return new copies instead. It also discusses avoiding side effects with forEach and creating higher-order functions to reduce duplicate code.
1. Common mistakes when using functional Java include doing too much in a single lambda expression, mutating objects within streams which are immutable, and overusing forEach which should be avoided.
2. When working with optionals, it is important to unpack them before use rather than accessing the value directly, and methods like orElse, orElseGet, and orElseThrow can be used to define alternative flows.
3. When working with streams of optionals, flatMap can be used to flatten the stream.
Common mistakes made with Functional JavaBrian Vermeer
1. Common mistakes when using Functional Java include doing too much in a single lambda expression, using block lambdas when a method would be better, and mutating objects within streams.
2. Streams should not be used to mutate objects and can only be operated on once. It is better to return new copies of objects rather than mutating them.
3. ForEach should be avoided for anything other than side effects, and infinite streams need limiting to avoid running forever.
4. Optionals force unpacking values and calling get without checking for empty can cause exceptions.
1. Common mistakes with Functional Java include doing too much in a single lambda, using block lambdas when a method would be better, mutating objects within streams, and not consuming streams.
2. Streams are lazy and should not be reused or mutate objects. It is better to return new copies of objects from streams.
3. Overusing forEach can indicate an opportunity to use more functional techniques.
4. With Optionals, always unpack values before using them and consider alternative flows like orElse and orElseGet.
The document discusses 10 common mistakes made when using functions in Java, including: doing too much in a single lambda expression; using block lambdas instead of transforming them to methods; not consuming streams; mutating objects in streams; overusing forEach; incorrect order of stream operations; creating infinite streams; and improperly unpacking Optional values.
Ten common mistakes made with Functional Java JBCNConf18Brian Vermeer
Slides from my talk "Ten common mistakes made with Functional Java" @ JBCNConf 2018 Barcelona.
Beware that the slides are just here as a reference to people who attended this particular version of the talk. Please do not make assumptions purely from the slides alone ... there is a story with it ...really ;)
Ten common mistakes made in Function JavaBrian Vermeer
1. Ten common mistakes made when using Functional Java are: doing too much in a single lambda expression, mutating objects, returning streams instead of collecting them, not consuming streams, overusing forEach, incorrect order of stream operations, infinite streams, unpacking Optionals incorrectly, not handling exceptions properly, and not using alternative flows for Optionals like orElse and orElseGet.
2. Some ways to avoid these mistakes include breaking lambda expressions into smaller functions, returning copies of objects instead of mutating, collecting streams after operations, consuming all streams, using intermediate and terminal operations appropriately, and wrapping checked exceptions.
Ten common mistakes made in Function Java - iSense Java SummitBrian Vermeer
The document discusses 10 common mistakes made when using functions and streams in Java. It covers issues such as doing too much in a lambda expression, mutating objects in streams, not consuming streams, incorrect ordering of stream operations, and improperly unpacking Optional values. Examples are provided to illustrate correct usage and avoid the mistakes.
The document discusses functional programming concepts in Java, including lambda expressions, streams, and immutable objects. It provides examples of using lambda expressions to pass functions as arguments. It emphasizes that streams should not mutate objects and explains how to return new copies instead. It also discusses avoiding side effects with forEach and creating higher-order functions to reduce duplicate code.
1. Common mistakes when using functional Java include doing too much in a single lambda expression, mutating objects within streams which are immutable, and overusing forEach which should be avoided.
2. When working with optionals, it is important to unpack them before use rather than accessing the value directly, and methods like orElse, orElseGet, and orElseThrow can be used to define alternative flows.
3. When working with streams of optionals, flatMap can be used to flatten the stream.
Common mistakes made with Functional JavaBrian Vermeer
1. Common mistakes when using Functional Java include doing too much in a single lambda expression, using block lambdas when a method would be better, and mutating objects within streams.
2. Streams should not be used to mutate objects and can only be operated on once. It is better to return new copies of objects rather than mutating them.
3. ForEach should be avoided for anything other than side effects, and infinite streams need limiting to avoid running forever.
4. Optionals force unpacking values and calling get without checking for empty can cause exceptions.
1. Common mistakes with Functional Java include doing too much in a single lambda, using block lambdas when a method would be better, mutating objects within streams, and not consuming streams.
2. Streams are lazy and should not be reused or mutate objects. It is better to return new copies of objects from streams.
3. Overusing forEach can indicate an opportunity to use more functional techniques.
4. With Optionals, always unpack values before using them and consider alternative flows like orElse and orElseGet.
The document discusses 10 common mistakes made when using functions in Java, including: doing too much in a single lambda expression; using block lambdas instead of transforming them to methods; not consuming streams; mutating objects in streams; overusing forEach; incorrect order of stream operations; creating infinite streams; and improperly unpacking Optional values.
This document provides an overview of Flask-SQLAlchemy, which is an extension for Flask that adds support for SQLAlchemy to Flask applications. It covers basics like setting up a Flask-SQLAlchemy application, defining models, and performing CRUD operations. It also discusses more advanced topics like relationships between models, using the ORM vs manual mapping, and using the underlying SQLAlchemy API. The document includes numerous code examples to illustrate the concepts.
This document provides an overview of the Overpass API and Overpass-turbo. It discusses how to set up an Overpass API instance, including compiling and installing OSM-3S, generating and updating the database, configuring Apache2, and installing Overpass-Turbo. It also provides examples of Overpass QL queries and describes capabilities like filtering, selecting related objects, and output formats.
Java 8: the good, the bad and the ugly (JBCNConf 2017)Brian Vermeer
This document provides an overview and summary of key features in Java 8, including:
- Lambda expressions which allow implementation of functional interfaces in a more concise way
- Default methods which allow extension of interfaces without breaking existing implementations
- Streams API which supports functional-style operations on streams of elements
- Date and time API improvements with new java.time package
- Optional as a container class for nullable values
The document discusses techniques for using SQLite databases in iOS applications. Some key points covered include:
SQLite is a file-based, lightweight database that is well suited for mobile applications. The pure C API can be difficult to use directly, so it's best to abstract it away. The document reviews methods for opening and copying databases, executing queries using the SQLite API, and using prepared statements.
Slides of my talk I gave @ PyRE.it in ReggioEmilia about developing a Rest Api in Python using a little bit of Flask and SqlAlchemy.
www.pyre.it
www.alessandrocucci.it/pyre/restapi
2005_Structures and functions of MakefileNakCheon Jung
The document discusses the structure and functions of the Linux kernel Makefile. It describes the top-level Makefile and how it builds the kernel image (vmlinux) and modules. It explains the roles of the .config file, architecture Makefiles, Script/Makefile and various Kbuild Makefiles. Key files like obj-y, obj-m and lib-y goals are identified. The document provides an overview of who develops different parts of the kernel build system and lists some important Kbuild files.
Java 8: the good, the bad and the ugly (Oracle Code Brussels 2017)Brian Vermeer
This document summarizes key features of Java 8 including lambdas, functional interfaces, streams, and optional. It discusses lambda expressions and how they allow implementing functional interfaces more concisely. Streams are introduced as a way to process collections lazily and in parallel. Exceptions in lambdas and streams are covered. Optional is presented as a wrapper for null values. Best practices are provided around these new Java 8 features.
Smolder is a web-based continuous integration smoke server that uses the Test Anything Protocol (TAP) format for test reporting. It supports multiple notification channels like email and ATOM and stores test results in a SQLite or MySQL database. Tests can be run on Smolder using CGI::Application or Plack and results can be uploaded from the command line using a script that communicates with the Smolder server API.
This document summarizes server-side and client-side testing approaches and tools. It then introduces TRunner, an open source test runner tool inspired by Selenium and inspired to support converting HTML test suites to YAML format. The document demonstrates using TRunner, including its file structure and how to fork and use it to run own test suites.
This document summarizes how to use a pre-commit hook with SVN to check code for syntax and coding standards before committing. The hook runs PHPCodeSniffer on files being committed, catching output to parse for errors. It addresses issues like having no local files by using a PHP stream wrapper to access file contents from the SVN repository instead of temporary files.
This document provides an overview of setting up a Flask application with common extensions for functionality like user authentication, database management, forms validation, and sending email. It demonstrates initializing extensions like Flask-SQLAlchemy, Flask-Login, Flask-Migrate, Flask-Script, and Flask-Mail. Models and views are defined to handle user registration and login. The Flask application is configured and commands are provided to initialize the database, run migrations, and start a development server.
- perl provides many command line switches to control how a Perl script is executed or the input/output behavior. Some key switches include -n, -p, -l, -e, -M, -I, -V, and -E.
- Special variables like $. and eof can be used to access the current line number or detect the end of input files when iterating over lines.
- Modules can be loaded at startup using -M to enhance functionality, and %INC shows where modules were loaded from.
- Various quoting mechanisms like qq can be used to specify strings without interpolation.
This document discusses Flask, a Python-based web application framework. It provides an overview of Flask fundamentals like backend development, virtual environments, routes, templates, and error handling. It also covers additional Flask features like extensions, MongoDB integration, and building REST APIs. The document uses code samples and file structure examples to demonstrate how to structure and deploy a Flask application on Heroku.
This document provides examples of using LogMiner to analyze and query redo logs in an Oracle database. It demonstrates how to configure supplemental logging, add redo log files to a LogMiner session, start LogMiner with different dictionary and filtering options, and query LogMiner views to see SQL statements that were executed.
This document provides an overview of Java versions from Java 5 through Java 9 and introduces key features of Java 8 such as lambda expressions, functional interfaces, and streams. The document discusses how lambda expressions allow for more concise implementation of interfaces like Comparator compared to Java 7. It also covers optional, exceptions in lambda expressions, and best practices for writing lambda expressions and using streams in Java 8.
The document provides information about debugging Ruby on Rails applications using the debugger gem. It discusses setting breakpoints, navigating the debugger, examining variables and program state, conditional breakpoints, remote debugging, and integrating the debugger with Pry. Logging and examining logs is also covered.
This document summarizes some new features in PHP 5.4:
- Array syntax can now be written more concisely using square brackets instead of array functions.
- PHP 5.4 includes a built-in web server for development purposes, allowing PHP scripts to be run without Apache.
- Traits allow sharing of methods across classes to reduce code duplication, similar to mixins in Ruby.
- Closures now support accessing properties of the enclosing class scope via $this.
- The document discusses best practices for writing functional Java code including using immutable objects, avoiding side effects, and leveraging streams and higher-order functions.
- Some key points covered include using immutable objects to reduce complexity, ensuring streams do not mutate objects, and creating higher-order functions to reduce duplicate code and insert behaviors.
- Optional is discussed as a way to encapsulate null checks and provide alternative flows like orElse, orElseGet and orElseThrow.
This document provides a summary of Java 8 features including lambdas, functional interfaces, streams, and optional. It discusses lambda expressions and how they allow implementing functional interfaces in a more concise way compared to anonymous classes. Key functional interfaces like Predicate, Function, and Comparator are demonstrated. The document also covers stream operations for processing collections lazily and optionally handling potential null references.
This document provides an overview of Java 8 features such as lambda expressions, streams, and optional. Key points include:
- Java 8 introduced lambda expressions to provide concise syntax for anonymous functions. Common functional interfaces like Predicate and Function are used.
- Streams allow processing collections in a functional way through intermediate and terminal operations like map, filter, collect. They are lazy evaluated and cannot mutate data.
- Optional is a wrapper for values that may be null, avoiding null checks in favor of functional-style operations like orElse, ifPresent.
This document provides an overview of Flask-SQLAlchemy, which is an extension for Flask that adds support for SQLAlchemy to Flask applications. It covers basics like setting up a Flask-SQLAlchemy application, defining models, and performing CRUD operations. It also discusses more advanced topics like relationships between models, using the ORM vs manual mapping, and using the underlying SQLAlchemy API. The document includes numerous code examples to illustrate the concepts.
This document provides an overview of the Overpass API and Overpass-turbo. It discusses how to set up an Overpass API instance, including compiling and installing OSM-3S, generating and updating the database, configuring Apache2, and installing Overpass-Turbo. It also provides examples of Overpass QL queries and describes capabilities like filtering, selecting related objects, and output formats.
Java 8: the good, the bad and the ugly (JBCNConf 2017)Brian Vermeer
This document provides an overview and summary of key features in Java 8, including:
- Lambda expressions which allow implementation of functional interfaces in a more concise way
- Default methods which allow extension of interfaces without breaking existing implementations
- Streams API which supports functional-style operations on streams of elements
- Date and time API improvements with new java.time package
- Optional as a container class for nullable values
The document discusses techniques for using SQLite databases in iOS applications. Some key points covered include:
SQLite is a file-based, lightweight database that is well suited for mobile applications. The pure C API can be difficult to use directly, so it's best to abstract it away. The document reviews methods for opening and copying databases, executing queries using the SQLite API, and using prepared statements.
Slides of my talk I gave @ PyRE.it in ReggioEmilia about developing a Rest Api in Python using a little bit of Flask and SqlAlchemy.
www.pyre.it
www.alessandrocucci.it/pyre/restapi
2005_Structures and functions of MakefileNakCheon Jung
The document discusses the structure and functions of the Linux kernel Makefile. It describes the top-level Makefile and how it builds the kernel image (vmlinux) and modules. It explains the roles of the .config file, architecture Makefiles, Script/Makefile and various Kbuild Makefiles. Key files like obj-y, obj-m and lib-y goals are identified. The document provides an overview of who develops different parts of the kernel build system and lists some important Kbuild files.
Java 8: the good, the bad and the ugly (Oracle Code Brussels 2017)Brian Vermeer
This document summarizes key features of Java 8 including lambdas, functional interfaces, streams, and optional. It discusses lambda expressions and how they allow implementing functional interfaces more concisely. Streams are introduced as a way to process collections lazily and in parallel. Exceptions in lambdas and streams are covered. Optional is presented as a wrapper for null values. Best practices are provided around these new Java 8 features.
Smolder is a web-based continuous integration smoke server that uses the Test Anything Protocol (TAP) format for test reporting. It supports multiple notification channels like email and ATOM and stores test results in a SQLite or MySQL database. Tests can be run on Smolder using CGI::Application or Plack and results can be uploaded from the command line using a script that communicates with the Smolder server API.
This document summarizes server-side and client-side testing approaches and tools. It then introduces TRunner, an open source test runner tool inspired by Selenium and inspired to support converting HTML test suites to YAML format. The document demonstrates using TRunner, including its file structure and how to fork and use it to run own test suites.
This document summarizes how to use a pre-commit hook with SVN to check code for syntax and coding standards before committing. The hook runs PHPCodeSniffer on files being committed, catching output to parse for errors. It addresses issues like having no local files by using a PHP stream wrapper to access file contents from the SVN repository instead of temporary files.
This document provides an overview of setting up a Flask application with common extensions for functionality like user authentication, database management, forms validation, and sending email. It demonstrates initializing extensions like Flask-SQLAlchemy, Flask-Login, Flask-Migrate, Flask-Script, and Flask-Mail. Models and views are defined to handle user registration and login. The Flask application is configured and commands are provided to initialize the database, run migrations, and start a development server.
- perl provides many command line switches to control how a Perl script is executed or the input/output behavior. Some key switches include -n, -p, -l, -e, -M, -I, -V, and -E.
- Special variables like $. and eof can be used to access the current line number or detect the end of input files when iterating over lines.
- Modules can be loaded at startup using -M to enhance functionality, and %INC shows where modules were loaded from.
- Various quoting mechanisms like qq can be used to specify strings without interpolation.
This document discusses Flask, a Python-based web application framework. It provides an overview of Flask fundamentals like backend development, virtual environments, routes, templates, and error handling. It also covers additional Flask features like extensions, MongoDB integration, and building REST APIs. The document uses code samples and file structure examples to demonstrate how to structure and deploy a Flask application on Heroku.
This document provides examples of using LogMiner to analyze and query redo logs in an Oracle database. It demonstrates how to configure supplemental logging, add redo log files to a LogMiner session, start LogMiner with different dictionary and filtering options, and query LogMiner views to see SQL statements that were executed.
This document provides an overview of Java versions from Java 5 through Java 9 and introduces key features of Java 8 such as lambda expressions, functional interfaces, and streams. The document discusses how lambda expressions allow for more concise implementation of interfaces like Comparator compared to Java 7. It also covers optional, exceptions in lambda expressions, and best practices for writing lambda expressions and using streams in Java 8.
The document provides information about debugging Ruby on Rails applications using the debugger gem. It discusses setting breakpoints, navigating the debugger, examining variables and program state, conditional breakpoints, remote debugging, and integrating the debugger with Pry. Logging and examining logs is also covered.
This document summarizes some new features in PHP 5.4:
- Array syntax can now be written more concisely using square brackets instead of array functions.
- PHP 5.4 includes a built-in web server for development purposes, allowing PHP scripts to be run without Apache.
- Traits allow sharing of methods across classes to reduce code duplication, similar to mixins in Ruby.
- Closures now support accessing properties of the enclosing class scope via $this.
- The document discusses best practices for writing functional Java code including using immutable objects, avoiding side effects, and leveraging streams and higher-order functions.
- Some key points covered include using immutable objects to reduce complexity, ensuring streams do not mutate objects, and creating higher-order functions to reduce duplicate code and insert behaviors.
- Optional is discussed as a way to encapsulate null checks and provide alternative flows like orElse, orElseGet and orElseThrow.
This document provides a summary of Java 8 features including lambdas, functional interfaces, streams, and optional. It discusses lambda expressions and how they allow implementing functional interfaces in a more concise way compared to anonymous classes. Key functional interfaces like Predicate, Function, and Comparator are demonstrated. The document also covers stream operations for processing collections lazily and optionally handling potential null references.
This document provides an overview of Java 8 features such as lambda expressions, streams, and optional. Key points include:
- Java 8 introduced lambda expressions to provide concise syntax for anonymous functions. Common functional interfaces like Predicate and Function are used.
- Streams allow processing collections in a functional way through intermediate and terminal operations like map, filter, collect. They are lazy evaluated and cannot mutate data.
- Optional is a wrapper for values that may be null, avoiding null checks in favor of functional-style operations like orElse, ifPresent.
This document discusses the Play framework and how it starts a Play application from the command line using the ProdServerStart object.
1. The ProdServerStart object's main method creates a RealServerProcess and calls the start method, passing the process.
2. The start method reads server configuration settings, creates a PID file, starts the Play application, and starts the HTTP server provider.
3. It loads the Play application using an ApplicationLoader, which can use Guice for dependency injection. The loaded application is then started by Play.
Play Framework and Ruby on Rails are web application frameworks that help developers build web applications. Both frameworks provide tools and libraries for common tasks like routing, database access, templates and more. Some key similarities include using MVC patterns, supporting SQL/NoSQL databases via libraries, and including tools for unit testing and deployment. Some differences are Play uses Scala and Java while Rails uses Ruby, and they have different project structures and ways of handling assets, templates and dependencies. Both aim to help developers build web applications faster with their features and ecosystem of supporting libraries.
This document describes an integration framework and its components. It includes:
- FUSE ESB as the integration bus based on JBI and OSGi standards.
- ActiveMQ as the message broker based on JMS.
- CXF for creating or consuming web services.
- Camel as the mediation router for creating integration patterns with a simple Java or XML DSL.
- Details on configuring ActiveMQ and Camel within a OSGi container.
- Code examples of using Camel routes and processors to integrate and transform messages between endpoints.
Peter Lawrey is the CEO of Chronicle Software. He has 7 years experience working as a Java developer for investment banks and trading firms. Chronicle Software helps companies migrate to high performance Java code and was involved in one of the first large Java 8 projects in production in December 2014. The company offers workshops, training, consulting and custom development services. The talk will cover reading and writing lambdas, capturing vs non-capturing lambdas, transforming imperative code to streams, mixing imperative and functional code, and taking Q&A.
Play 2.0 is a web framework for Java and Scala that is designed to be productive, asynchronous, and reactive. Some key features include being full stack, high-productive, asynchronous and reactive, stateless, HTTP-centric, typesafe, scalable, and open source. Play 2.0 aims to be fun and fast to develop with by enabling features like hot code reloading, browser error reporting, and easy deployment to platforms like Heroku. It also focuses on being asynchronous and reactive through support for WebSockets, Comet, HTTP streaming responses, and composable streams.
1. The runbook grants a user VPN access by making changes to their Active Directory profile after their request is approved.
2. It runs .NET scripts to extract the user's SAM account name and grant VPN access by setting the msnpallowdialin property to true.
3. It then gets information on the user and their manager from Active Directory to notify them by email that VPN access was granted.
This document provides an overview of using JDBC (Java Database Connectivity) to connect Java applications to relational databases. It discusses downloading and configuring the JDBC driver, executing SQL statements to query and manipulate data, processing result sets, and properly closing connections. Transactions are also introduced to group statements and ensure all succeed or fail together.
The document discusses the introduction and advantages of lambda expressions and functional programming in Java 8. Some key points include:
- Lambda expressions allow passing behaviors as arguments to methods, simplifying code by removing bulky anonymous class syntax. This enables more powerful and expressive APIs.
- Streams provide a way to process collections of data in a declarative way, leveraging laziness to improve efficiency. Operations can be pipelined for fluent processing.
- Functional programming with immutable data and avoidance of side effects makes code more modular and easier to reason about, enabling optimizations like parallelism. While not natively supported, Java 8 features like lambda expressions facilitate a more functional approach.
Spring Boot is a framework for building stand-alone, production-grade Spring based Applications that can be "just run". It takes an opinionated view of the Spring platform and third-party libraries so developers can get started with minimum fuss. Some key features include an embedded HTTP server and automatic configuration support. Spring Boot applications can be started using Java -jar or executed using Gradle/Maven and can be packaged as an executable jar or war file for deployment. The document also discusses using Spring Boot with databases, profiles, Spring Data, GORM, views and some miscellaneous topics.
The document discusses monitoring and analyzing memory usage in Raku processes. It describes using the getrusage(2) system call to retrieve resident set size (RSS) and other memory statistics for a process. It then presents the ProcStats module, which allows periodically sampling getrusage(2) data over time to track RSS and detect changes from an initial baseline. The module outputs differences in memory statistics compared to the first sample, ignoring unchanged values. This provides a concise way to monitor for increases in a process's memory footprint over time.
The document describes 5 Java programming experiments related to database access and web applications:
1. A program that accesses a table from an MS Access database.
2. A similar program that accesses a table from a Derby database.
3. A program that implements remote method invocation using an interface.
4. A simple servlet program that outputs HTML.
5. A servlet program that connects to a Derby database and outputs records.
This document discusses server-side Swift frameworks and deploying a Swift server application. It begins with an introduction to popular server-side Swift frameworks like Perfect, Vapor, Kitura, and Zewo. It then demonstrates building a simple REST API using the Perfect framework, including defining routes and handlers for GET and POST requests. It also shows connecting to a PostgreSQL database and performing queries. The document concludes by discussing deploying the Swift server application.
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...dantleech
Did you know that Generators and Pipelines can be combined in order to
solve software engineering problems?
Generators have been available to us in PHP for about 5 years, they are a very
powerful tool in a developers toolbox, they can be used to make your life
easier (e.g. as data providers in PHPUnit), to help process large amounts of
data, and even to enable co-operative multi-tasking.
Pipelines provide a way to compose complex tasks from stages.
In this talk we will briefly discuss a specific problem in PHPBench (a
benchmarking tool for PHP) which can be solved through the use of Generators
(and pipelines!). We will then explore both topics generally, before combining
them into an Incredible Machine in a live coding session.
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
The document discusses SQLite, including that it is a file-based, single-user, cross-platform SQL database engine. It provides information on SQLite tools like SQLite Manager and the sqlite3 command line utility. It also covers how to use the SQLite API in iOS/macOS applications, including opening a database connection, executing queries, and using prepared statements. Key aspects covered are getting the documents directory path, copying a default database on app startup, and the callback signature for query results.
This document provides an overview of Python fundamentals including installing Python, hidden documentation tools, data types, strings, lists, tuples, dictionaries, control flow statements, functions, classes, the datetime library, importing modules, and web2py fundamentals such as the request and response objects, templates, controllers, models, and more. Key concepts covered include Python types like strings, lists, tuples and dictionaries, control structures like if/else and for loops, functions, classes and objects, and the basics of using the web2py framework to build web applications.
Similar to Common mistakes functional java | Oracle Code One 2018 (20)
Stranger Danger: Your Java Attack Surface Just Got Bigger | JBCNConf 2022Brian Vermeer
The document discusses the security challenges of modern applications that rely heavily on open source code and containers. It notes that 80-90% of application codebases are open source, and 80% of vulnerabilities are found in indirect dependencies. It also discusses how applications are built, deployed, and scaled rapidly through containers and infrastructure as code. The document argues that this new application profile requires a DevSecOps approach that integrates security throughout the development lifecycle rather than a "shift left" approach. It presents the tooling offered by Snyk to help developers securely use open source, containers, and infrastructure as code.
1. The document discusses problems with software development such as lack of security focus throughout development and siloed security expertise.
2. It notes that open source usage has exploded but attackers are targeting vulnerabilities in open source libraries, meaning one vulnerability can impact many users.
3. The proposed solution is adopting a DevSecOps approach by focusing on team culture, development processes, and tools to integrate security from the beginning of the development lifecycle.
Don't be a trojan - Codemotion Amsterdam 2019Brian Vermeer
This document discusses the importance of security in software development. It warns that software systems can become compromised over time if security is not prioritized from the beginning. It recommends designing systems with security in mind from the start, implementing secure development practices like automated security testing, code reviews that consider privacy and data exposure, and centralizing logs to detect issues. Maintaining security requires ongoing efforts like monitoring systems in production for vulnerabilities.
The document discusses the growing threats of cybercrime and importance of security by design in software development. It notes that data has become the new gold and cybercrime damages reached $3 trillion worldwide in 2016. The document advocates storing only necessary data and limiting access. It provides examples of how software systems can expose private data if not designed securely from the start. Throughout, it emphasizes close collaboration between developers and security experts to implement controls like centralized logging, strong passwords, and automated security testing in development practices.
Common mistakes made with Functional Java include: doing too much in a single lambda expression, mutating objects which violates functional programming principles, improperly using streams without consuming them or mutating objects within streams, overusing forEach which can lead to side effects, and not properly handling checked exceptions within lambda expressions. Following best practices such as keeping lambda expressions focused on a single task, returning new immutable objects from functions, fully consuming streams, and wrapping checked exceptions can help avoid these issues.
This document discusses cybersecurity threats and best practices for software development. It notes that cybercrime is a large and growing business, with damages estimated at $3 trillion worldwide in 2016. The document advocates designing systems with security in mind from the start, avoiding exposing unnecessary data, logging all activity, reviewing code for vulnerabilities, using secure password practices, and working with security teams. Developers are warned that without care, software can be "trojanized" over time to expose more data or capabilities than intended.
This document discusses identity theft and cybercrime as growing threats. Developers are urged to integrate security practices like code reviews, using prepared statements to prevent SQL injection, hashing passwords, and preventing cross-site scripting. Following standards like OWASP Application Security Verification Standard (ASVS) can help developers build more secure applications and protect user data and identities. While cybercrime has become very profitable, developers must be aware of security risks and see themselves as part of the solution through secure development.
This document discusses identity theft and cybercrime as growing threats. Developers are urged to integrate security practices like code reviews, using prepared statements to prevent SQL injection, hashing passwords, and preventing cross-site scripting. Following standards like OWASP Application Security Verification Standard (ASVS) can help developers build more secure applications and protect user data and identities. As threats increase, developers must make security a priority in the development process to help address these issues rather than be part of the problem.
Identity theft: Developers are key - JavaZone17Brian Vermeer
Identity theft and cybercrime pose real threats that are growing as organized criminal networks engage in cybercrime as a profitable business. As developers, we must be aware of security risks and integrate protections into our work, including securing passwords, preventing SQL injection, and avoiding cross-site scripting vulnerabilities. The Open Web Application Security Project (OWASP) provides guidance on application security best practices developers should follow.
The document discusses security best practices for software developers. It emphasizes integrating security into the development process through code reviews, using standards like OWASP-ASVS, and addressing vulnerabilities like SQL injection, XSS, and weak password storage. Developers are advised to protect themselves and be aware of security risks, consider the trust placed in dependencies, and ensure applications are secure by design from the beginning.
Identity theft: Developers are key - JFokus 2017Brian Vermeer
Identity theft is perhaps the most concerning kind of Cybercrime nowadays. The most concerning aspect of identity theft is that once you are a victim it is hard to get rid of the consequences. Although as developers we are probably well aware of the risks towards cybercrime and identity theft in particular, in many parts we as developers play a big role in making identity theft happen. It is not only about how secure is your program, but how aware are you? Or better said how naive are we in practice as developers in this big bad world.
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfUndress Baby
The quest for the best AI face swap solution is marked by an amalgamation of technological prowess and artistic finesse, where cutting-edge algorithms seamlessly replace faces in images or videos with striking realism. Leveraging advanced deep learning techniques, the best AI face swap tools meticulously analyze facial features, lighting conditions, and expressions to execute flawless transformations, ensuring natural-looking results that blur the line between reality and illusion, captivating users with their ingenuity and sophistication.
Web:- https://undressbaby.com/
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j
Dr. Jesús Barrasa, Head of Solutions Architecture for EMEA, Neo4j
Découvrez les dernières innovations de Neo4j, et notamment les dernières intégrations cloud et les améliorations produits qui font de Neo4j un choix essentiel pour les développeurs qui créent des applications avec des données interconnectées et de l’IA générative.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
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.
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppGoogle
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-fusion-buddy-review
AI Fusion Buddy Review: Key Features
✅Create Stunning AI App Suite Fully Powered By Google's Latest AI technology, Gemini
✅Use Gemini to Build high-converting Converting Sales Video Scripts, ad copies, Trending Articles, blogs, etc.100% unique!
✅Create Ultra-HD graphics with a single keyword or phrase that commands 10x eyeballs!
✅Fully automated AI articles bulk generation!
✅Auto-post or schedule stunning AI content across all your accounts at once—WordPress, Facebook, LinkedIn, Blogger, and more.
✅With one keyword or URL, generate complete websites, landing pages, and more…
✅Automatically create & sell AI content, graphics, websites, landing pages, & all that gets you paid non-stop 24*7.
✅Pre-built High-Converting 100+ website Templates and 2000+ graphic templates logos, banners, and thumbnail images in Trending Niches.
✅Say goodbye to wasting time logging into multiple Chat GPT & AI Apps once & for all!
✅Save over $5000 per year and kick out dependency on third parties completely!
✅Brand New App: Not available anywhere else!
✅ Beginner-friendly!
✅ZERO upfront cost or any extra expenses
✅Risk-Free: 30-Day Money-Back Guarantee!
✅Commercial License included!
See My Other Reviews Article:
(1) AI Genie Review: https://sumonreview.com/ai-genie-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIFusionBuddyReview,
#AIFusionBuddyFeatures,
#AIFusionBuddyPricing,
#AIFusionBuddyProsandCons,
#AIFusionBuddyTutorial,
#AIFusionBuddyUserExperience
#AIFusionBuddyforBeginners,
#AIFusionBuddyBenefits,
#AIFusionBuddyComparison,
#AIFusionBuddyInstallation,
#AIFusionBuddyRefundPolicy,
#AIFusionBuddyDemo,
#AIFusionBuddyMaintenanceFees,
#AIFusionBuddyNewbieFriendly,
#WhatIsAIFusionBuddy?,
#HowDoesAIFusionBuddyWorks
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
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.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Looking for a reliable mobile app development company in Noida? Look no further than Drona Infotech. We specialize in creating customized apps for your business needs.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
7. Lambda Expression
In computer programming, a lambda expression is a function definition
that is not bound to an identifier. Anonymous functions are often:[1]
• arguments being passed to higher-order functions, or
• used for constructing the result of a higher-order function that
needs to return a function.
8. Lambda in Java
Anonymous Inner functions
Satisfy a Functional Interface
They only exist in runtime
Single Line <input> -> <output> or Block <input> -> { function body }
15. A stream is NOT a
data structure
A stream is NOT a
data structure
16. What is Stream ( in Java)
Flow of data derived from a Collection
Can create a pipeline of function that can be evaluated
Intermediate result
Lazy evaluated by nature
Can transform data, cannot mutate data
18. List<Beer> beers = getBeers();
Stream<Beer> beerStream = beers.stream();
beerStream.forEach(b ->System.out.println(b.getName())); //1
beerStream.forEach(b ->System.out.println(b.getAlcohol())); //2
Only use a Stream once
Line 2 will give:
java.lang.IllegalStateException: stream has already been operated upon or
closed
29. Functional Programming
In computer science, functional programming is a programming
paradigma style of building the structure and elements of computer
programs that treats computation as the evaluation of mathematical
functions and avoids changing-state and mutable data.
It is a declarative programming paradigm, which means programming is
done with expressions or declarations instead of statements.
— wikipedia
30.
31. – Kevlin Henney
“Asking a question should not
change the answer, nor
should asking it twice”
32. Immutable objects
Less moving parts
Easier to reason about code
No need to keep a mental map of the state an object is in.
33. Stream cannot mutate
private final List<Beer> beers = List.of(new Beer("Heineken", 5.2),
new Beer("Amstel", 5.1));
public void execute() {
List<Beer> beersNew = beers.stream()
.map(beer -> beer.setName(“foo”)) //not allowed
.collect(Collectors.toList());
}
34. Stream should not mutate !
private class Beer {
String name;
Double alcohol;
public Beer setName(String name){
this.name = name;
return this;
}
}
private final List<Beer> beers = List.of(new Beer("Heineken", 5.2), new Beer("Amstel",
5.1));
public void execute() {
List<Beer> beersNew = beers.stream()
.map(beer -> beer.setName("foo"))
.collect(Collectors.toList());
System.out.println(beers);
System.out.println(beersNew);
}
35. Stream should not mutate !
private class Beer {
String name;
Double alcohol;
public Beer setName(String name){
this.name = name;
return this;
}
}
private final List<Beer> beers = List.of(new Beer("Heineken", 5.2), new Beer("Amstel",
5.1));
public void execute() {
List<Beer> beersNew = beers.stream()
.map(beer -> beer.setName("foo"))
.collect(Collectors.toList());
System.out.println(beers);
System.out.println(beersNew);
}
36. Return a new copy
private class Beer {
String name;
Double alcohol;
public Beer withName(String name){
return new Beer(name, this.alcohol);
}
}
private final List<Beer> beers = List.of(new Beer("Heineken", 5.2), new Beer("Amstel",
5.1));
public void execute() {
List<Beer> beersNew = beers.stream()
.map(beer -> beer.withName("foo"))
.collect(Collectors.toList());
System.out.println(beers);
System.out.println(beersNew);
}
43. Assignment
Beers -> Brewer -> Country
I want the first 3 unique brewers countries from the beer library as comma separated String
beerLib.stream()
.map(Beer::getBrewer)
.distinct()
.limit(3)
.map(Brewer::getCountry)
.map(String::toUpperCase)
.collect(Collectors.joining(“,”));
44. Assignment
Beers -> Brewer -> Country
I want the first 3 unique brewers countries from the beer library as comma separated String
beerLib.stream()
.map(Beer::getBrewer)
.distinct()
.limit(3)
.map(Brewer::getCountry)
.map(String::toUpperCase)
.collect(Collectors.joining(“,”));
// wrong
45. Assignment
Beers -> Brewer -> Country
I want the first 3 unique brewers countries from the beer library as comma separated String
beerLib.stream()
.map(Beer::getBrewer)
.map(Brewer::getCountry)
.map(String::toUpperCase)
.distinct()
.limit(3)
.collect(Collectors.joining(“,”));
// correct
47. Infinite stream
IntStream.iterate(0, i -> ( i + 1) % 2)
.distinct()
.limit(10)
.forEach(i -> System.out.println(i));
// will run forever
IntStream.iterate(0, i -> ( i + 1) % 2)
.limit(10)
.distinct()
.forEach(i -> System.out.println(i));
//will terminate
48. Infinite stream
IntStream.iterate(0, i -> ( i + 1) % 2)
.parallel()
.distinct()
.limit(10)
.forEach(i -> System.out.println(i));
// will run forever on all threads.
49. Solution
1. Look closely at the order of operations
- prevent incorrect answers
2. Only use infinite streams when absolutely necessary.
rather use:
IntStream.range(0,10);
IntStream.rangeClosed(0,10);
IntStream.iterate(0, i -> i < 10, i -> i + 1); //java 9 and up
51. Optional
Java’s implementation of the Maybe Monad
Encapsulation to handle possible null value
Consider it a wrapper where a value can be absent
Force the user to unpack the Optional before using it.
59. orElseThrow
public void execute() {
Optional<String> maybeString = Optional.empty();
maybeString
.map(this::runIfExist)
.orElseThrow(() -> new RuntimeException("Optional was empty"));
}
60. orElse
public void execute() {
Optional<String> maybeString = Optional.of("foo");
String newString = maybeString
.map(this::runIfExist)
.orElse(runIfEmpty());
System.out.println(newString);
}
private String runIfExist(String str) {
System.out.println("only run if optional is filled ");
return str;
}
private String runIfEmpty() {
System.out.println("only run if empty");
return "empty";
}
61. orElse
public void execute() {
Optional<String> maybeString = Optional.of("foo");
String newString = maybeString
.map(this::runIfExist)
.orElse(runIfEmpty());
System.out.println(newString);
}
private String runIfExist(String str) {
System.out.println("only run if optional is filled ");
return str;
}
private String runIfEmpty() {
System.out.println("only run if empty");
return "empty";
}
only run if optional is filled
only run if empty
foo
62. orElseGet
public void execute() {
Optional<String> maybeString = Optional.of("foo");
String newString = maybeString
.map(this::runIfExist)
.orElseGet(() -> runIfEmpty());
System.out.println(newString);
}
private String runIfExist(String str) {
System.out.println("only run if optional is filled ");
return str;
}
private String runIfEmpty() {
System.out.println("only run if empty");
return "empty";
}
63. orElseGet
public void execute() {
Optional<String> maybeString = Optional.of("foo");
String newString = maybeString
.map(this::runIfExist)
.orElseGet(() -> runIfEmpty());
System.out.println(newString);
}
private String runIfExist(String str) {
System.out.println("only run if optional is filled ");
return str;
}
private String runIfEmpty() {
System.out.println("only run if empty");
return "empty";
}
only run if optional is filled
foo
64. what else?
- When using orElse(x), make sure x doesn’t contain any side effects
- Only use orElse() to assign a default value
- Use orElseGet() to run an alternative flow
70. Exception Utility
@FunctionalInterface
public interface CheckedFunction<T, R> {
public R apply(T t) throws Exception;
}
public static <T, R> Function<T, R> wrap(CheckedFunction<T, R> function) {
return t -> {
try {
return function.apply(t);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
};
};
beerLib.stream()
.map(wrap(beer -> doSomething(beer)))
.collect(Collectors.toList());
71. Either type
public class Either<L, R> {
private final L left;
private final R right;
private Either(L left, R right) {
this.left = left;
this.right = right;
}
public static <L,R> Either<L,R> Left( L value) {
return new Either(value, null);
}
public static <L,R> Either<L,R> Right( R value) {
return new Either(null, value);
} …
}
72. Either type
private Either<Exception, String> canGoWrong(Integer input) {
if (input > 10) {
return Either.Left(new RuntimeException("larger then 10"));
}
return Either.Right("["+input+"]");
}
List<Either<Exception, String>> canGoWrongs = IntStream.range(0,12)
.mapToObj(i -> canGoWrong(i))
.collect(Collectors.toList());
77. //java 9
List myList = List.of(1,2,3,4,5)
//pre Java9
List myList = Arrays.asList(new String[] {“a”,"b","c"});
Creating collections
78. //java 9
List myList = List.of(1,2,3,4,5)
//pre Java9
List myList = Arrays.asList(new String[] {"a","b","c"});
// since Java 8
List myList = Stream.of("a","b","c","d").collect(Collectors.toList());
Creating collections
79. private Beer foo(){...}
private Beer bar(){...}
private Beer fooBar(){…}
Beer myBeer = new Beer();
Beer result = fooBar(bar(foo(myBeer)));
Using Stream.of
80. private Beer foo(){...}
private Beer bar(){...}
private Beer fooBar(){…}
Beer myBeer = new Beer();
Beer result = fooBar(bar(foo(myBeer)));
Using Stream.of
Beer result = Stream.of(myBeer)
.map(this::foo)
.map(this::bar)
.map(this::fooBar)
.findFirst().get();
81. String sentence = "The quick fox jumps over the lazy dog. ";
String[] words = sentence
.trim()
.toUpperCase()
.split(" ");
for(String word : words) {
System.out.println(word);
}
Using Stream.of
82. String sentence = "The quick fox jumps over the lazy dog. ";
String[] words = sentence
.trim()
.toUpperCase()
.split(" ");
for(String word : words) {
System.out.println(word);
}
Stream.of(sentence)
.map(String::trim)
.map(String::toUpperCase)
.map(str -> str.split(" "))
.flatMap(array -> Arrays.stream(array))
.forEach(System.out::println);
Using Stream.of