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
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.
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.
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 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.
An overview how to realize code generation of languages on the JVM that implement other class layouts than the Java programming languages. As an example, the inline-mock-maker for Mockito is discussed which supports languages like Kotlin that make any property final by default.
The document provides an overview of various testing frameworks and libraries that can be used for testing Java code. It discusses frameworks for unit testing like JUnit, Mockito, and Spock. It also covers libraries for integration testing like Arquillian, REST Assured and WireMock. Other topics include parameterizing tests, testing asynchronous code, verifying PDF and XML documents. The document aims to help developers choose the right tools for testing different parts of an application effectively.
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.
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.
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.
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.
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 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.
An overview how to realize code generation of languages on the JVM that implement other class layouts than the Java programming languages. As an example, the inline-mock-maker for Mockito is discussed which supports languages like Kotlin that make any property final by default.
The document provides an overview of various testing frameworks and libraries that can be used for testing Java code. It discusses frameworks for unit testing like JUnit, Mockito, and Spock. It also covers libraries for integration testing like Arquillian, REST Assured and WireMock. Other topics include parameterizing tests, testing asynchronous code, verifying PDF and XML documents. The document aims to help developers choose the right tools for testing different parts of an application effectively.
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.
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.
This document provides an overview and examples of using Google Guava, an open-source Java library that includes common libraries useful for writing Java code. It highlights some key classes and methods in Guava, including annotations, strings, collections, I/O, and more. Code samples demonstrate using Guava features like predicates, sets, files, and InetAddress utilities.
Let us explore Java 8 features and start using it in your day to day work. You will be surprised how Java has evolved to become so different yet easy & powerful. In this presentation, we discuss Java 8 Stream API.
The document discusses various Java concurrency concepts including threads, locks, semaphores, and concurrent collections. It provides examples to illustrate thread synchronization issues like race conditions and deadlocks. It also demonstrates how to use various concurrency utilities from java.util.concurrent package like CountDownLatch, Exchanger, PriorityBlockingQueue to synchronize thread execution and communication between threads. The examples show how to simulate real world scenarios involving multiple threads accessing shared resources in a synchronized manner.
The document summarizes the key differences between JUnit 4 and JUnit 5 (alpha). Some of the main changes in JUnit 5 include updated annotations like @Test, support for lambda-based assertions using Hamcrest matchers, assumptions and exception testing capabilities, and support for nested and parameterized tests. JUnit 5 also overhauls extension mechanisms and introduces extension points for customization. While still in development, JUnit 5 is moving to an API based on extensions and customization points rather than the runner approach used in JUnit 4.
This document discusses advanced Java debugging using bytecode. It explains that bytecode is the low-level representation of Java programs that is executed by the Java Virtual Machine (JVM). It shows examples of decompiling Java source code to bytecode instructions and evaluating bytecode on a stack. Various bytecode visualization and debugging tools are demonstrated. Key topics like object-oriented aspects of bytecode and the ".class" file format are also covered at a high-level.
어느덧 스무살이 된 자바. 좋든싫든 프로그래밍의 세계에 몸담고 있는 이상 부딪히지 않을 수 없는 언어인데요, 이 자바에 대한 올바른 모습의 이해화 앞으로 나아가야 할 방향을 모색해본다는 의미에서 "모던 자바의 역습"이라는 타이틀로 실시한 온라인 세미나의 슬라이드 자료입니다.
진행자: 김대우(http://lekdw.blogspot.kr/)
정도현(http://moreagile.net)
이번 세미나는 게임개발자이신 김대우님을 모시고 진행하게 되었는데요 자바 언어와 관련 하여 다음과 같은 주제로 두시간에 걸쳐 발표를 진행합니다.
- 간단히 살펴보는 자바20년의 발자취
- 자바를 둘러싼 진실 혹은 거짓(성능,생산성,품질)
- SI영역 이외에서 자바의 가치
- 모던자바의 역습: 자바8과 함수형 프로그래밍
- 자바 개발의 새로운 패러다임들
The document discusses various Apache Commons utilities including configuration, lang, IO, and bean utilities. It provides examples of using the Configuration utility to load property files, the StringUtils class for string operations, ToStringBuilder for object toString methods, ArrayUtils for array operations, IOUtils for input/output streams, and making classes immutable by preventing field mutation.
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
TestContainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
The document provides an overview of Guava, an open source Java library created by Google that includes common libraries useful for writing Java applications, such as collections, caching, and functional types like predicates and functions. It discusses features of Guava like the Objects, Preconditions, Equivalences, Suppliers, Throwables, Strings, and CharMatcher classes that provide commonly needed functionality like object comparison, defensive checks, caching, and string manipulation in a more readable way than existing approaches. The document also compares Guava to other libraries like Apache Commons and explains why Guava may be preferable for many applications.
This document provides an overview of Guava, a common libraries project from Google that includes utilities for collections, caching, predicates and functions, I/O, and more. It highlights features like Optional for avoiding null checks, immutable collections, filtering collections, transforming collections, caching, and string/object utilities. The document also discusses when and where Guava can be used, such as for temporary collections, avoiding null checks, and leveraging a popular library maintained by others.
The document discusses various techniques for unit testing concurrent code, including using JUnit, TestNG, and a custom ThreadWeaver framework to test for threading issues in a FlawedList implementation. It also covers using jcstress for concurrency stress testing and notes that jcstress results may vary between runs and depend on processor architecture memory access semantics.
The document discusses test-driven development (TDD). It states that TDD relies on short development cycles where the developer first writes an automated test case that defines a new function or improvement. Then the developer produces code to pass that test, and refactors the new code to acceptable standards.
The document discusses various tools and techniques for testing Java code effectively, including:
- Assertion libraries like Hamcrest, AssertJ, and Truth for making assertions.
- Parameterization tools like JUnitParams and Parameterized for running tests with different input values.
- Mocking libraries like Mockito and Jukito for mocking dependencies.
- Behavior-driven development (BDD) frameworks like JGiven and Spock that use a domain-specific language for writing tests.
- Waiting libraries like Awaitility for testing asynchronous code.
Software Testing - Invited Lecture at UNSW Sydneyjulien.ponge
This document provides an overview of software testing concepts and the JUnit testing framework. It discusses the importance of testing, different types of testing, unit testing with JUnit, best practices for writing tests, integrating tests into builds with Ant and Maven, and logging. Examples of JUnit tests are also provided. The key points covered are:
- Why testing is important to find bugs, prevent regressions, and allow for refactoring
- Unit testing, functional testing, and other types of testing
- How to write automated unit tests with JUnit
- Best practices like testing edge cases, achieving good code coverage
- Integrating tests into builds with Ant and Maven
- Using logging frameworks like Log
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.
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.
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
The document discusses bytecode and the ASM library for manipulating Java bytecode. It provides an overview of bytecode structure and instructions. ASM is introduced as a low-level API for working with bytecode using visitors and nodes. Examples are given for generating bytecode using ASM, such as creating a ClassWriter, visiting classes, fields and methods, and generating instructions.
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 ;)
This document provides an overview and examples of using Google Guava, an open-source Java library that includes common libraries useful for writing Java code. It highlights some key classes and methods in Guava, including annotations, strings, collections, I/O, and more. Code samples demonstrate using Guava features like predicates, sets, files, and InetAddress utilities.
Let us explore Java 8 features and start using it in your day to day work. You will be surprised how Java has evolved to become so different yet easy & powerful. In this presentation, we discuss Java 8 Stream API.
The document discusses various Java concurrency concepts including threads, locks, semaphores, and concurrent collections. It provides examples to illustrate thread synchronization issues like race conditions and deadlocks. It also demonstrates how to use various concurrency utilities from java.util.concurrent package like CountDownLatch, Exchanger, PriorityBlockingQueue to synchronize thread execution and communication between threads. The examples show how to simulate real world scenarios involving multiple threads accessing shared resources in a synchronized manner.
The document summarizes the key differences between JUnit 4 and JUnit 5 (alpha). Some of the main changes in JUnit 5 include updated annotations like @Test, support for lambda-based assertions using Hamcrest matchers, assumptions and exception testing capabilities, and support for nested and parameterized tests. JUnit 5 also overhauls extension mechanisms and introduces extension points for customization. While still in development, JUnit 5 is moving to an API based on extensions and customization points rather than the runner approach used in JUnit 4.
This document discusses advanced Java debugging using bytecode. It explains that bytecode is the low-level representation of Java programs that is executed by the Java Virtual Machine (JVM). It shows examples of decompiling Java source code to bytecode instructions and evaluating bytecode on a stack. Various bytecode visualization and debugging tools are demonstrated. Key topics like object-oriented aspects of bytecode and the ".class" file format are also covered at a high-level.
어느덧 스무살이 된 자바. 좋든싫든 프로그래밍의 세계에 몸담고 있는 이상 부딪히지 않을 수 없는 언어인데요, 이 자바에 대한 올바른 모습의 이해화 앞으로 나아가야 할 방향을 모색해본다는 의미에서 "모던 자바의 역습"이라는 타이틀로 실시한 온라인 세미나의 슬라이드 자료입니다.
진행자: 김대우(http://lekdw.blogspot.kr/)
정도현(http://moreagile.net)
이번 세미나는 게임개발자이신 김대우님을 모시고 진행하게 되었는데요 자바 언어와 관련 하여 다음과 같은 주제로 두시간에 걸쳐 발표를 진행합니다.
- 간단히 살펴보는 자바20년의 발자취
- 자바를 둘러싼 진실 혹은 거짓(성능,생산성,품질)
- SI영역 이외에서 자바의 가치
- 모던자바의 역습: 자바8과 함수형 프로그래밍
- 자바 개발의 새로운 패러다임들
The document discusses various Apache Commons utilities including configuration, lang, IO, and bean utilities. It provides examples of using the Configuration utility to load property files, the StringUtils class for string operations, ToStringBuilder for object toString methods, ArrayUtils for array operations, IOUtils for input/output streams, and making classes immutable by preventing field mutation.
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
TestContainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
The document provides an overview of Guava, an open source Java library created by Google that includes common libraries useful for writing Java applications, such as collections, caching, and functional types like predicates and functions. It discusses features of Guava like the Objects, Preconditions, Equivalences, Suppliers, Throwables, Strings, and CharMatcher classes that provide commonly needed functionality like object comparison, defensive checks, caching, and string manipulation in a more readable way than existing approaches. The document also compares Guava to other libraries like Apache Commons and explains why Guava may be preferable for many applications.
This document provides an overview of Guava, a common libraries project from Google that includes utilities for collections, caching, predicates and functions, I/O, and more. It highlights features like Optional for avoiding null checks, immutable collections, filtering collections, transforming collections, caching, and string/object utilities. The document also discusses when and where Guava can be used, such as for temporary collections, avoiding null checks, and leveraging a popular library maintained by others.
The document discusses various techniques for unit testing concurrent code, including using JUnit, TestNG, and a custom ThreadWeaver framework to test for threading issues in a FlawedList implementation. It also covers using jcstress for concurrency stress testing and notes that jcstress results may vary between runs and depend on processor architecture memory access semantics.
The document discusses test-driven development (TDD). It states that TDD relies on short development cycles where the developer first writes an automated test case that defines a new function or improvement. Then the developer produces code to pass that test, and refactors the new code to acceptable standards.
The document discusses various tools and techniques for testing Java code effectively, including:
- Assertion libraries like Hamcrest, AssertJ, and Truth for making assertions.
- Parameterization tools like JUnitParams and Parameterized for running tests with different input values.
- Mocking libraries like Mockito and Jukito for mocking dependencies.
- Behavior-driven development (BDD) frameworks like JGiven and Spock that use a domain-specific language for writing tests.
- Waiting libraries like Awaitility for testing asynchronous code.
Software Testing - Invited Lecture at UNSW Sydneyjulien.ponge
This document provides an overview of software testing concepts and the JUnit testing framework. It discusses the importance of testing, different types of testing, unit testing with JUnit, best practices for writing tests, integrating tests into builds with Ant and Maven, and logging. Examples of JUnit tests are also provided. The key points covered are:
- Why testing is important to find bugs, prevent regressions, and allow for refactoring
- Unit testing, functional testing, and other types of testing
- How to write automated unit tests with JUnit
- Best practices like testing edge cases, achieving good code coverage
- Integrating tests into builds with Ant and Maven
- Using logging frameworks like Log
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.
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.
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
The document discusses bytecode and the ASM library for manipulating Java bytecode. It provides an overview of bytecode structure and instructions. ASM is introduced as a low-level API for working with bytecode using visitors and nodes. Examples are given for generating bytecode using ASM, such as creating a ClassWriter, visiting classes, fields and methods, and generating instructions.
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 ;)
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.
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.
- 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.
The document discusses Java 8 lambda expressions and how they improved Java by allowing for anonymous functions. It provides examples of code before and after Java 8 that demonstrate lambda expressions providing a clearer syntax compared to anonymous inner classes. Specifically, it shows how lambda expressions allowed sorting a list of strings in a more readable way. It also discusses how functions can be treated as data by being passed as parameters or returned from other functions.
This document discusses using Bolts and RetroLambda to refactor asynchronous code in Android. It describes how Bolts can be used to serialize asynchronous tasks and callbacks into single tasks. RetroLambda allows using Java 8 lambda expressions in older versions of Java. The document provides an example of refactoring asynchronous dialog code using Bolts and RetroLambda to simplify callbacks into a single continueWith call.
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
Dopo 20 anni Java inizia a sentire il peso degli anni e la sua sintassi non evolve come vorremmo, ma la JVM resta sempre un ambiente affidabile ed è già in produzione presso moltissime aziende. Negli ultimi anni sono usciti molti linguaggi basati sulla JVM, ma non tutti hanno avuto il successo sperato. Kotlin ha conquistato Android e, ora, grazie a una sintassi intuitiva e grandi aziende che lo supportano potrebbe essere molto utilizzato anche nelle applicazioni web. Durante il talk vedremo le basi del linguaggio e come sviluppare una applicazione web pronta ad andare in produzione.
This presentaion provides and overview of the new features of Java 8, namely default methods, functional interfaces, lambdas, method references, streams and Optional vs NullPointerException.
This presentation by Arkadii Tetelman (Lead Software Engineer, GlobalLogic) was delivered at Java.io 3.0 conference in Kharkiv on March 22, 2016.
This document discusses dependency injection (DI) and inversion of control (IOC) design patterns. It explains that DI allows defining dependencies externally rather than hardcoding them, improving testability. IOC builds on DI by having a lightweight container manage object construction and dependency graph. The document uses JavaScript examples to demonstrate an InversifyJS library that implements IOC for JavaScript applications in a similar way that Spring Framework does for Java apps.
Lambda Chops - Recipes for Simpler, More Expressive CodeIan Robertson
While the new Streams API has been a great showcase for lambda methods, there are many other ways this new language feature can be used to make friendlier APIs and more expressive code. Lambdas can be used for a number of tasks which historically required significant boilerplate, type-unsafe constructs, or both. From new ways to express metedata, to emulating Groovy's null-safe navigation operator, we'll take a look at a myriad of ways, big and small, that you can use lambdas to improve APIs and streamline your code. We'll also look at some of the limitations of lambdas, and some techniques for overcoming them.
This document summarizes several proposed changes for Java 7 including better integer literals with underscores for clarity, improved type inference for constructors and argument positions, new features like string switches and automatic resource management, and new libraries such as NIO2 and the fork/join framework for parallel programming.
The document discusses how Groovy can boost testing productivity. It provides an overview of Groovy and how it can simplify testing through features like mocking, integrated support for testing frameworks, and easier database and functional testing. Examples are given of using Groovy for testing exceptions, taglibs, and databases. Frameworks like JUnit, TestNG, DbUnit, Canoo WebTest, and EasyB are highlighted for testing with Groovy.
Boosting Your Testing Productivity with GroovyJames Williams
The document discusses how Groovy can boost testing productivity. It provides an overview of Groovy and how it can simplify testing through features like mocking, exceptions handling, and integration with testing frameworks. It also describes how to test databases, taglibs, and applications through techniques like DbUnit, FEST, and BDD tools like Easyb that can be used with Groovy.
The document summarizes the new features in Groovy 1.6, including performance improvements, syntax enhancements, compile-time and runtime metaprogramming additions, the Grape module system for managing script dependencies, improvements to Swing integration, built-in support for the JSR-223 scripting engine, a domain-specific language for JMX, and OSGi readiness. The presentation highlights key new features like annotations, multiple variable assignment, optional returns, and annotation processing through AST transformations.
Lambda expressions and functional interfaces allow for functional programming in Java 8. This includes filtering, mapping, and reducing collections using streams in a declarative way. Other features include default methods to add methods to interfaces, the Date/Time API improvements, and the removal of PermGen space replaced by Metaspace. The presentation covers programming paradigms including functional programming and its rise. It demonstrates lambda expressions, functional interfaces, and the Stream API with examples.
Similar to Java 8: the good, the bad and the ugly (JBCNConf 2017) (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 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.
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.
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.
Takashi Kobayashi and Hironori Washizaki, "SWEBOK Guide and Future of SE Education," First International Symposium on the Future of Software Engineering (FUSE), June 3-6, 2024, Okinawa, Japan
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!
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.
Zoom is a comprehensive platform designed to connect individuals and teams efficiently. With its user-friendly interface and powerful features, Zoom has become a go-to solution for virtual communication and collaboration. It offers a range of tools, including virtual meetings, team chat, VoIP phone systems, online whiteboards, and AI companions, to streamline workflows and enhance productivity.
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.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
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.
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
Utilocate offers a comprehensive solution for locate ticket management by automating and streamlining the entire process. By integrating with Geospatial Information Systems (GIS), it provides accurate mapping and visualization of utility locations, enhancing decision-making and reducing the risk of errors. The system's advanced data analytics tools help identify trends, predict potential issues, and optimize resource allocation, making the locate ticket management process smarter and more efficient. Additionally, automated ticket management ensures consistency and reduces human error, while real-time notifications keep all relevant personnel informed and ready to respond promptly.
The system's ability to streamline workflows and automate ticket routing significantly reduces the time taken to process each ticket, making the process faster and more efficient. Mobile access allows field technicians to update ticket information on the go, ensuring that the latest information is always available and accelerating the locate process. Overall, Utilocate not only enhances the efficiency and accuracy of locate ticket management but also improves safety by minimizing the risk of utility damage through precise and timely locates.
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.
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/
DDS Security Version 1.2 was adopted in 2024. This revision strengthens support for long runnings systems adding new cryptographic algorithms, certificate revocation, and hardness against DoS attacks.
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.
7. Disclaimer
Best Practices are based on opinions
Different conclusions are possible
Think, and make your own
judgement
8. Why Java 8
Doing things in parallel
Less code
Minimise Errors
New (functional) solutions
9.
10. Lambda
Anonymous Inner Function.
(Nameless function without boilerplate code)
Satisfying a Functional Interface
(Interface with basically 1 abstract method)
<parameters> -> <function body>
11. public interface Predicate<T> {
boolean test(T t);
}
public interface Function<T,R> {
R apply(T t);
}
public interface Consumer<T> {
void accept(T t);
}
public interface Supplier<T> {
T get();
}
Functional Interfaces
12. public Predicate<Integer> pred = i -> i % 2 == 0;
public Consumer<Integer> cons = i -> System.out.println(i);
public Supplier<Double> sup = () -> Math.random();
public Function<Integer, String> func = i -> "Input is " + i;
Functional Interfaces
13. public Predicate<Integer> pred = i -> i % 2 == 0;
public Consumer<Integer> cons = i -> System.out.println(i);
public Supplier<Double> sup = () -> Math.random();
public Function<Integer, String> func = i -> "Input is " + i;
public BiFunction<String, String, String> bifunc1 =
(str1, str2) -> str1 + "-" + str2;
Functional Interfaces
14.
public interface Comparator<T> {
int compare(T o1, T o2);
}
public interface Callable<V> {
V call() throws Exception;
}
public interface Runnable {
public void run();
}
Functional Interfaces
15. List<Beer> beers = new ArrayList<>();
beers.add(new Beer("La Chouffe", 8.0));
beers.add(new Beer("Duvel", 8.5));
beers.add(new Beer("Jupiler", 5.2));
Collections.sort(beers, new Comparator<Beer>() {
@Override
public int compare(Beer b1, Beer b2) {
return b1.getName().compareTo(b2.getName());
}
});
Java 7 Comparator
16. List<Beer> beers = new ArrayList<>();
beers.add(new Beer("La Chouffe", 8.0));
beers.add(new Beer("Duvel", 8.5));
beers.add(new Beer("Jupiler", 5.2));
Collections.sort(beers, new Comparator<Beer>() {
@Override
public int compare(Beer b1, Beer b2) {
return b1.getName().compareTo(b2.getName());
}
});
Java 7 Comparator
20. Writing a Lamda
//Single line Lambda
int1 -> (int1 / 2) * 3;
//Multi line Lambda (block lambda)
int1 -> { //do Some code
// do Some more code
// return something
}
23. Puzzler
List<Beer> beers = new ArrayList<>();
beers.add(new Beer("La Chouffe", 8.0));
beers.add(new Beer("Duvel", 8.5));
beers.add(new Beer("Jupiler", 5.2));)
beers.sort((b1,b2) -> b1.getAlcohol().compareTo(b2.getAlcohol())); //1
beers.sort((b1,b2) -> { b1.getAlcohol().compareTo(b2.getAlcohol())); } //2
A) Line 1 compiles , Line 2 does not.
B) Line 2 compiles , Line 1 does not.
C) Both lines will compile.
D) I don’t care, just give me one of these beers.
24. Puzzler
List<Beer> beers = new ArrayList<>();
beers.add(new Beer("La Chouffe", 8.0));
beers.add(new Beer("Duvel", 8.5));
beers.add(new Beer("Jupiler", 5.2));)
beers.sort((b1,b2) -> b1.getAlcohol().compareTo(b2.getAlcohol())); //1
beers.sort((b1,b2) -> { b1.getAlcohol().compareTo(b2.getAlcohol())); } //2
A) Line 1 compiles , Line 2 does not.
B) Line 2 compiles , Line 1 does not.
C) Both lines will compile.
D) I don’t care, just give me one of these beers.
25. Puzzler
List<Beer> beers = new ArrayList<>();
beers.add(new Beer("La Chouffe", 8.0));
beers.add(new Beer("Duvel", 8.5));
beers.add(new Beer("Jupiler", 5.2));)
beers.sort((b1,b2) -> b1.getAlcohol().compareTo(b2.getAlcohol())); //1
beers.sort((b1,b2) -> { b1.getAlcohol().compareTo(b2.getAlcohol())); } //2
A) Line 1 compiles , Line 2 does not.
B) Line 2 compiles , Line 1 does not.
C) Both lines will compile.
D) I don’t care, just give me one of these beers.
Implicit return
Explicit return
28. Type inference
(Beer b1,Beer b2) -> b1.getAlcohol().compareTo(b2.getAlcohol())
(b1,b2) -> b1.getAlcohol().compareTo(b2.getAlcohol())
Make use of automatic type inferencing.
Only specify types if compiler does not understand
29. Parentheses
(int1) -> int1 * 2 - 1
int1 -> int1 * 2 - 1
Dont’s use parentheses if not needed
(6-3)+2 is the same as 6 - 3 + 2
32. Exception handling
How can I throw CHECKED exceptions from inside Java 8 streams/
lambdas?
The simple answer to your question is:
You can't, at least not directly.
33. Checked Exceptions & Lambda
public Beer doSomething(Beer beer) throws IsEmptyException { …}
Function <Beer,Beer> fBeer = beer -> doSomething(beer)
34. Checked Exceptions & Lambda
public Beer doSomething(Beer beer) throws IsEmptyException { …}
Function <Beer,Beer> fBeer = beer -> doSomething(beer)
39. Optional
New type added in Java 8
Wrapper class around a value that might be absent
Designed to tackle the NULL reference problem
Different opinions (awesome or ugly)
40. Optional
Optional<String>
- empty
- literal String (“Hello World”);
public String giveMeAString() { return “Hello World” }
public String giveMeAString() { return null }
public Optional<String> giveMeAString() { return Optional.of(“Hello World”);}
public Optional<String> giveMeAString() { return Optional.empty(); }
41. Optional
Optional<String> a = Optional.of(“Hello World”);
Optional<String> b = Optional.empty();
Optional<String> c = null //please avoid this
Be careful
Optional can be null
Always avoid this in your own code!
42. Using Optional
Don’t use unnecessary optionals
//avoid
if (Optional.ofNullable(str1).isPresent()) { … }
Optional.ofNullable(str1).ifPresent(x -> doSomething(x));
//instead
if (str1 == null) { … }
43. Using Optional
Use Optional in a more functional way
public Optional<Beer> findBeer(String name) { … }
Beer b = findBeer(name).orElse(Beer.DEFAULT);
Beer b1 = findBeer(name).orElseThrow(NotFoundException::new);
44. Optional
Optional can have 3 options, be aware ….
Never assign to null in your own code.
Choose when to use Optional en stick to that
- everywhere
- only what is publicly available
- don’t use it at all
Optional is designed as return type, not as input type
46. What is Stream ( in Java8 )
Not a data structure, not storage
Flow of data derived form a Collection
Intermediate result
Lazy evaluated by nature
Can transform data, cannot mutate data
Can create a pipeline of function that can be evaluated
50. Puzzler
List<String> teams = new ArrayList<>();
teams.add("alpha");
teams.add("bravo");
teams.add("charlie");
teams.add("delta");
Stream<String> teamsInMission = teams.stream();
teams.remove("bravo");
teams.add("echo");
teamsInMission.forEach(team -> System.out.println(team));
A) alpha, bravo, charlie, delta
B) alpha, bravo, charlie, delta, ConcurrentModificationException
C) alpha, charlie, delta, echo
D) ConcurrentModificationException
51. Puzzler
List<String> teams = new ArrayList<>();
teams.add("alpha");
teams.add("bravo");
teams.add("charlie");
teams.add("delta");
Stream<String> teamsInMission = teams.stream();
teams.remove("bravo");
teams.add("echo");
teamsInMission.forEach(team -> System.out.println(team));
A) alpha, bravo, charlie, delta
B) alpha, bravo, charlie, delta, ConcurrentModificationException
C) alpha, charlie, delta, echo
D) ConcurrentModificationException
52. 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
55. IntStream.iterate(0, i -> i + 1)
.forEach(i -> System.out.println(i));
Infinite stream
IntStream.iterate(0, i -> i + 1)
.limit(10)
.forEach(i -> System.out.println(i));
56. Infinite stream
//“subtle” mistake, this will run forever
IntStream.iterate(0, i -> ( i + 1) % 2)
.distinct()
.limit(10)
.forEach(i -> System.out.println(i));
57. Infinite stream
//“subtle” mistake, this will run forever
IntStream.iterate(0, i -> ( i + 1) % 2)
.distinct()
.limit(10)
.forEach(i -> System.out.println(i));
//parallel makes it even worse!!!!
IntStream.iterate(0, i -> ( i + 1) % 2)
.parallel()
.distinct()
.limit(10)
.forEach(i -> System.out.println(i));
58. Watch out with parallel
Watch out with parallel in general
Parallel stream all use the common fork-join
thread pool
Parallel can slow you down.
59. Streams
Don’t replace every loop with Stream
Be careful with infinite streams
Only uses streams once
Be very careful with parallel
A stream is not a data structure
Stream pipelines don’t do anything until consumed
60. Summary
Java 8 is a Object Oriented Language
Java 8 is not a Functional Language
There are some nice new “functional”
code constructions you can use
Use them with care
Don’t be a cowboy