Functional programming has started (re)gaining prominence in recent years, and with good reason too. Functional programs lend an elegant solution to the concurrency problem, result in more modular systems, are more concise and are easier to test. While modern languages like Scala and Clojure have embraced the functional style whole-heartedly, Java has lagged a bit behind in its treatment of functions as first-class citizens. With the advent of Java 8 and its support for lambdas, however, Java programmers can finally start reaping the power of functional programs as well. Even without Java 8, it is possible to adopt a functional style with the aid of excellent libraries such as Guava.
Functional programming in Java 8 allows for:
1) The use of lambda expressions and streams for a more declarative programming style without iteration.
2) Functional interfaces like Function, Predicate, and Consumer along with lambda expressions enable function composition and chaining.
3) Features like immutable collections help reduce mutability and side effects, important aspects of functional programming.
In this Meetup Victor Perepelitsky - R&D Technical Leader at LivePerson leading the 'Real Time Event Processing Platform' team , will talk about Java 8', 'Stream API', 'Lambda', and 'Method reference'.
Victor will clarify what functional programming is and how can you use java 8 in order to create better software.
Victor will also cover some pain points that Java 8 did not solve regarding functionality and see how you can work around it.
Introduction to functional programming with java 8JavaBrahman
Â
Recently gave a presentation in a Java Meetup in Bangalore on basics of functional programming, new functional features in Java 8, and introduction to the basic concepts of functional interfaces and lambda expressions...
Introduction to functional idioms in Java 8, language-extending functional libraries and short overview of reasons for adoption of such programming style.
Examples and snippets available here: https://github.com/lbialy/functionaljava8
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsEmiel Paasschens
Â
Lambda expressions and streams are major new features in Java 8. Lambda expressions allow treating functionality as a method argument or variable. Streams provide a new way to process collections of objects in a declarative way using intermediate and terminal operations. The document provides examples of lambda expressions, method references, functional interfaces, default methods on interfaces, and stream operations like filter, map, and reduce.
Slides from my madlab presentation on Java 8 (July 2014), full slides and source here:
https://github.com/markglh/Java8Madlab-Slides
The document is a presentation on lambda expressions in Java 8 given by Isaac Carter. It introduces lambda expressions and functional programming concepts in Java 8 such as functional interfaces, streams, and method references. It provides examples of using lambda expressions with common Java 8 APIs like forEach(), Predicate, and stream(). The presentation emphasizes thinking declaratively rather than imperatively in Java 8 and leveraging lambda expressions to let Java do more of the work.
This document discusses new features in Java 8 including stream API, lambdas, default methods, optional values, date and time API, stamped locks, concurrent adders, improved annotations, new file operations, overflow operations, and the Nashorn JavaScript engine. It provides code examples and explanations of how to use these new features in Java 8.
1. The document discusses functional programming in Scala, focusing on why FP is useful, its core concepts, and tools like for-comprehensions, Try and Either.
2. It explains key FP concepts like pure functions, referential transparency, and how Scala supports both functional and imperative styles.
3. Functional programming enables testability, reusability, parallelism and comprehension through immutable data and higher-order functions. The document also covers tools like for-comprehensions for working with collections and Try/Either for handling errors in a functional way.
This document contains the notes from a presentation on best practices for Java 8. It discusses 10 topics: 1) general adoption of Java 8, 2) lambdas and method references, 3) functional interfaces, 4) Optional, 5) streams and collections, 6) streams outside of collections, 7) functional programming with strings, 8) parallel streams, 9) simplifying design patterns with functional programming, and 10) other Java 8 features. For each topic, it provides high-level best practices such as preferring method references to lambdas, avoiding null returns, and testing that parallel streams provide real performance benefits.
Java 8 came out early last yearâ âand Java 7 is now, at the end of life, making Java 8 the only Oracleâ âsupported option. However, since developers value stability over trendiness, many of us are still working with Java 7, or even 6. Letâs look at some features of Java 8, and provide some arguments to persuade your code to upgrade with best practices.â
This presentation provides an overview of oracle's associate and professional Java certifications - gives you ideas on how to prepare and crack the exam with ease.
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
Â
If you are preparing to appear for Oracle Certified Professional Java SE 8 Programmer (OCPJP 8) certification exam, this a reference card (sort of long cheat sheet) meant to help you. You may want to print this reference card for your easy and quick reference when you prepare for your exam.
This document introduces lambda expressions in Java 8. It provides background on why lambda expressions were added to Java, including to allow for more functional programming and parallel processing. It covers the syntax of lambda expressions, when they should and should not be used, functional interfaces, method and constructor references, referencing external variables, debugging lambda expressions, and new lambda methods added in Java 8. The document also advertises exercises for the reader to complete to practice using lambda expressions.
This document discusses Java 8 features including defining methods in interfaces, functional programming concepts, lambda expressions, and the stream API. Key points include: interfaces can now define default and static methods; functional programming uses declarative code, avoids mutability, and handles concurrency; lambda expressions define anonymous methods; and the stream API processes data in parallel streams to leverage multi-core architectures.
This document discusses features of the Xtend programming language that make Java code cleaner and more concise, including active annotations, extension methods, lambda expressions, switch expressions, and more. It provides code examples to demonstrate how Xtend allows generating boilerplate code through active annotations, adding methods to existing types via extension methods, using lambda expressions and the with operator for cleaner code, and more powerful switch expressions. The document recommends resources for learning more about Xtend, including documentation, presentations, blogs, and example source code.
- Highlight the performance benefits of using Java 8 - after all, youâll probably have to persuade "The Management" that tampering with
existing code is worthwhile
- Demonstrate how to identify areas of code that can be updated to use Java 8 features, and how to pick which changes will give you the
most benefit
- Demonstrate how to automatically refactor your code to make use of features like lambdas and streams
- Cover some of the pros and cons of using the new features - including suggestions of when refactoring may NOT be the best idea.
Slides from my JAX London 2016 talk, discussing how the new features affect library design. Follows on from the Java SE 8 Best Practices talk - http://www.slideshare.net/scolebourne/java-se-8-best-practices-53975908
This document provides an overview and best practices for using new features introduced in Java SE 8, based on the author's experience using Java SE 8 for over a year. It covers lambdas, functional interfaces, exceptions, Optional, and streams. The author advocates following best practices such as using expression lambdas over block lambdas, avoiding unnecessary type declarations, and handling exceptions carefully when using functional interfaces. The document also discusses approaches for using Optional to replace null values.
At least since the release of Java 8, functional programming has become mainstream in the Java community. Things like collection processing, lazy evaluation and concurrent programming are much easier to describe in a functional style than in the traditional procedural or object-oriented way.
Xtend is a Java dialect hosted at Eclipse. Designed to remove the syntactic noise, it offers a superior syntax and additional abstractions to provide the full power of functional programming to Java developers. As it compiles to Java 5 code, it will enable functional programming even for Android and GWT developers.
In this tutorial, you will learn the basic principles of functional programming and the Xtend idioms to write code the functional way: concise, easy to understand, and yet powerful. No prior knowledge of functional programming or Xtend required.
Lambda: A Peek Under The Hood - Brian GoetzJAX London
Â
This is a *highly technical* session on the details of how Lambda expressions are implemented in the Java language, presented by Java Language Architect Brian Goetz
Lambdas and streams are key new features in Java 8. Lambdas allow blocks of code to be passed around as if they were objects. Streams provide an abstraction for processing collections of objects in a declarative way using lambdas. Optional is a new class that represents null-safe references and helps avoid null pointer exceptions. Checked exceptions can cause issues with lambdas, so helper methods are recommended to convert checked exceptions to unchecked exceptions.
Functional programming for the Advanced BeginnerLuis Atencio
Â
Functional Programming for the advanced beginner covers functional programming concepts like composition, currying, functors, applicatives, and monads. It provides an overview of functional programming principles like avoiding side effects, favoring expressions over statements, and immutable data. Key topics include functional composition by combining functions, partial function application using currying, and using functors, applicatives and monads to manage effects in a declarative way. The document emphasizes that functional programming is about mapping types rather than mutating state, and controlling program flow through function composition rather than conditionals or loops.
Java 8 introduces several new features that help modernize the Java platform and move it closer to parallelism. These include lambda expressions, which allow treating code as data, and default methods in interfaces, which allow interfaces to evolve while maintaining compatibility. Streams and bulk operations on collections enable a more functional, parallel style of programming. The invokedynamic bytecode instruction is enhanced to allow lambda expressions to be compiled to anonymous methods and executed efficiently by the JVM.
The document provides an introduction to programming in C# including how to write a basic "Hello World" program. It discusses various core programming concepts such as data types, operators, functions, loops, and conditional statements. Examples are given for each concept to illustrate how it works in C#.
The document discusses Java 8 features like lambda expressions, streams, and method references. It provides examples of filtering a list of books by pages or genre using lambda expressions and streams. Lambda expressions allow implementing functional interfaces concisely without anonymous classes. Streams provide a way to process data elements sequentially and support operations like filtering, mapping, matching, reducing, and collecting results.
The objectives of the seminar are to shed a light on the premises of FP and give you a basic understanding of the pillars of FP so that you would feel enlightened at the end of the session. When you walk away from the seminar you should feel an inner light about the new way of programming and an urge & motivation to code like you never before did!
Functional programming should not be confused with imperative (or procedural) programming. Neither it is like object oriented programming. It is something different. Not radically so, since the concepts that we will be exploring are familiar programming concepts, just expressed in a different way. The philosophy behind how these concepts are applied to solving problems are also a little different. We shall learn and talk about essentially the fundamental elements of Functional Programming.
This document discusses new features in Java 8 including stream API, lambdas, default methods, optional values, date and time API, stamped locks, concurrent adders, improved annotations, new file operations, overflow operations, and the Nashorn JavaScript engine. It provides code examples and explanations of how to use these new features in Java 8.
1. The document discusses functional programming in Scala, focusing on why FP is useful, its core concepts, and tools like for-comprehensions, Try and Either.
2. It explains key FP concepts like pure functions, referential transparency, and how Scala supports both functional and imperative styles.
3. Functional programming enables testability, reusability, parallelism and comprehension through immutable data and higher-order functions. The document also covers tools like for-comprehensions for working with collections and Try/Either for handling errors in a functional way.
This document contains the notes from a presentation on best practices for Java 8. It discusses 10 topics: 1) general adoption of Java 8, 2) lambdas and method references, 3) functional interfaces, 4) Optional, 5) streams and collections, 6) streams outside of collections, 7) functional programming with strings, 8) parallel streams, 9) simplifying design patterns with functional programming, and 10) other Java 8 features. For each topic, it provides high-level best practices such as preferring method references to lambdas, avoiding null returns, and testing that parallel streams provide real performance benefits.
Java 8 came out early last yearâ âand Java 7 is now, at the end of life, making Java 8 the only Oracleâ âsupported option. However, since developers value stability over trendiness, many of us are still working with Java 7, or even 6. Letâs look at some features of Java 8, and provide some arguments to persuade your code to upgrade with best practices.â
This presentation provides an overview of oracle's associate and professional Java certifications - gives you ideas on how to prepare and crack the exam with ease.
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
Â
If you are preparing to appear for Oracle Certified Professional Java SE 8 Programmer (OCPJP 8) certification exam, this a reference card (sort of long cheat sheet) meant to help you. You may want to print this reference card for your easy and quick reference when you prepare for your exam.
This document introduces lambda expressions in Java 8. It provides background on why lambda expressions were added to Java, including to allow for more functional programming and parallel processing. It covers the syntax of lambda expressions, when they should and should not be used, functional interfaces, method and constructor references, referencing external variables, debugging lambda expressions, and new lambda methods added in Java 8. The document also advertises exercises for the reader to complete to practice using lambda expressions.
This document discusses Java 8 features including defining methods in interfaces, functional programming concepts, lambda expressions, and the stream API. Key points include: interfaces can now define default and static methods; functional programming uses declarative code, avoids mutability, and handles concurrency; lambda expressions define anonymous methods; and the stream API processes data in parallel streams to leverage multi-core architectures.
This document discusses features of the Xtend programming language that make Java code cleaner and more concise, including active annotations, extension methods, lambda expressions, switch expressions, and more. It provides code examples to demonstrate how Xtend allows generating boilerplate code through active annotations, adding methods to existing types via extension methods, using lambda expressions and the with operator for cleaner code, and more powerful switch expressions. The document recommends resources for learning more about Xtend, including documentation, presentations, blogs, and example source code.
- Highlight the performance benefits of using Java 8 - after all, youâll probably have to persuade "The Management" that tampering with
existing code is worthwhile
- Demonstrate how to identify areas of code that can be updated to use Java 8 features, and how to pick which changes will give you the
most benefit
- Demonstrate how to automatically refactor your code to make use of features like lambdas and streams
- Cover some of the pros and cons of using the new features - including suggestions of when refactoring may NOT be the best idea.
Slides from my JAX London 2016 talk, discussing how the new features affect library design. Follows on from the Java SE 8 Best Practices talk - http://www.slideshare.net/scolebourne/java-se-8-best-practices-53975908
This document provides an overview and best practices for using new features introduced in Java SE 8, based on the author's experience using Java SE 8 for over a year. It covers lambdas, functional interfaces, exceptions, Optional, and streams. The author advocates following best practices such as using expression lambdas over block lambdas, avoiding unnecessary type declarations, and handling exceptions carefully when using functional interfaces. The document also discusses approaches for using Optional to replace null values.
At least since the release of Java 8, functional programming has become mainstream in the Java community. Things like collection processing, lazy evaluation and concurrent programming are much easier to describe in a functional style than in the traditional procedural or object-oriented way.
Xtend is a Java dialect hosted at Eclipse. Designed to remove the syntactic noise, it offers a superior syntax and additional abstractions to provide the full power of functional programming to Java developers. As it compiles to Java 5 code, it will enable functional programming even for Android and GWT developers.
In this tutorial, you will learn the basic principles of functional programming and the Xtend idioms to write code the functional way: concise, easy to understand, and yet powerful. No prior knowledge of functional programming or Xtend required.
Lambda: A Peek Under The Hood - Brian GoetzJAX London
Â
This is a *highly technical* session on the details of how Lambda expressions are implemented in the Java language, presented by Java Language Architect Brian Goetz
Lambdas and streams are key new features in Java 8. Lambdas allow blocks of code to be passed around as if they were objects. Streams provide an abstraction for processing collections of objects in a declarative way using lambdas. Optional is a new class that represents null-safe references and helps avoid null pointer exceptions. Checked exceptions can cause issues with lambdas, so helper methods are recommended to convert checked exceptions to unchecked exceptions.
Functional programming for the Advanced BeginnerLuis Atencio
Â
Functional Programming for the advanced beginner covers functional programming concepts like composition, currying, functors, applicatives, and monads. It provides an overview of functional programming principles like avoiding side effects, favoring expressions over statements, and immutable data. Key topics include functional composition by combining functions, partial function application using currying, and using functors, applicatives and monads to manage effects in a declarative way. The document emphasizes that functional programming is about mapping types rather than mutating state, and controlling program flow through function composition rather than conditionals or loops.
Java 8 introduces several new features that help modernize the Java platform and move it closer to parallelism. These include lambda expressions, which allow treating code as data, and default methods in interfaces, which allow interfaces to evolve while maintaining compatibility. Streams and bulk operations on collections enable a more functional, parallel style of programming. The invokedynamic bytecode instruction is enhanced to allow lambda expressions to be compiled to anonymous methods and executed efficiently by the JVM.
The document provides an introduction to programming in C# including how to write a basic "Hello World" program. It discusses various core programming concepts such as data types, operators, functions, loops, and conditional statements. Examples are given for each concept to illustrate how it works in C#.
The document discusses Java 8 features like lambda expressions, streams, and method references. It provides examples of filtering a list of books by pages or genre using lambda expressions and streams. Lambda expressions allow implementing functional interfaces concisely without anonymous classes. Streams provide a way to process data elements sequentially and support operations like filtering, mapping, matching, reducing, and collecting results.
The objectives of the seminar are to shed a light on the premises of FP and give you a basic understanding of the pillars of FP so that you would feel enlightened at the end of the session. When you walk away from the seminar you should feel an inner light about the new way of programming and an urge & motivation to code like you never before did!
Functional programming should not be confused with imperative (or procedural) programming. Neither it is like object oriented programming. It is something different. Not radically so, since the concepts that we will be exploring are familiar programming concepts, just expressed in a different way. The philosophy behind how these concepts are applied to solving problems are also a little different. We shall learn and talk about essentially the fundamental elements of Functional Programming.
This document provides an introduction to object oriented programming in Java. It outlines the course objectives which are to learn Java basics, object oriented principles, Java APIs, exception handling, files, threads, applets and swings. It discusses key characteristics of Java including being portable, object oriented and having automatic memory management. It also provides an overview of Java environments and tools, and includes an example "Hello World" Java program.
(video of these slides available here http://fsharpforfunandprofit.com/fppatterns/)
In object-oriented development, we are all familiar with design patterns such as the Strategy pattern and Decorator pattern, and design principles such as SOLID.
The functional programming community has design patterns and principles as well.
This talk will provide an overview of some of these, and present some demonstrations of FP design in practice.
The main features of java is; It is object oriented programming language. It is also simple and easy to learn. Java is platform independent programming language. These above are main features of java.
https://www.sitesbay.com/java/features-of-java
Java 8 supports lambdas. It's API also comes with Streams support.
But Knowing some concepts on Functional Programming may help you get a lot more from what this new version of Java has to offer.
The document discusses the four main principles of object-oriented programming: encapsulation, inheritance, polymorphism, and abstraction. It provides examples of each principle using code examples for classes like Person, Student, and Teacher. Encapsulation involves grouping related attributes and methods into classes. Inheritance allows a child class to inherit attributes and methods from a parent class. Polymorphism allows an object to take on many forms, and abstraction hides background details and represents only essential features of an object.
Java is simple, secure, portable, object-oriented, robust, multithreaded, architecture-neutral, interpreted, high-performing, distributed, and dynamic. It is easy to write and learn, provides secure internet applications, can run on any device or platform, uses object-oriented programming, performs error checking, supports multithreaded apps, is not tied to specific hardware, uses bytecode to execute on any machine, has optimized bytecode for high performance, can transmit programs over networks, and carries runtime type information.
The document discusses the key features of Java applications. It outlines that Java is compiled and interpreted, platform independent and portable, object oriented, robust and secure, distributed, simple and familiar, multithreaded and interactive, high performance, and dynamic and extensible. Some of the main benefits highlighted include that Java works across operating systems and hardware, is designed for internet use, incorporates security features like memory access verification, and supports concurrent programming.
The document discusses programming design and paradigms in C++. It describes the problem solving process as having three steps: 1) analyze the problem, 2) design an algorithm to solve it, and 3) implement the algorithm in code. It then covers programming paradigms like structured, imperative, object-oriented, and functional. Object-oriented programming uses classes that define data and methods, with objects as instances of classes that encapsulate data and functions. Structured programming also uses modules and functions but not classes and objects.
The document discusses key concepts in functional programming including functions as first-class citizens, high order functions, immutability, lambda/closure/anonymous functions, currying, and monads. Some benefits mentioned are writing less code to accomplish more, simplicity, and suitability for algorithms and calculations. Core FP principles discussed are lambda calculus, high order functions, and immutability without side effects.
This document outlines the requirements for a semester project on object-oriented programming concepts. Students must design a Java project using UML class diagrams, implement and test it, document it, and present it. The project must incorporate classes and objects, inheritance and method overriding, arrays, and a graphical user interface. It will be evaluated based on functionality, design quality, coding style, and presentation. Milestones include initial project briefing, design, implementation, documentation, and final presentation. Students must submit both a hardcopy report and softcopy code and report, with penalties for plagiarism.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
This chapter covers:
- The most common approaches to program design and development
- The phases of the program development life cycle (PDLC)
- Tools that can be used to design and develop a program
- Good program design techniques and types of program errors
- Common programming languages
The document discusses software system organization and variant programming. It presents an example of designing an alert system for an industrial plant using variant records and parameterized types. The alert system example demonstrates how to add new functionalities without modifying existing code, but that adding new data variants requires modifying the specification and all routines. Functionality-oriented organization is preferable when data types are known upfront and most changes will be adding new functionalities rather than new data variants.
Functional Programming in Java - Code for MaintainabilityMarcin Stepien
Â
Functional Programming is nothing new to the JVM. But with Java 8 it was the big change in paradigm for Java developers. Learn how switching from imperative to functional results in more maintainable code.
The presentation was given at tech meetup KrkDataLink, The missing link between Functional Programming and Data Science.
Why C is Called Structured Programming LanguageSinbad Konick
Â
This Slide was made for a presentation based on the Topic Why C is Called Structured Programming Language . So here we added some history about C Programming from where did it came from , who invented it . What does structured programming actually means . And finally the advantage and disadvantage of C Programming . Future of C Programming .
This document discusses imperative and object-oriented programming languages. It covers basic concepts like state, variables, expressions, assignments, and control flow in imperative languages. It also discusses procedures and functions, including passing parameters, stack frames, and recursion. Finally, it briefly mentions the differences between call by value and call by reference.
In this Meetup Victor Perepelitsky - R&D Technical Leader at LivePerson leading the 'Real Time Event Processing Platform' team , talked about Java 8', 'Stream API', 'Lambda', and 'Method reference'.
Clarified what functional programming is and how can you use java 8 in order to create better software.
Victor will also covered some pain points that java 8 did not solve regarding functional and see how you can workaround it.
This document provides an overview of functional programming features in Java 8 such as lambdas, streams, and method references. Lambdas allow implementing functional interfaces with small anonymous functions. Streams make it easier to perform filtered, mapped and reduced operations on collections in a declarative way. While Java 8 adds some FP capabilities, it is not considered a purely functional language since it lacks features like recursion and immutable data structures.
The document discusses the history of functional programming from 1903 to the present. It covers early developments like the lambda calculus in the 1930s and languages like Lisp in 1958. It also discusses key people who advanced functional programming like Alonzo Church, John McCarthy, and John Backus. The document then covers important milestones in functional programming languages between 1936 and 2013. It discusses concepts like purity, higher-order functions, and how functional programming relates to object-oriented programming.
This document discusses functional programming (FP) and its benefits compared to object-oriented programming (OOP). It defines FP as programming with pure functions that have no side effects. The document explores eliminating side effects through techniques like separating function concerns and returning descriptions of side effects rather than executing them. It also covers FP concepts like higher order functions, recursion, and data types like Option for handling errors/exceptions. The goal is to introduce FP techniques and when each paradigm (FP vs OOP) is best suited.
Introduction to Functional Programming and usage of basic constructs in Java 7 using Guava.
Further, the session introduces Reactive Systems architecture and design.
âLambdas in JAVA 8 is not for what they can do, It is about how we write Programâ
It enables Functional Programming, It Adds a New nucleotides in the DNA of Java.
There is a Change in âThe Climateâ to change our Ways.
Functional programming uses immutable values, pure functions, and precise types to simplify code, enable free concurrency and parallelism, and make code easier to reason about and reuse. It aims to reduce complexity by eliminating state changes and side effects. Key aspects include immutable values that can be safely shared, pure functions without side effects, recursion to loop, and higher order functions that take or return other functions. Functional programming benefits include simple, reusable, and parallelizable code that is easier to reason about due to the absence of mutation and side effects.
Explores and discusses benefits of functional programming in Java and how to program in a functional style. Watch Venkat Subramaniam's talk at https://youtu.be/Ee5t_EGjv0A if you would like to learn more.
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Func...romergalbowx
Â
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Functional Principles 1st Edition Ben Weidig
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Functional Principles 1st Edition Ben Weidig
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Functional Principles 1st Edition Ben Weidig
Introduction to Functional ProgrammingDave Fancher
Â
Functional programming is a programming paradigm that emphasizes functions and immutable data. The key principles of functional programming include:
1) Functional purity by avoiding side effects and making functions dependent only on their inputs.
2) Favoring expressions over statements by writing small, pure functions that take inputs and return outputs.
3) Treating functions as first-class objects that can be passed into other functions as arguments and returned from functions.
The document provides an introduction to Java 8 streams. It discusses intermediate and terminal stream operations such as filter(), sorted(), forEach(), and reduce(). It describes reductions like max(), min(), sum(), count(), and average(). It covers find methods, match methods, and Optional. It also discusses limiting, skipping, and distinct elements in streams.
1) Java 8 introduced many new features to support functional programming in Java, such as lambda expressions, default methods in interfaces, and streams.
2) Lambda expressions allow implementing functional interfaces with anonymous methods, avoiding the need to create anonymous inner classes.
3) Default methods allow adding new methods to interfaces without breaking existing implementations, and streams allow performing bulk operations on collections in a declarative way.
This document discusses functional programming and its benefits. It begins with an overview of functional programming concepts like pure functions, referential transparency, and immutability. It then covers functional programming techniques like higher order functions, recursion, composition, and pattern matching. Examples are given comparing imperative and functional implementations for quicksort and optional types. The document argues that functional programming leads to cleaner code by improving modularity, testability and adherence to SOLID principles. It recommends starting with functional features in existing languages and learning Haskell to fully embrace the functional paradigm.
This is a whirlwind tour of the FP land and is primarily meant for developers wanting to embark on their functional programming journey. Java is used to understand most of the concepts, however, where it falls short to explain certain concepts such as lazy evaluation, currying and partial function application, de-structuring and pattern-matching, Scala or Groovy or Clojure or even Haskell are used to demonstrate it.
This document provides an introduction to functional programming concepts in Java 8 including lambdas, streams, and examples of how to apply functional programming techniques. It outlines key functional programming concepts like declarative programming and composing small functions without side effects. It also covers Java 8 features like lambda expressions, functional interfaces, and the Stream API for filtering, mapping, and reducing collections in a declarative way. Examples are provided for sorting a list, finding word lengths, summing numbers, and filtering/mapping over collections in a functional style.
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.
Functional programming is the most extreme programmingsamthemonad
Â
Functional Programming is the most Extreme form of Programming according to the document. It introduces Functional Programming concepts and compares them to Object Oriented Programming. It argues that FP is better aligned with Extreme Programming principles like YAGNI and KISS. OOP can introduce unnecessary complexity and tight coupling between components, whereas FP avoids this through purity and avoiding side effects and mutable state.
Online Queue Management System for Public Service Offices [Focused on Municip...Rishab Acharya
Â
This report documents the design and development of an Online Queue Management System tailored specifically for municipal offices in Nepal. Municipal offices, as critical providers of essential public services, face challenges including overcrowded queues, long waiting times, and inefficient service delivery, causing inconvenience to citizens and pressure on municipal staff. The proposed digital platform allows citizens to book queue tokens online for various physical services, facilitating efficient queue management and real-time wait time updates. Beyond queue management, the system includes modules to oversee non-physical developmental programs, such as educational and social welfare initiatives, enabling better participation and progress monitoring. Furthermore, it incorporates a module for monitoring infrastructure development projects, promoting transparency and allowing citizens to report issues and track progress. The system development follows established software engineering methodologies, including requirement analysis, UML-based system design, and iterative testing. Emphasis has been placed on user-friendliness, security, and scalability to meet the diverse needs of municipal offices across Nepal. Implementation of this integrated digital platform will enhance service efficiency, increase transparency, and improve citizen satisfaction, thereby supporting the modernization and digital transformation of public service delivery in Nepal.
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesMarjukka Niinioja
Â
Teams delivering API are challenges with:
- Connecting APIs to business strategy
- Measuring API success (audit & lifecycle metrics)
- Partner/Ecosystem onboarding
- Consistent documentation, security, and publishing
đ§ The big takeaway?
Many teams can build APIs. But few connect them to value, visibility, and long-term improvement.
Thatâs why the APIOps Cycles method helps teams:
đ Start where the pain is (one âmetro stationâ at a time)
đ Scale success across strategy, platform, and operations
đ Use collaborative canvases to get buy-in and visibility
Want to try it and learn more?
- Follow APIOps Cycles in LinkedIn
- Visit the www.apiopscycles.com site
- Subscribe to email list
-
Plooma is a writing platform to plan, write, and shape books your wayPlooma
Â
Plooma is your all in one writing companion, designed to support authors at every twist and turn of the book creation journey. Whether you're sketching out your story's blueprint, breathing life into characters, or crafting chapters, Plooma provides a seamless space to organize all your ideas and materials without the overwhelm. Its intuitive interface makes building rich narratives and immersive worlds feel effortless.
Packed with powerful story and character organization tools, Plooma lets you track character development and manage world building details with ease. When itâs time to write, the distraction-free mode offers a clean, minimal environment to help you dive deep and write consistently. Plus, built-in editing tools catch grammar slips and style quirks in real-time, polishing your story so you donât have to juggle multiple apps.
What really sets Plooma apart is its smart AI assistant - analyzing chapters for continuity, helping you generate character portraits, and flagging inconsistencies to keep your story tight and cohesive. This clever support saves you time and builds confidence, especially during those complex, detail packed projects.
Getting started is simple: outline your storyâs structure and key characters with Ploomaâs user-friendly planning tools, then write your chapters in the focused editor, using analytics to shape your words. Throughout your journey, Ploomaâs AI offers helpful feedback and suggestions, guiding you toward a polished, well-crafted book ready to share with the world.
With Plooma by your side, you get a powerful toolkit that simplifies the creative process, boosts your productivity, and elevates your writing - making the path from idea to finished book smoother, more fun, and totally doable.
Get Started here: https://www.plooma.ink/
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...Safe Software
Â
In todayâs data-driven world, efficiency is key. For Cadac, a Dutch leading provider of SaaS solutions and Autodesk Platinum partner, ensuring that customers can process data on demand is crucial to delivering a seamless experience. However, with fluctuating user demand, a challenge emerged: How do we scale FME Flow to meet on-the-fly processing needs without over-investing in infrastructure? Enter Kubernetes and KEDA (Kubernetes Event-Driven Autoscaling). In this presentation, we will explore how these cutting-edge technologies helped dynamically scale FME Flow engines based on real-time demand, without wasting resources. Instead of relying on the standard Kubernetes autoscaling based on CPU and RAM metrics, which can lead to ineffective scaling, KEDA can integrate directly with the FME Flow REST API. This allowed autoscaling based on the actual number and type of jobs in the queue. Now, whenever demand spikes, Kubernetes automatically spins up additional machines tailored to the type of workloadâwhether itâs CPU-intensive tasks or memory-heavy processesâensuring optimal performance and cost-efficiency. While afterwards also autoscaling to zero, to reduce costs. Join us as we dive into how this approach helped Cadac scale on demand, reduce infrastructure costs, and provide a better experience for their customers. This session will feature both a technical walkthrough and insights on the real-world impact and value this solution has delivered to their platform and client.
Integrating Survey123 and R&H Data Using FMESafe Software
Â
West Virginia Department of Transportation (WVDOT) actively engages in several field data collection initiatives using Collector and Survey 123. A critical component for effective asset management and enhanced analytical capabilities is the integration of Geographic Information System (GIS) data with Linear Referencing System (LRS) data. Currently, RouteID and Measures are not captured in Survey 123. However, we can bridge this gap through FME Flow automation. When a survey is submitted through Survey 123 for ArcGIS Portal (10.8.1), it triggers FME Flow automation. This process uses a customized workbench that interacts with a modified version of Esri's Geometry to Measure API. The result is a JSON response that includes RouteID and Measures, which are then applied to the feature service record.
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchMaxim Salnikov
Â
Discover how Agentic Retrieval in Azure AI Search takes Retrieval-Augmented Generation (RAG) to the next level by intelligently breaking down complex queries, leveraging full conversation history, and executing parallel searches through a new LLM-powered query planner. This session introduces a cutting-edge approach that delivers significantly more accurate, relevant, and grounded answersâunlocking new capabilities for building smarter, more responsive generative AI applications.
Traditional Retrieval-Augmented Generation (RAG) pipelines work well for simple queriesâbut when users ask complex, multi-part questions or refer to previous conversation history, they often fall short. Thatâs where Agentic Retrieval comes in: a game-changing advancement in Azure AI Search that brings LLM-powered reasoning directly into the retrieval layer.
This session unveils how agentic techniques elevate your RAG-based applications by introducing intelligent query planning, subquery decomposition, parallel execution, and result mergingâall orchestrated by a new Knowledge Agent. Youâll learn how this approach significantly boosts relevance, groundedness, and answer quality, especially for sophisticated enterprise use cases.
Key takeaways:
- Understand the evolution from keyword and vector search to agentic query orchestration
- See how full conversation context improves retrieval accuracy
- Explore measurable improvements in answer relevance and completeness (up to 40% gains!)
- Get hands-on guidance on integrating Agentic Retrieval with Azure AI Foundry and SDKs
- Discover how to build scalable, AI-first applications powered by this new paradigm
Whether you're building intelligent copilots, enterprise Q&A bots, or AI-driven search solutions, this session will equip you with the tools and patterns to push beyond traditional RAG.
Eliminate the complexities of Event-Driven Architecture with Domain-Driven De...SheenBrisals
Â
The distributed nature of modern applications and their architectures brings a great level of complexity to engineering teams. Though API contracts, asynchronous communication patterns, and event-driven architecture offer assistance, not all enterprise teams fully utilize them. While adopting cloud and modern technologies, teams are often hurried to produce outcomes without spending time in upfront thinking. This leads to building tangled applications and distributed monoliths. For those organizations, it is hard to recover from such costly mistakes.
In this talk, Sheen will explain how enterprises should decompose by starting at the organizational level, applying Domain-Driven Design, and distilling to a level where teams can operate within a boundary, ownership, and autonomy. He will provide organizational, team, and design patterns and practices to make the best use of event-driven architecture by understanding the types of events, event structure, and design choices to keep the domain model pure by guarding against corruption and complexity.
Build enterprise-ready applications using skills you already have!PhilMeredith3
Â
Process Tempo is a rapid application development (RAD) environment that empowers data teams to create enterprise-ready applications using skills they already have.
With Process Tempo, data teams can craft beautiful, pixel-perfect applications the business will love.
Process Tempo combines features found in business intelligence tools, graphic design tools and workflow solutions - all in a single platform.
Process Tempo works with all major databases such as Databricks, Snowflake, Postgres and MySQL. It also works with leading graph database technologies such as Neo4j, Puppy Graph and Memgraph.
It is the perfect platform to accelerate the delivery of data-driven solutions.
For more information, you can find us at www.processtempo.com
Best Inbound Call Tracking Software for Small BusinessesTheTelephony
Â
The best inbound call tracking software for small businesses offers features like call recording, real-time analytics, lead attribution, and CRM integration. It helps track marketing campaign performance, improve customer service, and manage leads efficiently. Look for solutions with user-friendly dashboards, customizable reporting, and scalable pricing plans tailored for small teams. Choosing the right tool can significantly enhance communication and boost overall business growth.
Key AI Technologies Used by Indian Artificial Intelligence CompaniesMypcot Infotech
Â
Indian tech firms are rapidly adopting advanced tools like machine learning, natural language processing, and computer vision to drive innovation. These key AI technologies enable smarter automation, data analysis, and decision-making. Leading developments are shaping the future of digital transformation among top artificial intelligence companies in India.
For more information please visit here https://www.mypcot.com/artificial-intelligence
The rise of e-commerce has redefined how retailers operateâand reconciliation...Prachi Desai
Â
As payment flows grow more fragmented, the complexity of reconciliation and revenue recognition increases. The result? Mounting operational costs, silent revenue leakages, and avoidable financial risk.
Spot the inefficiencies. Automate whatâs slowing you down.
https://www.taxilla.com/ecommerce-reconciliation
Bonk coin airdrop_ Everything You Need to Know.pdfHerond Labs
Â
The Bonk airdrop, one of the largest in Solanaâs history, distributed 50% of its total supply to community members, significantly boosting its popularity and Solanaâs network activity. Below is everything you need to know about the Bonk coin airdrop, including its history, eligibility, how to claim tokens, risks, and current status.
https://blog.herond.org/bonk-coin-airdrop/
How to purchase, license and subscribe to Microsoft Azure_PDF.pdfvictordsane
Â
Microsoft Azure is a cloud platform that empowers businesses with scalable computing, data analytics, artificial intelligence, and cybersecurity capabilities.
Arguably the biggest hurdle for most organizations is understanding how to get started.
Microsoft Azure is a consumption-based cloud service. This means you pay for what you use. Unlike traditional software, Azure resources (e.g., VMs, databases, storage) are billed based on usage time, storage size, data transfer, or resource configurations.
There are three primary Azure purchasing models:
⢠Pay-As-You-Go (PAYG): Ideal for flexibility. Billed monthly based on actual usage.
⢠Azure Reserved Instances (RI): Commit to 1- or 3-year terms for predictable workloads. This model offers up to 72% cost savings.
⢠Enterprise Agreements (EA): Best suited for large organizations needing comprehensive Azure solutions and custom pricing.
Licensing Azure: What You Need to Know
Azure doesnât follow the traditional âper seatâ licensing model. Instead, you pay for:
⢠Compute Hours (e.g., Virtual Machines)
⢠Storage Used (e.g., Blob, File, Disk)
⢠Database Transactions
⢠Data Transfer (Outbound)
Purchasing and subscribing to Microsoft Azure is more than a transactional step, itâs a strategic move.
Get in touch with our team of licensing experts via [email protected] to further understand the purchasing paths, licensing options, and cost management tools, to optimize your investment.
Providing Better Biodiversity Through Better DataSafe Software
Â
This session explores how FME is transforming data workflows at Irelandâs National Biodiversity Data Centre (NBDC) by eliminating manual data manipulation, incorporating machine learning, and enhancing overall efficiency. Attendees will gain insight into how NBDC is using FME to document and understand internal processes, make decision-making fully transparent, and shine a light on underlying code to improve clarity and reduce silent failures.
The presentation will also outline NBDCâs future plans for FME, including empowering staff to access and query data independently, without relying on external consultants. It will also showcase ambitions to connect to new data sources, unlock the full potential of its valuable datasets, create living atlases, and place its valuable data directly into the hands of decision-makers across Irelandâensuring that biodiversity is not only protected but actively enhanced.
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...Insurance Tech Services
Â
A modern Policy Administration System streamlines workflows and integrates with core systems to boost speed, accuracy, and customer satisfaction across the policy lifecycle. Visit https://www.damcogroup.com/insurance/policy-administration-systems for more details!
Generative Artificial Intelligence and its ApplicationsSandeepKS52
Â
The exploration of generative AI begins with an overview of its fundamental concepts, highlighting how these technologies create new content and ideas by learning from existing data. Following this, the focus shifts to the processes involved in training and fine-tuning models, which are essential for enhancing their performance and ensuring they meet specific needs. Finally, the importance of responsible AI practices is emphasized, addressing ethical considerations and the impact of AI on society, which are crucial for developing systems that are not only effective but also beneficial and fair.
Design by Contract - Building Robust Software with Contract-First DevelopmentPar-Tec S.p.A.
Â
In the fast-paced world of software development, code quality and reliability are paramount. This SlideShare deck, presented at PyCon Italia 2025 by Antonio Spadaro, DevOps Engineer at Par-Tec, introduces the âDesign by Contractâ (DbC) philosophy and demonstrates how a Contract-First Development approach can elevate your projects.
Beginning with core DbC principlesâpreconditions, postconditions, and invariantsâthese slides define how formal âcontractsâ between classes and components lead to clearer, more maintainable code. Youâll explore:
The fundamental concepts of Design by Contract and why they matter.
How to write and enforce interface contracts to catch errors early.
Real-world examples showcasing how Contract-First Development improves error handling, documentation, and testability.
Practical Python demonstrations using libraries and tools that streamline DbC adoption in your workflow.
Join the Denver Marketo User Group, Captello and Integrate as we dive into the best practices, tools, and strategies for maintaining robust, high-performing databases. From managing vendors and automating orchestrations to enriching data for better insights, this session will unpack the key elements that keep your data ecosystem running smoothlyâand smartly.
We will hear from Steve Armenti, Twelfth, and Aaron Karpaty, Captello, and Frannie Danzinger, Integrate.
7. ⢠A programming paradigm where
functions are first-class entities
⢠The main concepts are:
1. programming with functions
2. avoid mutation
⢠A new way of thinking
WHAT IS FP ?
8. ⢠Object Immutability
⢠Functions:
â as first class citizens
â no side effects (Pure functions)
â Higher Order Functions
⢠No loops
⢠Lazy evaluation
WHAT IS FP ? / FUNCTIONAL PRINCIPLES
9. ⢠Easier parallelization
⢠Less code
⢠Easy testing
⢠Results instead of steps
⢠Easy to understand code
WHAT IS FP ? / WHAT YOU GET ?
12. An immutable object is an object
whose state cannot be modified
after it is created
IMMUTABLE OBJECTS
13. âClasses should be immutable unless
thereâs very good reason to make them
mutable⌠If a class cannot be made
immutable, limit its mutability as much
as possibleâ
Joshua Bloch
IMMUTABLE OBJECTS
30. â˘Allows easy parallelism
â˘Encourages abstraction
â˘Reusing of common code
â˘Isolates the essential parts
â˘Allows easier unit testing
HIGHER ORDER FUNCTIONS
35. HIGHER ORDER FUNCTIONS / LAMBDA EXPRESSIONS
⢠A lambda expression is an anonymous
method
⢠Lambdas favor HOFs
⢠more powerful libraries
⢠more expressive, more readable, less
error-prone use code
⢠Boosts developer productivity
⢠key to an accessible parallelism strategy
44. A function is said to be pure if
1. it returns same set of values
for same set of inputs
2. It does not have any
observable side effects
PURE FUNCTIONS / DEFINITION
47. Impure functions / Side effects :
1. Alter parameters passed by ref
2. Alter members of passed
objects
3. Alter external objects
PURE FUNCTIONS / SIDE EFFECTS
49. ⢠sin(x)
⢠length(a)
⢠random()
⢠println(String s)
⢠Insert values(x, y, z) into DB_TABLE
PURE FUNCTIONS / SAMPLE OF PURE AND IMPURE FNC
50. ⢠easier to understand
⢠easy maintenance
⢠easy testing / unit-testing
⢠favor concurrency
PURE FUNCTIONS / PROS
68. NO LOOPS / FUNCTION CHAINING
⢠Similar to unix pipes :
ps -ax | tee processes.txt | more
⢠Already used in java in fluent interfaces
⢠Eliminate the need for intermediate variables
69. NO LOOPS / FUNCTION CHAINING
persons.stream()
.filter(e -> e.getGender() == Person.Sex.MALE)
.forEach(e -> System.out.println(e.getName()));
for (Person p : persons) {
if (p.getGender() == Person.Sex.MALE) {
System.out.println(p.getName());
}
}
70. NO LOOPS / AGGREGATE OPERATIONS
⢠They use internal iteration
⢠They process elements from a stream
⢠They support behavior as parameters
76. FUNCTIONS CHAINING / STREAMS IN JAVA 8
⢠Streams do not provide a means to directly access or
manipulate their elements
⢠are concerned with declaratively describing the
computational operations which will be performed in
aggregate on that source
⢠No storage: they carry values from a source through a
pipeline
⢠Functional in nature ( operations do not modify its
underlying data)
⢠Operations can be implemented lazily ( for single pass
execution & efficient implementation of short-circuit
operations)
⢠No bounds : streams can be infinite
86. OPTIONAL / NULL, THE BILLION DOLLAR MISTAKE
"I call it my billion-dollar mistake. It was the invention of the
null reference in 1965. [âŚ]
I couldn't resist the temptation to put in a null reference,
simply because it was so easy to implement.
This has led to innumerable errors, vulnerabilities, and system
crashes, which have probably caused a billion dollars of pain
and damage in the last forty yearsâ
Tony Hoare
87. OPTIONAL / THE SOLUTION TO NULL
java.util.Optional<T> :
⢠A class that encapsulates an optional value
⢠A single-value container that either contains
a value or doesn't (empty)
#2: Ce ne propunem ?
Prezentarea este destul de ambitioasa pentru ca ataca doua tinte: functional programming si java8 most important features.
Focusul va fi pe FP.
Disclaimer:
- codul in F#
#4: The evolution of the clock speed over time.
Unul din factorii care contribuiau la imbunatatirea puterii de calcul si-a oprit cresterea.
Este prima data cand legea lui Moore este pusa sub semnul intrebarii.
#5: Hardware-ul se schimba -> software-ul treâ sa se schimbe pentru a tine pasul.
Articol: The free lunch is over :
- processor manufacturers will focus on products that better support multithreading (such as multi-core processors)
- software developers will be forced to develop massively multithreaded programs as a way to better use such processors
(i.e: proasta calitate a codului, nu mai poate fi acoperita de imbunatatirea vitezei de calcul)
Codul nostru va rula distribuit intre core-urile procesorului.
#6: Evolutia limbajelor de programare.
A se nota faptul ca limbajele functionale au aparut cu mult inaintea limbajelor OOP.
Principiile din limbajele functionale se mapeaza mult mai bine pe ideea de multi threading / paralelism.
#9: Principiile FP derivate din cele doua concepte prezentate anterior
#10: Easier parallelization != No work for parallelization
Results instead of steps -> SQL
Verbe in locul substantivelor
#14: Imutabilitatea nu e ceva nou.
Este recomandata si-n OOP.
#15: No setters
Final fields
Final class
Java examples ?
#16: Un exemplu mai complex.
Unul din campurile clasei este mutabil.
Ultima metoda returneaza o copie defensiva pentru a evita mutabilitatea.
#18: Exemplu de clasa imutabila in F#.
Pentru a face un obiect mutabil trebuie utilizat cuvantul cheie âmutableâ
#19: Talk about the memory consumption and the extra work to be done by the garbage collector.
Extrapolate the example above to lists, trees, etc.
#21: Other benefits:
- don't need a copy constructor
- don't need an implementation of clone
- allow hashCode to use lazy initialization, and to cache its return value
- don't need to be copied defensively when used as a field
- make good Map keys and Set elements (these objects must not change state while in the collection)
- always have "failure atomicity" : if an immutable object throws an exception, it's never left in an undesirable or indeterminate state
#22: In loc de obiectul rational de mai devreme sa ne gandim ca avem o lista.add
Garbage collection: ok atata timp cat nu lucrezi la Twitter.
#25: This cannot be achieved in Java but ⌠talk about the new functional interfaces ; Predicate, Filter, âŚ
#26: HOFs can be assigned to variables
HOFs can be created at runtime and used
Functions are just as any other data types
#27: Sum accepts another function as input parameter
#28: higherOrderFunction returns a function as a result
#29: Functions as first class citizens
Functions as parameters
Functions as return values
#30: sumOfSquares -> easy abstraction â> sum (f)
Easy parallelism
#32: A new package added in java8
In java everything is a class -> functions are classes
#33: The most important java classes in the java.util.function package
All introduced in Java8
#37: Examples with the most important classes implemented as lambda expressions
#40: Cum acoperim toate situatiile ? Prin annotation : FunctionalInterface
A functional interface has only one abstract method.
Instances of functional interfaces can be created with lambda or method references
#41: This is how we use the Functional Interface annotation.
Note: the lambda expression used to define an anonymous definition of a Functional Interface
#42: Cum utilizam metodele deja existente ?
De observat referintele la metodele din clasele Math, Integer.
#47: Impure function -> it doesnât return the same values for the same inputs
#50: Sin = pure
Length = pure
Random() = impure
Println() = impure
SQL Insert = impure
#51: Easier to maintain: devs spend less time analyzing the impact
Once tested all edge conditions we can be sure that the function behaves correctly
Easy concurency: see next side/example
#52: No side effects favorizeaza paralelismul
The same input -> same output favorizeaza testarea si intelegerea
#53: Any write to the console is a side-effect.
Database updates or file writes on disk is a side-effect.
So we cannot be 100% pure but the goal is to be as pure as possible.
In an input â processâ output flow the goal is to keep the middle (process) functional.
#58: Pure functions
Function composition
HOF
Lambdas
Function references
#60: What is the problem ?
Incurajeaza shared state (variabilele partajate) = nu bine pt. paralelism
Mult boilerplate
#61: Why avoid loops ?
boilerplate code
Incurajeaza partajarea state-ului deci nu este prietenos cu multi-threadingul.
#63: In some cases ( most of them ? ) recursion is more intuitive then iteration.
Functional languages have better implementations for recursion
For OOP languages iteration is much faster than recursion
The mantra of functional languages: CLARITY TRUMPS EFFICIENCY (preferam claritatea vs. eficienta)
#64: the functionâs stack frame can be reused.
Remember stiva de executie a unei functii.
#65: After the call to factorial(n-1) there is still work to be done => not a tail recursive action
#66: Note: Since the stack trace is optimized, when printing the stack trace one will only see the last call instead of the entire stack trace.
#67: Functional languages have better support for recursion (see the list.head, list.tail)
This is not possible with all lists in idiomatic java.
#68: Function chaining = Un caz particular de compozitie
#69: To be discussed here:
Imperative approach vs. Functional approach :
For vs. map-reduce
State vs. stateless
#70: Discussion about state / share state ( in a multi-threaded env.) : letâs sum the salaries of males in a multi-threaded env.
Func. Chaining can be seen as a particular case of composition.
#71: Discussion about state / share state ( in a multi-threaded env.) : letâs sum the salaries of males in a multi-threaded env.
Func. Chaining can be seen as a particular case of composition.
#72: Note the chaining of combinator methods : map, filter, reduce/foldLeft
#73: The same functionality in Java8.
Imperative vs. Declarative style / Ce face functia vs. Cum face functia / The SQL Example.
Note 1: the stream() method
Note 2: a method added to a the list interface (DEFAULT METHODS discussion)
Discussion about map/filter/reduce
Weâll come back to map/reduce/filter in a few moments
#74: The average age of males in the persons list.
When using streams we need the following components:
1 A source ( list )
2.Zero or more intermediate operations ( filters, transformers)
3. A terminal operation ( average)
#76: The Stream interface and the map / reduce methods
#77: Streams cannot be reused.
Please check the Stream javadoc .
http://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html#StreamOps
#78: The stream could have been infinite
I could have used only lambdas
Note the findFirst method returning an optional (discussed later in this material)
Re-start the map/reduce discussion
#79: Reduce needs to be associative
(a+b)+c = a+(b+c), i.e. the order in which the additions are performed doesn't matter.
#81: Free parallelism but this doesnât happen every time
Sum() is a particular form of reduce() â a shortcut for reduce(0, (a,b) -> a+b)
reduce, collect, sum = terminal methods
Note: Order of filtering matters
#82: Note: the operation has to be associative otherwise the result will not be consistent (no compilation or runtime error)
Example of a non associative operation: x*x + y*y
Discussion about non-associative
#83: Disclaimer: the table shows the test results in ideal conditions ( no other threads were running) - in production systems you wonât get this kind of difference
#87: The problem with null: Depending on the context, null means âno valueâ, other times it means âerrorâ or ânothingâ, but it can even mean âsuccessâ
#93:
Idiot proof : It forces you to actively think about the absent case if you want your program to compile
There are three ways to deal with the absence of a value in an Optional: to provide a substitute value, to call a function to provide a substitute value, or to throw an exception
#95: Functional programming = no loops
Recursivitate
Function chaining
Function composition
Streams
Map / reduce
Default methods
Optional
#96: Functional programming = no loops
Recursivitate
Function chaining ( this is also related to composition)
Streams
Map / reduce
#97: Lambda instead of a Runnable
Runnable este o interfata functionala
#101: BufferedReader.lines() returns a Stream
Files.lines() returns a Stream as well. The examples shows how to use the stream in a try-with-resources ( it implements AutoClosable).
#102: Spring jdbc template with lambda expressions ( instead of RowMapper.mapRow(ResultSet, int rowNum)
#104: Outside the scope :
Advanced Laziness
Monads
Function currying
#105: Outside the scope :
Java8
------------------------------------
Type Annotations
Date and time API
Lambda translation to bytecode
Nashorn Javascript engine
#106: Easier parallelization != No work for parallelization
What instead of How
Verbe in loc de substantive
#108: Some non-programming mistakes have been intentionally inserted into the presentation
#111: Responsive: The system responds in a timely manner
Resilient: The system stays responsive even in failure
Elastic: The service allocates resources as needed ( according to the workload)
Message Driven: Async message passing for loose coupling, isolation, transparency