Here are my notes from the talks I attended on Day Two at CodeOne (the successor toJavaOne). We have a summary report on our 4 highlights from Oracle CodeOne and you can find Monday’s here, Wednesday’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.
Reactive Java? Let Us Count the Ways – BYOL [HOL5361]
Two hour lab on using Reactive progamming with ReactiveJS, Spring and Akka.
Some great tutorials to work through on GitHub.
My takeaways – Once you get it, the code is very addictive but not sure I am entirely sold on akka for my personal needs.
Three Productive Ways to Use Open Source Java Flight Recorder and Java Mission Control [DEV5490]
- JFR – JVM flight recorder (runtime component).
- Records events
- JMC – JVM Mission Control (Monitoring tool)
- No artefacts at Maven Central so a bit manual
- Demo is JShell to collect data. Writes out to file.
- Then dumped into GUI JavaFX application for GUI display.
- Shows CPU usage and memory
- Flight recorder can include rules which appear in rpeort
- jcmd with command number to use Flight Recorder on running processes JFR.start, JFR.dump, etc. Can run multiple at the same time.
- On roadmap to allow comparison of reports
My takeaways – JFR allows for you to do some very detailed testing and script it.
Holistic Testing at LinkedIn [DEV5503]
- Aim to make testing as automatic as possible
- By 2015, 300,000,000, users on linkedIn
- Introduces 3 x 3 – commit to production in less 3 hours so can deploy 3 times a day
- Aim to make as frictionless as possible
- LinkedIn is based on micro-service and each team has own repo.
- LinkedIn CI/CD Pipeline – Develop, Code review, Push code, CI, Publish, Staging, Canary, Production
- Code checked into QPROD for testing (linkedIn stack in a box to test against)
- Epsilon inhouse tool to test performance. Record and replay framework. Epsilon core built into every service and can be switched on for live system. So security and privacy critical
- In record mode runs on regular production node. Sample at low QPS. Continuous recording / auto-expire. Then used in replay for testing
- Canary analysis for all services before deploy. Tested on one production node first with analysis and if good, deployed to all. Tests depend on good test data and each micro-service has own config
- Moved away from sep repos to everyone on trunk
- Developer responsible for quality fo code as well as development
- Test at all stages of dev lifecycle
- Empower developers
- Deploy often
My takeaways – A high level overview on how LinkedIn has made code testing/deployment as fast, resilient and automated as possible
Modular Development with JDK 9 and Beyond [DEV5937]
- Audience mostly still using JDK8 according to show of hands
- In OO basic unit a class. Packages are not easily managed. JDK8 has 217 packages. Either shared with everyone (public) or not.
- A module is a setoff packages designed to be reused
- Programs are really modules.
- java.base foundation of every program
- package declared in module-info.java and access controlled with exports (or concealed)
- In JDK11 package classes public can have much finer control (all, friend modules, only within a module)
- requires allows us to document dependency
- Module exports packages but requires modules
- Looks for modules in System image and on module path (set like classpath)
- no missing dependencies, no cyclic packages, no split packages
- Also means we do not have to scan classpath for every modules whenever new class loaded
- How to migrate existing code to module?
- Going to be a mix of modular and non-modular
- Application is usually jar, lib jars used and JDK.
- Can just run on classpath as before
- Migration from top down, starting with application jars, not lib jars
- Usually 1 module per jar
- jdeps can give you dependencies
- adding requires java.base not needed in module-info.java as adde day compiler if missing
- exports can be qualified to a single module using exports … to …)
- Automatic modules allow us to use non-modular jars. Adding it to requires turns it into a module and all packages deemed exported and global requires
- Modular JDK much easier to maintain
- Allows custom java runtimes with only needed modules (jlink)
- 800K of code removed from Java11 – 7 modules including corba. Still available as standalone
My takeaways – Really nice to be able to move beyond global public access and control access and dependencies
Twelve Ways to Make Code Suck Less [DEV5377]
- We cannot be agile if code sucks. No-one wants to make any changes
- Code is how we tell our colleagues how we feel about them
- “lowering quality lengths dev time” – First law of programming
- What is good quality?
- The quality of code is inversely proportion to the effort it takes to understand it.
- 12 ways we can help
- 12. Schedule time to Lower Technical debt
- 11. Favour high cohesion (narrow focus – does one thing really well). It will change less
- high cohesion == low cyclomatic complexity
- 10. Favour loose coupling (or no coupling)
- 9. Program with intention
- Four rules of simple design (Ken Beck)
- 8. Avoid primitive obsession
- Are you the chosen one? Otherwise using code in JDK, etc
- Imperative code is packed with accidental complexity
- Coders always answer – it looks good. (may not compile or work but looks good)
- Good code should read like a story, not like a puzzle. Much easier in functional than iterative
- 7. Prefer clear code over clever code
- Programs must be written for people to read and not only incidentally for machines to execute
- Those who sacrifice quality for performance may get neither
- 6. Apply Zinsser’s principle on writing (book – On writing well)
- Simplicity, Clarity, Brevity, Humanity.
- 5. Comment Why, not what
- Don’t comment to cover up bad CodeOne
- Write expressive Self-Documenting Code
- A good code is like a good joke – should not need explaining
- 4. Avoid long methods – Apply SLAP (Single Level of Abstraction
- How long is Long? It is not about length of code but levels of abstraction
- 3. Give good, meaningful names
- Variable names represent abstractions
- 2. Do tactical code reviews – review test first then code
- Write test which fails on bug and check it in, don’t fix bug
- 1. Reduce state and state mutation
My takeaways – Loads of really good things I need to do in future.
7 deadly sins of API design
- Lust, Gluttony, Greed (arrived late as at Duke’s choice awards so missed these)
- Sloth – very verbs, plural nouns
- Respect http error codes
- Wrath – poor or no documentation. Often a sign of an accidental API
- Absent, Bad, Can’t find it
- stripe and strava really good API examples
- Envy – The disloyal API Designer. Ie GraphQL to Rest
- Pride – unanimous design of what ti should be. No design feedback loops
My takeaways – Lots of easy pitfalls which can be avoided
Keynote: Oracle Code One [KEY6650]
- Started talking about move to micro-services and Oracle Cloud
- 30 plus services available on Oracle cloud – first mention of AI, block chain
- Integration with SAP, Microsoft, Siri, etc and other stacks
- Cloud Native Computing Platform – Oracle a Platinum member. Founded in 2015 with donation of Kubernetes
- 71% of Fortune 500 companies using containers and over 50% using Kubernetes
- Lessons to be learned from failed OS projects:-
- Cluster HQ failed as connecting to wrong storage.
- 3 stages of projects at CNCF – Sandbox, incubation and graduation (Kubernetes and Prometheus graduated this year).
- Cloud native trail map has 10 steps
- 1. Containerization.
- 2. CI/CD
- 3. Orchestration (kubernetes market leader)
- 4. Observability
- 5. Service mesh
- 6. Networking
- 7. Distributed database (ie Vitess)
- 8. Messaging
- 9. Container runtimes
- 10. Software distribution
- 200% growth in Cloud native usage in last year
- Success stories – Pinterest.Matt
- Thompson demos on Oracle Cloud
- Demo: selling a car with chatbot, server less and blockchain
- Demand for conversational interfaces
- Challenge include many interfaces – chat, web, voice, apps – security and getting AI right
- Serverless next level of abstraction. Still server but abstracted. Oracle functions based on Fn functions
- Pay for execution only
- Challenges with block chain include lack of plug and play for Enterprise. Software still catching up
- Stephen Chin onstage – talking about Oracle4Kids. Showed video on weekend activities.
- Announced new Oracle Groundbreaker awards. Will be a website for further nominations
- Initial winners announced – Neha Narkhede – Co-creator of Kafka, Guido van Rossum – creator of Python, Doug Cutting – co-creator Hadoop, Graeme Rocher – co-creator of Grails and Micronaut, Charles Nutter – co-creator of JRuby.
My takeaways – Oracle heavily promoting cloud and lots of interesting things happening.
IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.