[2019 oracle code one] modules

Java Modules: Why and How?

Speaker: Venkat  Subramaniam @venkat_s

For more blog posts, see The Oracle Code One table of contents



Why modules?

  • Modules designed to make the JDK itself modular
  • It’s like bringing these 70 suitcases with you on vacation in case you need something.
  • Better security. Can’t create another jar with same package and access package private.
  • Easier to make new things secure
  • In law mode – The build team drops a few jars until you call that functionality and get class not found. With modules, runs in mother mode. Pre-check what need. Fail fast
  • Reuse release equivalency principle – reuse the whole of what released. USPS gives partial packages. Don’t want that. You export packages but receive/require module. This is a handshake. Both have to extend hands. One must export and the other must require.

Module example

  • Showed compiling, jarring up and running the java command
  • -p modulePath
  • -m modName/my.package.MyClass
  • jar -f myJar.jar -d – tells you about jar file metadata. Will show derived info for old modules that lack formal metadata

Module types

  • Unnamed module – exactly one. Contains everything you dump in the classpath. Whether it is a module jar or not
  • Automatic module – legacy jars on module path
  • Explicitly named modules – jars with module descriptor on module path

Module info

  • exports – package that other code on module path should be able to access.
  • Public is no longer public. Public without exports is not available
  • requires – want to use module
  • requires transitive – never use for third party library. Only use when refactoring a ball of mud into pieces

Rules

  • Any jar running in the classpath is called an unnamed module
  • Any transitional jar running in the module path is called an automatic module
  • Any jar with a module descriptor running in t classpath is a n unnamed module
  • Any jar with a module descriptor running in the modulepath is an explicitly nmaed module
  • Modules can’t share packages
  • Unnamed modules can talk to other unnamed modules
  • Automatic modules can talk to other automatic modules
  • Automatic modules can talk to unnamed module
  • Unnamed modules cannot talk to automatic module (Get class not found across module path/classpath when can’t access because doesn’t even look there)
  • An explicit named module can talk to other explicit named modules
  • An explicit named module can talk to automatic modules
  • An explicit named modules cannot talk to unnamed module
  • An explicit named module has to require any modules it needs incudling automatic modules (so please give a decent name)
  • An explicit named module exports only what it specifically exports
  • An unnamed module automatically exports all its packages

Migration path

  • Run all in classpath in old Java
  • Run all in classpath in latest Java
  • Fix any errors
  • Run them all in module path
    Give names for automatic modules
  • COnvert from top to bottom to explict modules

My take

I like Venkat’s laptop stand so he can type and use the computer. I also enjoyed seeing his enthusiasm. I’ve been writing about modules lately so seeing it explained a different way is useful. The demos are good. The list of rules is a good reference (or review) as well

[2019 oracle code one] java keynote

For more blog posts, see The Oracle Code One table of contents


Quantum Computing – Jessica Pointing

Good analogy to electric bike

  • Fundamentally new type of computer
  • Solves specific type of problems faster
  • Encryption
    • 100 seconds to find multipliers of very large number
    • Shor’s algorithm
    • Can break encryption methods.
    • Need a large quantum computer to do so which hasn’t been built yet
    • Research on post quantum cryptography
  • Simulate atoms and molecules
    • Can simulate interactions and discover new medicines
    • Can design new materials
  • Quantum machine learning
  • Unstructured search – can find match in square root of n tries – grover’s algorithm
  • Superposition – can see multiple states at same time. This means can process multiple states at same time.
  • 10^90 states if have 300 qbits
  • Quantum gates – combine to solve problem
  • At end of quantum algorithm, do measurement to get classical result
  • Upcoming book: Quantum Computing for Java Developers Code examples: https://github.com/johanvos/quantumjava
  • Can build quantum computers with superconductors, trapped ions, photons (light), diamonds. Still TBD which is equivalent of transitiors.
  • Currently 50 physical quantum bits
  • Goal is large scale quantum computer with millions of qbits
  • Currently compare quantum algorithm to best classical supercomputers
  • MATHS – Milestone, Applications, Theory, Hardware, Shift

Java SE

Stability – Gil Tene (Azul) and Bruno Souza

  • Java surfing to the cloud Duke is the Java 13 mascot
  • Need to keep stability with faster cadence
  • JCP was 20 years old last year
  • Need compatibility/stability so companies can compete on their products
  • TCK ensures compatibility

Motivation – Videos

  • Migrating to Java 11 Modules
  • Most widely used libraries now work with Java 9+ plus
  • Plugged Java 13 and licensing/support [If you care about support, you should be on 11 not 13]
  • Keep dependencies up to date so easy to upgrade and should anyway [we should also floss every day]

Compatibility – Three people [missed names but one is Mala Gupta]

  • New Relic will be compatible with Java 13 this month
  • CI/CD pipeline. Run tests against multiple JDKs.
  • Early access builds of 14 already availability
  • Used to take months/years for IDE to support
  • JetBrains has 4 months release cycle. Release new version with all new language features

Subscription – Sabre

  • When down, passengers stranded and some planes can’t fly
  • Support important

New generation

  • Book Emmy in the Key of Code
  • 12 year old girl learns code
  • Novel in verse/poetry
  • [This book looks awesome!]
  • public static void main(String[] args) – “You aren’t going to understand what this means so memorize it like a song”

Java Language Architect – Brian Goetz

  • Rapid release cadence – more features, change in how plan/design/deliver new features
  • Missing the boat by 6 months isn’t as significant. So less time on release management.
  • Less time one feature blocked on another
  • Did quick walkthru of features added in Java 10+
  • Each release has hundreds of smaller enhancements and bug fixes
  • With big releases, motivation to upgrade.
  • Now big features broken up into smaller features and delivered in phases. Need to adjust sense of what constitutes something new
  • Language improvements make us more productive
  • Platform improvements increase performance and other non functional requirements without changing code

Java 13 – Michael Vidstedt

  • Chart showing performance improvements over time for new features
  • AppCDS improves startup (Application Class Data Sharing). VM can refer to information from build time
  • Also investing in GC performance

Projects – Brian Goetz

  • Amber – Right sizing lambda ceremony
    • Switch expressions. IntelliJ offers to refactor switch statement into expression
    • Text blocks/multi line strings. Leading space before columns with “”” on each line considered accidental and not preserved.
    • Domain class – “record” type instead of class. Don’t need to specify equals/hash code/getter/setter. Heard this last year because some features take more than 6 months to develop
  • Valhalla – linking up language with modern hardware
    • “inline” declares that object identity not important so fields can be stored near each other in memory
  • Panama – interacting with native code. expect preview version for accessing off heap memory in next year. Also working on vector API
  • Loom – continuations in JVM and fibers in JDK

My take:

The quantum talk was great. Lots of props and concepts. The imagery of spinning a tourist giant frosted donut reinforced the message really well. I like that Bruno wore is flag/cape. Added some fun. I like that the “commercial” bits were short. The children’s book looks awesome. Excellent start to the conference.

Also, awesome that there were some tables in the back with power for laptops and typing.

[2019 oracle code one] Java 11 Certs

Fun path to Java 11 Developer Certifications
Speaker: Mala Gupta – @emalagupta

For more blog posts, see The Oracle Code One table of contents


Why cert

  • Highlights important topics
  • Suggests a path to learn
  • Bare minimum of what every Java programmer must know to get started
  • Don’t plan to fail. Ok if do so. But don’t plan for it
  • Good coding practices [I think the exam tries. But not always. For example, the Java 8 JDBC topics were an example of how not to write JDBC. This got better with the java 11 exam where PreparedStatement was finally covered]
  • Industry standardizes IT skills
  • Good for students, professionals, those transitioning from other languages

Other ways to learn [not mutually exclusive. Mala wrote a book for the cert. As did Scott and I]

  • Books
  • Courses – Mala had a bad experience. Course oversold.
  • Hackathons – deep dive on select topics
  • Learn on job – would you go to a surgeon where it was his first surgery.

Changes with Java 11 cert

  • No more OCA exam
  • Still two exams – Programmer I and Programmer II.
  • But no longer earn interim OCA cert.
  • Oracle felt people were stopping at OCA level
  • Can take part 1 and part 2 in any order, but makes sense to take level 1 first.
  • Level 1 covers basics; level 2 covers exam topics.

8 types of questions

  • sample code and question about output
  • text only – simpler to answer – conceptual
  • fill in the blank
  • select options that are true about code
  • select incorrect options (that are false about code)
  • answers are blocks of code
  • diagram
  • [I missed one type]

How to make studying for a cert fun

  • Images – emotional connection. Also fun to draw images. Point embedded in mind.
    • Try catch block concept with a tiger and two doors. Animals only and Tigers only. Very cute!
    • Cartoon showing finally block with coffee
  • Highlighted code block
    • throw vs throws with the keywords highlighted with a rectangle surrounding
    • nested circles to show access control
  • Diagrams
    • people
    • array with cars/shapes/grid for multi dimensional array
  • Cartoon dialog
    • Code on left. Image on right is two people in love (or not)
    • Discussion about equals
  • Write own questions and have others do that
  • Twist in the tale – change code and see what happened
  • A-ha moments – write them down as study

Q&A

  • How long to study for cert? 1-3 months [I think upper bound is longer]
  • 6 months cadence? Probably LTS versions but can’t confirm [Oracle hasn’t said, but I agree]
  • Books? Will have MEAP out soon. [Also, Scott and my book publishes this year]

My take: I like that Mala had characters introducing her presentation. It reminded me of the book. Mala speaks a lot like she writes which is good. I felt like there was a lot up front selling the cert. I would think people who chose this cert talk would be interested in the cert. I was happy to see 2/3 of the presentation was on making studying fun. I like the 8 types of questions and samples. It was a good organization system. The types were a little hard to read. I like the interaction by having everyone write a question.