Java 8 introduced parallel streams to allow collections to be processed in parallel using multiple threads. While parallel streams can improve performance by splitting work across CPU cores, they also introduce challenges. Parallel streams use the ForkJoinPool by default, so long-running or blocking tasks could impact other parallel operations. Side effects must also be avoided. Parallel streams may not provide benefits with a single CPU or for I/O-bound work. Developers must consider hardware resources and task dependencies to determine if parallel streams are applicable.
- Fluent Decorator
- In, Out, In, Out, Shake It All About
- The Lonely Override
- Monad
- Functional Reactive?
你可以在以下找到中文說明:
http://www.codedata.com.tw/social-coding/java8-patterns/
Kotlin is new JVM language still cooking in Jetbrains kitchen. It looks awesome compared to Java 7, but now, with Java 8 in the field, the question arises: “Does Kotlin still have enough advantages over Java to attract Java developers?” Similar questions could be asked for other JVM languages like Scala, Ceylon, Clojure. We tried to compare new features of Java 8 with corresponding features of Kotlin and see what Kotlin offers beyond features existing in latest Java release.
Introduction to Akka, as presented on May 3 2012 at the Belgian Java User Group (BeJUG). For more details see: http://www.bejug.org/confluenceBeJUG/display/BeJUG/ForkJoin+and+Akka
Demo code can be found at: http://bit.ly/bejug-akka
- Fluent Decorator
- In, Out, In, Out, Shake It All About
- The Lonely Override
- Monad
- Functional Reactive?
你可以在以下找到中文說明:
http://www.codedata.com.tw/social-coding/java8-patterns/
Kotlin is new JVM language still cooking in Jetbrains kitchen. It looks awesome compared to Java 7, but now, with Java 8 in the field, the question arises: “Does Kotlin still have enough advantages over Java to attract Java developers?” Similar questions could be asked for other JVM languages like Scala, Ceylon, Clojure. We tried to compare new features of Java 8 with corresponding features of Kotlin and see what Kotlin offers beyond features existing in latest Java release.
Introduction to Akka, as presented on May 3 2012 at the Belgian Java User Group (BeJUG). For more details see: http://www.bejug.org/confluenceBeJUG/display/BeJUG/ForkJoin+and+Akka
Demo code can be found at: http://bit.ly/bejug-akka
In this talk I describe some challenges in making my hotruby, a JVM-based Ruby implementation that was never finished.
http://github.com/krestenkrab/hotruby
In this workshop we would like to take a closer look at the new features of Java 7 and Java 8.
Java 7 has brought a couple of language enhancements to assist developers in their daily programming tasks and starting from Java 8 we finally have the opportunity to include a functional programming touch to Java thanks to Lambdas! Lambdas allow us to specify closures to create clean and brief solutions for which we would otherwise be obligated to write down a lot of boilerplate code.
For example in order to sort a List of Strings based on their length we can now write the following code:
Collections.sort(list, (s1, s2) -> s1.length() - s2.length());
Besides lambdas, Java 8 also comes with extension methods, allowing us to write interfaces containing implemented methods, streams and bulk data operations, granting us the opportunity to chain operations on collections to obtain a filtered or transformed set of the elements in our collection, and the possibility to pass functions as parameters. These features alone will have a major impact on the way how Java APIs can be written. There's also a brand new Date and Time API inspired on the popular JodaTime API and a couple of other language enhancements to aid Java developers in writing solutions in a more elegant way.
Be sure to follow this workshop to stay up to date with the latest evolutions of the Java programming language. Java 8 is definitely an update of the programming language which you don't want to miss out on!
We will cover whole of the web development basics comprising of HTML, CSS, JavaScript in this series.
Following are topics useful for any newbie to intermediate who is interested in learning Web Development
Agenda
Setting up an angular app.
Introduction to tools - Babel, Webpack
Alternative to Gulp, Grunt & Bower.
Writing Controllers, Services, Directives etc..
Testing Javascript with Jasmine.
Setting up Karma with Webpack.
Let’s understand code coverage.
An alternative: JEST
The slides from the talk I gave at Oracle III #JuevesTecnológicos in Madrid.
A review of how the ParallelStreams Work in Java 8 and some considerations we must know in order to get the better performance from the concurrent data processing in #Java8
Harnessing the Power of Java 8 Streams IndicThreads
Presented at the IndicThreads.com Software Development Conference 2016 held in Pune, India. More at http://www.IndicThreads.com and http://Pune16.IndicThreads.com
--
In this talk I describe some challenges in making my hotruby, a JVM-based Ruby implementation that was never finished.
http://github.com/krestenkrab/hotruby
In this workshop we would like to take a closer look at the new features of Java 7 and Java 8.
Java 7 has brought a couple of language enhancements to assist developers in their daily programming tasks and starting from Java 8 we finally have the opportunity to include a functional programming touch to Java thanks to Lambdas! Lambdas allow us to specify closures to create clean and brief solutions for which we would otherwise be obligated to write down a lot of boilerplate code.
For example in order to sort a List of Strings based on their length we can now write the following code:
Collections.sort(list, (s1, s2) -> s1.length() - s2.length());
Besides lambdas, Java 8 also comes with extension methods, allowing us to write interfaces containing implemented methods, streams and bulk data operations, granting us the opportunity to chain operations on collections to obtain a filtered or transformed set of the elements in our collection, and the possibility to pass functions as parameters. These features alone will have a major impact on the way how Java APIs can be written. There's also a brand new Date and Time API inspired on the popular JodaTime API and a couple of other language enhancements to aid Java developers in writing solutions in a more elegant way.
Be sure to follow this workshop to stay up to date with the latest evolutions of the Java programming language. Java 8 is definitely an update of the programming language which you don't want to miss out on!
We will cover whole of the web development basics comprising of HTML, CSS, JavaScript in this series.
Following are topics useful for any newbie to intermediate who is interested in learning Web Development
Agenda
Setting up an angular app.
Introduction to tools - Babel, Webpack
Alternative to Gulp, Grunt & Bower.
Writing Controllers, Services, Directives etc..
Testing Javascript with Jasmine.
Setting up Karma with Webpack.
Let’s understand code coverage.
An alternative: JEST
The slides from the talk I gave at Oracle III #JuevesTecnológicos in Madrid.
A review of how the ParallelStreams Work in Java 8 and some considerations we must know in order to get the better performance from the concurrent data processing in #Java8
Harnessing the Power of Java 8 Streams IndicThreads
Presented at the IndicThreads.com Software Development Conference 2016 held in Pune, India. More at http://www.IndicThreads.com and http://Pune16.IndicThreads.com
--
Aim of this presentation is not to make you masters in Java 8 Concurrency, but to help you guide towards that goal. Sometimes it helps just to know that there is some API that might be suitable for a particular situation. Make use of the pointers given to search more and learn more on those topics. Refer to books, Java API Documentation, Blogs etc. to learn more. Examples and demos for all cases discussed will be added to my blog www.javajee.com.
Presentazione Introduttiva all'Arduino Day 2015 tenutosi in Ludoteca Archimedea: "Arduino Uno nessuno e Centomila" quale e' la vera personalita' di Arduino? Scopriamo solo una piccola parte dei diversi impieghi e ambiti di potenziale applicabilita' che ha la schedina elettronica in ambito prototipazione, educational e hobby.
Sono illustrati anche i progetti svolti in collaborazione con il Politecnico di Milano Dipartimento di Design del Prodotto in cui Arduino ha reso "smart", interattive, le idee dei designer.
Java 9 is just around the corner. In this session, we'll describe the new modularization support (Jigsaw), new JDK tools, enhanced APIs and many performance improvements that were added to the new version.
Visual Studio 2010 and the .NET Framework 4 enhance support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. This presentation is all about parallel programming and its features.
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesLauren Yew
Kotlin Coroutines is a powerful threading library for Kotlin, released by JetBrains in 2018. At The New York Times, we recently migrated our core libraries and parts of our News app from RxJava to Kotlin Coroutines. In this talk we’ll share lessons learned and best practices to understand, migrate to, and use Kotlin Coroutines & Flows.
In this presentation, you will learn:
What Coroutines are and how they function
How to use Kotlin Coroutines & Flows (with real world examples and demos)
Where and why you should use Coroutines & Flows in your app
How to avoid the pitfalls of Coroutines
Kotlin Coroutines vs. RxJava
Lessons learned from migrating to Kotlin Coroutines from RxJava in large legacy projects & libraries
By the end of this talk, you will be able to apply Kotlin Coroutines to your own app, run the provided sample code yourself, and convince your team to give Kotlin Coroutines a try!
Creating an API service providing REST and GraphQL end points.
With use of Kotlin multi platform to provide shared data models.
https://gitlab.com/AnimusDesign/KotlinIMDBDemo
5. Lambda Expression
• Java 8 support Lambda Expression then officially support functional
programming paradigm
• Lambda comes from the Lambda Calculus and refers to anonymous
functions in programming
• Lambda Expression
• Method argument 必須為一個 Functional Interface
• Functional Interface : Single Abstract Method interface(SAM interface)
• Ex : java.lang.Runnable, java.util.Comparator
12. Stream
• Short circuit example
• ( fn1() || fn2() )
• if fn1() is true , fn2() will not execute
• ( fn1() && fn2() )
• if fn1() is false , fn2() will not execute
17. Let’s look some examples~
In Java7, We do that......
https://www.dropbox.com/s/dyx9rpxj53ofyxb/%E8%9E%A2%E5
%B9%95%E6%88%AA%E5%9C%96%202015-11-
01%2000.19.44.png?dl=0
21. Fork
• each subtask can be executed in parallel by different CPUs, or
different threads on the same CPU.
• The limit for when it makes sense to fork a task into subtasks is
also called a threshold. It is up to each task to decide on a sensible
threshold. It depends very much on the kind of work being done.
22. Join
Once the subtasks have finished
executing, the task may join (merge) all
the results into one result.
23. ForkJoinPool
A special thread pool which is designed to work well with
fork-and-join task splitting.
Example:As a parameter to the ForkJoinPool constructor
you pass the indicated level of parallelism you desire.
ForkJoinPool forkJoinPool = new ForkJoinPool(8);
As a parameter to the ForkJoinPool constructor you pass
the indicated level of parallelism you desire.
24. ForkJoinPool
You can submit two types of tasks. RecursiveAction and
RecursiveTask.
Action won’t return any result, just compute but task will return
something.
25. ForkJoinPool
You can submit two types of tasks. RecursiveAction and
RecursiveTask.
Action won’t return any result, just compute but task will return
something.
27. Parallel Stream is good or
not good?
Discuss Parallel Stream Good and Bad
28. Parallel Stream Problem
• Java 8 parallel streams may be
faster,not faster or slower
• streams 方法以低成本達到平行處
理(parallel processing)的方便性,
but they do almost in a ‘Black
Box’
• parallel processing != concurrent
processing. But most in Java 8
「automatic parallelization」
example like concurrent
processing.
30. Streams Good for
• They allow functional
programming style using
bindings.
• They allow for better
performance by removing
iteration. Iteration occurs with
evaluation. With streams, we can
bind dozens of functions without
iterating.
• Streams may be infinite.
Functions may be bound to
infinite streams without problem.
=>a short circuiting operation
31. Side Effect
• All streams use the same
ForkJoinPool=>very long
running task=> many long
running sub-tasks => use
each thread in pool
• one parallel subtask
performing I/O has side
effects on others
• Two Parallel Streams In One
ForjoinPool=>Occupied
Threads use
32. Use For Recommand
• Applicable
• Multi CPU
• Unrelation in I/O
• Split Pool & Num Setting
• Collection,Array…
• Not Applicable
• One CPU =>not good in performance
• In I/O Work
• Suggest:
• Don’t use in default ForkJoinPool(If WorkingTask and Server Setting
tolerate…)
33. Conclusion
• Parallel Stream seem to convenience and many benefits,but how many
question behind that is not known?
• Parallel streams is Unpredictable, and hard to be run in Correct
• All most of Parallel Stream Using can’t be predictable to know the
performance of the Normal and Unrelated process。
• Please ‘Parallel Stream’ easy to allay it…(Or if you have a high skill…)