Here are my notes from the talks I attended on Day Three at CodeOne (the successor toJavaOne). We have a summary report on our 4 highlights from Oracle CodeOne and you can find Monday’s here, Tuesday’s here, and Thursday’s here.
I have added my takeaways at the end of each. Any mistakes or omissions are mine. Please add comments if you would like any items expanded.
Java Debugging Tips [DEV4512]
- Speaker works for Kantega (video – mysterious life of developers – note satire)
- 1. Code evaluation
- Personal pref always launch in debug as can then debug as you go along if you need.
- Not slow if you remove or mute breakpoints
- IDEA has option to mute breakpoints
- Eclipse can debug code in JShell
- 2. Controlling steps and breaks.
- Step filters allow you set depth so avoid going into java.lang (set in preferences). You can also add stepping filter in debug output window
- In IDEA green is test code, yellow is library code in debug window
- IDEA has smart step into feature
- NetBeans has step over
- IDEA has stream trace button on top of debug window
- IDEA has filters on exception breakpoints and break after allows you to break after certain point in code if you know general area of bug
- 3. Manipulating code flow
- You can change value of running values including final
- 4 Tracking classes and objects
- IDEA offers view of all loaded classes in debug window with some cool filter options (ie new since, all instances of, eval on method ie this.length()>500)
- Objects can be marked and color-coded for clarity in IDEA
- Watch points let you find where the data is changed
- IDEA can limit breakpoints to a specific instance
- 5. Customising the debugger
- Eclipse offers a show logical structure to give simplify view for complex objects. Presets and you can create your own. In IDEA use view as menu option on object
- 6. Debugging concurrent code
My takeaways – Lots of useful debugging features nicely documented
Angular for Java Developers [DEV4345]
- why talk about angular? ideal front end framework for java devs
- component based and modular, dependency injection, typescript, RxJS
- Template engine with model binding
- powerful CLI
- build with Webpack
- written in html/typescript
- some nice angular demos
- All code for demos and step-by-step instructions on GitHub on https://github.com/bertjan/a4jd
- polyfills provided functionality in older browsers
- package.json handles dependencies
- can be written in IDE and debugged live in browser
- ccs is isolated to each component not global
- Services and routes define communications with backend
My takeaways – great introduction to angular for Java devs. The demos on GitHub are worth downloading even if you missed the talk
Performance After Eight [DEV5523]
- JDK8 biggest release in Java history.
- jdk 11 next LTS
- Faster startup in 11 than 8
- jVM startup always faster than from jar as unzip and extract overhead. actually slower with modules as well unless using jlink in which case fast as classpath
- AOT faster than all above
- jep 243 – java-level Jvm compiler interface – hook onto Jvm to allow jam as be used as dynamic compiler.
- jep 248 – g1 now default garbage collector
- You want to run java10 not 9 if using g1
- jep 254 : compact strings allows use of 1byte for strings if 2 not used. -XX:-compressed\strings gives much better performance in 11 (same as 8) whereas can be slower otherwise as compressing on fly.
- jep280 indify string concatenation. commands to choose strategy on startup
- convenience factory methods (List.of, Map.of, Set.of).
- jep 259 stack-walking API. New stack-walker class
- jdk-api-diff tool will show changes between JDKs
My takeaways – good summary of new features and stats to show improvements in JDK11
CompletableFuture: The Promises of Java [DEV5375]
- Java offer promises – may, resolve, reject or pending.
- data and error channel
- treats data like error
- easy to compose
- CompletableFutures are promises in Java
- CompletableFuture from Java8
- Code is non-blocking so running in thread pool . Can run on main thread if non-blocking
- Pool can be changed to your own
- thenAccept is the consumer method (ie forEach). But at most one data or error
- CompletableFuture never actually completes
- thenApply is equivalent of Map function in stream. Can be chained
- dealing with exceptions
- exceptionally() allows you to setup throwable. Allows you to substitute new value. Can have more than one
- Major thing missing in java8 – dealing with timeout where we have a live lock – waiting for event which will never happen
- In life and programming don’t do anything without timeout
- Timeout added in Java9 .completeOnTimeout() and .orTimeout() – always use a timeout of some kind
- combine with .thenCombine() (like Stream combine)
My takeaways – Very clear explanation of non-blocking CompletableFuture, how it works and how it uses threads
Functional Programming in Java, Groovy, and Kotlin [DEV5659]
- Kotlin fastest growing languages, (groovy 9)
- Kotlin adoption being driven by Android
- Java has lambda with Single Abstract Method interfaces
- No lambda class (Groovy has class closure, Kotlin has own syntax).
- Closure implies function closed over execution environment
- new version of kotlin native which can provide code for iOS, android, etc
- Java adds methods to Stream not collections – opposite in Kotlin and groovy
- kotlin is a synthesis of many other languages.
- groovy ises closures for lambda
- groovy generally assumes running with Java
- groovy can invoke a stream on Collection
- kotlin uses fun keyword to define function
- Java streams are lazy. kotlin/groovy collections are not
- asSequence() will give lazy init in kotlin
- Groovy has POGOs (can include @canonical to add public getters/setters, etc) like Java has POJOs
- Kotlin has data classes and generates methods
My takeaways – Good summary of Functional programming and language differences. shows dhow the languages can work together
Which Java Version from Which Vendor with What Support? [DEV5125]
- rapid changes since last year and Java9 release.
- jigsaw first mentioned in 2011.
- java9 slipped from sept 2016 to 2017
- releases 1.0 then 5 then also 2018.3 (10)
- Major version needs a major version number
- Smaller features in any
- 2 JDKs oracle (every 3 years) and openjdk (free and every 6 months)
- LTS = patches , support
- Oracle supporting 6 to late 2018, 7 until 2022, 8 until 2025
- oracle supporting 11 to 2034 (no 9/10 support). Free patches for 6 months
- no commercial stuff in oracle JDK and browser plugin, Javafx, web start removed
- Redhat will be backporting security patches after 6 months.
- Lots of other companies provide JVMs or patches (Azul, IBM)
- Backporting is non-trivial
- Azul offering support on LTS and non-LTS
- Also AdoptJDK, IBM, RedHat, SAP
My takeaways – Nice clear summary of support levels from Oracle and alternatives which others are providing
Java Garbage Collectors’ Current Performance Impact [DEV6005]
- 5 production GCs +more experimental
- G1GC default since Java9 (replace Parallel)
- ZGC – new experimental
- EpsilonGCC – just for experiments
- Serial – small memory
- Best GC depends on what you need.
- config options – common GC (50, Parallel (6) ZGC (8) G1 (26) CMS (72)
- GC always costs?
- Several demos looking at different GC behaviour
- ZGC has no write barriers/ read barriers – opposite of others.
- Loop strip mining fixes GC issue in 10 and later
- No universal GC Parallel (high throughput), G1 (low pauses), ZGC (extra-low pauses).
- GC better in later Java releases so upgrade if you can.
My takeaways – Overview of different GCs on offer and how they work. If you still on Java8, GC default will change when you move up.
Keynote: Groundbreakers: The Code Avengers [KEY6651]
- IBM started with heavy cloud focus (especially IBM cloud)
- Cloud brings new set of challenges.
- update on Jakarta – 4 sponsors, community of 200 committers, millions of lines of code now on servers
- focus on Jakarta EE will link up with MicroProfile in near future. Make it easier to built cloud-native applications.
- More polygot environments and support in JVM.
- Cloud native apps making much more use of services (ie bots, AI).
- J9 JVM open sourced JVM and now OpenJ9 as part of Eclipse
- JIT becomes a cloud service. Demo to show this.
- AdoptOpenJDK team explain how people can get involved. Grew out of London JUG idea. Supports additional platforms (ie ARM) including RaspberryPi. Aim to make it easier to build and interact. 300-400 developers involved and sponsors include IBM, Ocado and other Companies. Aiming to provide 4 year support for LTS releases.
- Stephen Chin on stage as Dr. Strange with the avengers theme….
- Jug leaders on stage as assorted characters organising search for infinity stones
- Unconference crowd on stage.
- JCP labs onstage
- Sean Phillips and Sven Reimers tells us about java beyond the cloud.
- And we save the world…
My takeaways – Lots of noise on Cloud native. Usual silly show with Community members.
Did you know...
IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?
It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page