These are Java ways of functional style; pragmatic ways of understanding and introducing Lambda/Functional API.
你可以在以下找到中文說明:
http://www.codedata.com.tw/java/jdk8-functional-api/
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.
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIGanesh Samarthyam
This presentation provides a comprehensive overview of modern programming in Java. It focuses only on Java 8 features: Lambdas, Streams and Date Time API. It also briefly covers refactoring legacy Java code to Java 8.
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
An introductory presentation given to the Chicago Area Scala Enthusiasts (a) beginning with a recap of the Scala LiftOff unconference in Reston, VA, 2009, and (b) describing how to gradually migrate Scala code translated directly from Java into a DSL that facilitates readability and maintainability of client code. We then observe that this technique makes it possible to use Scala DSLs as a way to introduce Scala in a Java shop.
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoTaro L. Saito
Silk is a framework for building dataflows in Scala. In Silk users write data processing code with collection operators (e.g., map, filter, reduce, join, etc.). Silk uses Scala Macros to construct a DAG of dataflows, nodes of which are annotated with variable names in the program. By using these variable names as markers in the DAG, Silk can support interruption and resume of dataflows and querying the intermediate data. By separating dataflow descriptions from its computation, Silk enables us to switch executors, called weavers, for in-memory or cluster computing without modifying the code. In this talk, we will show how Silk helps you run data-processing pipelines as you write the code.
Functional programming and ruby in functional styleNiranjan Sarade
This presentation gives brief introduction to Functional Programming and how we can apply functional style of programming in Ruby language. The mentioned references are of great help to prepare this presentation. Especially video talks of Dr. Venkat Subramaniam. Some slides are from his presentation.
Functional programming (FP) is becoming popular day by day ! The initial learning curve for some of the functional languages like Lisp, Haskell, OCaml, Scala, Scheme, Clojure, etc. .... (there are many) might be high, but once you know the problem context and power of functions, you will work like a boss ! You will be more declarative than imperative !
Ruby is an Object Oriented (OO) language and we love Ruby, isn't it ? But once you understand the importance of FP, you would certainly want to apply FP concepts while writing Ruby code. In fact, you might have used some of those concepts unknowingly. Yes, we are talking about lambda, proc .. but, that's not all. Learn to unleash the power of Ruby in the hands of a functional programmer! You can write wonderful (and working) ruby code with functional style. In this presentation, I will briefly go through FP basics and then jump over to code examples.
Finally, it's all about changing your mindset! No one has stopped you to become a Boss !
Performance van Java 8 en verder - Jeroen BorgersNLJUG
We weten allemaal dat de grootste verbetering die Java 8 brengt de ondersteuning voor lambda-expressies is. Dit introduceert functioneel programmeren in Java. Door het toevoegen van de Stream API wordt deze verbetering nog groter: iteratie kan nu intern worden afgehandeld door een bibliotheek, je kunt daarmee nu het beginsel "Tell, don’t ask" toepassen op collecties. Je kunt gewoon vertellen dat er een ??functie uitgevoerd moet worden op je verzameling, of vertellen dat dat parallel, door meerdere cores moet gebeuren. Maar wat betekent dit voor de prestaties van onze Java-toepassingen? Kunnen we nu meteen volledig al onze CPU-cores benutten om betere responstijden te krijgen? Hoe werken filter / map / reduce en parallele streams precies intern? Hoe wordt het Fork-Join framework hierin gebruikt? Zijn lambda's sneller dan inner klassen? - Al deze vragen worden beantwoord in deze sessie. Daarnaast introduceert Java 8 meer performance verbeteringen: tiered compilatie, PermGen verwijdering, java.time, Accumulators, Adders en Map verbeteringen. Ten slotte zullen we ook een kijkje nemen in de keuken van de geplande performance verbeteringen voor Java 9: benutting van GPU's, Value Types en arrays 2.0.
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.
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.
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIGanesh Samarthyam
This presentation provides a comprehensive overview of modern programming in Java. It focuses only on Java 8 features: Lambdas, Streams and Date Time API. It also briefly covers refactoring legacy Java code to Java 8.
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
An introductory presentation given to the Chicago Area Scala Enthusiasts (a) beginning with a recap of the Scala LiftOff unconference in Reston, VA, 2009, and (b) describing how to gradually migrate Scala code translated directly from Java into a DSL that facilitates readability and maintainability of client code. We then observe that this technique makes it possible to use Scala DSLs as a way to introduce Scala in a Java shop.
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoTaro L. Saito
Silk is a framework for building dataflows in Scala. In Silk users write data processing code with collection operators (e.g., map, filter, reduce, join, etc.). Silk uses Scala Macros to construct a DAG of dataflows, nodes of which are annotated with variable names in the program. By using these variable names as markers in the DAG, Silk can support interruption and resume of dataflows and querying the intermediate data. By separating dataflow descriptions from its computation, Silk enables us to switch executors, called weavers, for in-memory or cluster computing without modifying the code. In this talk, we will show how Silk helps you run data-processing pipelines as you write the code.
Functional programming and ruby in functional styleNiranjan Sarade
This presentation gives brief introduction to Functional Programming and how we can apply functional style of programming in Ruby language. The mentioned references are of great help to prepare this presentation. Especially video talks of Dr. Venkat Subramaniam. Some slides are from his presentation.
Functional programming (FP) is becoming popular day by day ! The initial learning curve for some of the functional languages like Lisp, Haskell, OCaml, Scala, Scheme, Clojure, etc. .... (there are many) might be high, but once you know the problem context and power of functions, you will work like a boss ! You will be more declarative than imperative !
Ruby is an Object Oriented (OO) language and we love Ruby, isn't it ? But once you understand the importance of FP, you would certainly want to apply FP concepts while writing Ruby code. In fact, you might have used some of those concepts unknowingly. Yes, we are talking about lambda, proc .. but, that's not all. Learn to unleash the power of Ruby in the hands of a functional programmer! You can write wonderful (and working) ruby code with functional style. In this presentation, I will briefly go through FP basics and then jump over to code examples.
Finally, it's all about changing your mindset! No one has stopped you to become a Boss !
Performance van Java 8 en verder - Jeroen BorgersNLJUG
We weten allemaal dat de grootste verbetering die Java 8 brengt de ondersteuning voor lambda-expressies is. Dit introduceert functioneel programmeren in Java. Door het toevoegen van de Stream API wordt deze verbetering nog groter: iteratie kan nu intern worden afgehandeld door een bibliotheek, je kunt daarmee nu het beginsel "Tell, don’t ask" toepassen op collecties. Je kunt gewoon vertellen dat er een ??functie uitgevoerd moet worden op je verzameling, of vertellen dat dat parallel, door meerdere cores moet gebeuren. Maar wat betekent dit voor de prestaties van onze Java-toepassingen? Kunnen we nu meteen volledig al onze CPU-cores benutten om betere responstijden te krijgen? Hoe werken filter / map / reduce en parallele streams precies intern? Hoe wordt het Fork-Join framework hierin gebruikt? Zijn lambda's sneller dan inner klassen? - Al deze vragen worden beantwoord in deze sessie. Daarnaast introduceert Java 8 meer performance verbeteringen: tiered compilatie, PermGen verwijdering, java.time, Accumulators, Adders en Map verbeteringen. Ten slotte zullen we ook een kijkje nemen in de keuken van de geplande performance verbeteringen voor Java 9: benutting van GPU's, Value Types en arrays 2.0.
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.
Start programming in a more functional style in Java. This is the second in a two part series on lambdas and streams in Java 8 presented at the JoziJug.
Stream processing from single node to a clusterGal Marder
Building data pipelines shouldn't be so hard, you just need to choose the right tools for the task.
We will review Akka and Spark streaming, how they work and how to use them and when.
The big language features for Java SE 8 are lambda expressions (a.k.a. closures) and default methods (a.k.a. virtual extension methods). Adding closures to the Java language opens up a host of new expressive opportunities for applications and libraries, but how are they implemented? You might assume that lambda expressions are simply a compact syntax for inner classes, but, in fact, the implementation of lambda expressions is substantially different and builds on the invokedynamic feature added in Java SE 7.
Data Summer Conf 2018, “Hands-on with Apache Spark for Beginners (ENG)” — Akm...Provectus
In this presentation you can find spark workshopnotes. Attendees will use Apache Spark to undertake some simple calculations and solve some data manipulation problems. Through Python programming exercises, attendees will be able to get some hands-on experience with Spark using a cloud-based environment. The goal is to show the power of Spark, without needing to understand its complexity. Preparation for workshop: Detailed instructions will be provided closer to the event. However, essentially, attendees would need to create a free Databricks Community Edition (CE) account and bring their laptop with them. The workshop would require good wifi to connect to CE, hosted in the USA.*
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
11. Filtering tracks over a minute and collecting to a List
Mapping tracks to names and collecting to a Set
11
12. An Intermediate operation, why don't we chain them together?
Filtering tracks over a minute, mapping tracks to names and collect to a Set
Well, what's stream?
We may just use
map(Track::getName)
instead.
12
14. •The stream method returns a Stream instance, not a new collection.
•The filter or map method returns a Stream instance, too.
•The collect(toSet()) returns a Set<String> instance as a result.
14
15. •The Stream instance draw data from the source, could be a collection, an array, a generator function, or an I/O channel.
–collection.stream()
–Arrays.stream(array)
–Files.lines(Paths.get(fileName))
–…
•An intermediate operation, such as filter, produces a new Stream instance.
•A terminal operation, such as forEach, produces a non-stream result.
15
16. •Intermediate operations are lazy…
•You don't have to close streams provided by JDK8 except Files.line, list and walk.
•Compared with the eager way.
16
17. •Why does Stream's findFirst return Optional?
•Maybe there's no the first one … Why not null?
•Which method of Stream returns Optional?
–Optional<T> findAny()
–Optional<T> findFirst()
–Optional<T> max(Comparator<? super T> comparator)
–Optional<T> min(Comparator<? super T> comparator)
–Optional<T> reduce(BinaryOperator<T> accumulator)
Null sucks.
Doug Lea
I call it my billion- dollar mistake.
Tony Hoare
17
18. •Whether an Optional instance containing a value or not is optional, so make appropriate checks to avoid bugs.
•Creating an Optional instance…
–Optional.empty()
–Optional.of(value)
–Optional.ofNullable(value)
•Getting the value orXXX?
–T orElseGet(Supplier<? extends T> other)
–T orElseThrow(Supplier<? extends X> expsp)
18
19. •Checking by yourself?
•Invoking the specified consumer if a value is present.
•Invoking the specified consumer if the value matches the given predicate.
NoSuchElementException if no value.
19
20. •Wait! I see wired method signatures in previous examples….Supplier, Consumer, Predicate…What're those types?
•Important functional interfaces used time and time again in JDK8.
Interface
Arguments
Returns
Consumer<T>
T
void
Function<T, R>
T
R
Predicate<T>
T
boolean
Supplier<T>
none
T
20
22. •Function<T, R>
–Sub interface: UnaryOperator<T>
•Predicate<T>
apply
T
R
apply
T
T
test
T
boolean
Predicate
Function
22
23. •Supplier<T>
•Fail fast examples if an Optional instance contains no value.
•Avoiding performance overhead.
get
none
T
NoSuchElementException
23
24. •To avoid performance overheads, the streams library has primitive versions. They have a clear- cut naming convention.
•Streams for primitives.
–IntStream
–LongStream
–DoubleStream
•Functional interfaces for primitives.
–XxxConsumer
–XxxPredicate
–XxxSuppiler
–XxxToOooFunction
accept
xxx
void
test
xxx
boolean
getAsXxx
none
xxx
applyAsOoo
xxx
ooo
24
25. •Functional interfaces for mapping objects and primitives.
–XxxFunction<R>
–ToXxxFunction<T>
•Several functional interfaces starts with Bi- prefix. Take BiConsumer<T, U> for an example.
apply
xxx
R
applyAsXxx
T
xxx
accept
(T, U)
void
25
27. •How long of all long tracks?
•Reduce? Sometimes it's called as fold(left).
27
28. •The max length?
•Reduction operations
–Terminal operations that return one value by reducing the contents of a stream.
–(Reduce, fold or combine, whatever you call it.)
28
29. •How to reduce the elements of a stream to a more complex object, such as a collection?
•Using collect methods…
29
30. •The Collectors.toXxx method, such as toSet, doesn't return a Set but a Collector.
•The Collectors provides factory methods for creating out-of-box Collector …
•Grouping …
•Grouping and mapping …
30
31. •Grouping and reducing …
•Grouping and averaging …
•The stream library picks an appropriate implementation for you.
31
32. •You might wish to collect your values into a specific Collection.
•Implementing your own Collector…
–supplier、accumulator、combiner、 finisher
Creating a new mutable result container
Reducing a value into a mutable result container
Accepting two partial results and merging them
Performing an optional final transform on the container
32
35. •Concurrency
–Two tasks are making progress at overlapping time periods.
•Parallelism
–Two tasks are happening at literally the same time.
Task 1
Task 2
Core 1
Core 2
Task 1 Task 2
Core 1
Core 2
35
36. •Changing a single method call…
•Making an operation execute in parallel…
36
37. •The Java runtime performs a concurrent reduction if …
–The stream is parallel.
–The Collector has the characteristic Collector.Characteristics.CONCURRENT
–Either the stream is unordered, or the Collector has the characteristic Collector.Characteristics.UNORDERED.
•Built-in concurrent-supported collector
–groupingByConcurrent
–toConcurrentMap
37
39. •Interference
•Performance
–Data size、source data structure、number of cores、cost per element …
•Simply speaking…
–Executing in parallel without worrying about tools doesn't mean there is a free lunch.
Don't do this!!
ConcurrentModifiedException
39
46. Summary
•Functional? You've done that when you are …
–Refactoring your existing code …
–Applying filter, map, reduce …
–Returning Optional instead of null …
–Considering issues of parallelism when using parallel tools, such as parallelStream …
–Or even using those monadic API of Java 8 …
•These are Java ways of functional style; pragmatic ways of understanding and introducing Lambda/Functional API
46
47. Exercise:
–Completing Chapter 1
–Using functional API to refactor Customer again
47
MonsterSupreme
Lambda 就是 重構(重構(程式碼))
Lambda is a way to refactor refactored code