Boost delivery stream with code discipline engineeringMiro Wengner
Gang Of Four has done an amazing job of summarising and identifying common challenges that business has faced in the past. The evolution of application design has brought their work into a new context, much like the improvements to Java that have been added to the platform in recent years. Such progress leads to the conclusion that design patterns and anti-patterns need to be reconsidered. This presentation reveals how to increase delivery flow and improve the fast-feedback loop while identifying bottlenecks and removing obstacles from the codebase. During the presentation, we will uncover the nature of several anti-patterns and smoothly translate them into design patterns as required by everyday business. Together, we explore similar approaches provide by another JVM languages like Kotlin or Scala to reveal the power and simplicity of Java. This helps increase productivity while improving the quality of daily decisions supported by proper visualisation from Java Flight Recorder
Learn about Eclipse e4 from Lars Vogel at SF-JUGMarakana Inc.
San Francisco Java User Group hosted an event on April 13th, 2010 with Lars Vogel, a committer on the Eclipse e4 project, who gave a talk on the next generation of the Eclipse Platform. We had two speakers that evening, this is the first of the two presentations. This event was hosted by SUPINFO. Sponsored by TEKsystems, Guidewire Software, Sun, O'Reilly, JetBrains, and Marakana. Organized by Marakana. Video by Max Walker. Photography by Aleksandar Gargenta. http://www.sfjava.org/calendar/12296574/
Interactive Java Support to your tool -- The JShell API and ArchitectureJavaDayUA
Explore the JShell API. Learn how it can be used to add interactive Java expression/declaration execution to new or existing tools. See how the completion functionality can enhance code editors or analyzers. Get a behind the scenes look at the JShell architecture and its deep integration with the Java platform.
Practices and Tools for Building Better APIsPeter Hendriks
The most important part of well-designed Java code is a nice API. A good API helps developers be more productive and write high-quality code quickly. API design matters for any developer, especially in building larger systems with a team. Modern coding tools such as Eclipse and FindBugs contain advanced tooling to help with designing an API and checking for bad usage. This session demonstrates the latest innovations, including new capabilities in Java 8, by presenting realistic examples based on real experiences in large codebases. They show that just a few Java tricks and simple annotations can make all the difference for building a great API.
Boost delivery stream with code discipline engineeringMiro Wengner
Gang Of Four has done an amazing job of summarising and identifying common challenges that business has faced in the past. The evolution of application design has brought their work into a new context, much like the improvements to Java that have been added to the platform in recent years. Such progress leads to the conclusion that design patterns and anti-patterns need to be reconsidered. This presentation reveals how to increase delivery flow and improve the fast-feedback loop while identifying bottlenecks and removing obstacles from the codebase. During the presentation, we will uncover the nature of several anti-patterns and smoothly translate them into design patterns as required by everyday business. Together, we explore similar approaches provide by another JVM languages like Kotlin or Scala to reveal the power and simplicity of Java. This helps increase productivity while improving the quality of daily decisions supported by proper visualisation from Java Flight Recorder
Learn about Eclipse e4 from Lars Vogel at SF-JUGMarakana Inc.
San Francisco Java User Group hosted an event on April 13th, 2010 with Lars Vogel, a committer on the Eclipse e4 project, who gave a talk on the next generation of the Eclipse Platform. We had two speakers that evening, this is the first of the two presentations. This event was hosted by SUPINFO. Sponsored by TEKsystems, Guidewire Software, Sun, O'Reilly, JetBrains, and Marakana. Organized by Marakana. Video by Max Walker. Photography by Aleksandar Gargenta. http://www.sfjava.org/calendar/12296574/
Interactive Java Support to your tool -- The JShell API and ArchitectureJavaDayUA
Explore the JShell API. Learn how it can be used to add interactive Java expression/declaration execution to new or existing tools. See how the completion functionality can enhance code editors or analyzers. Get a behind the scenes look at the JShell architecture and its deep integration with the Java platform.
Practices and Tools for Building Better APIsPeter Hendriks
The most important part of well-designed Java code is a nice API. A good API helps developers be more productive and write high-quality code quickly. API design matters for any developer, especially in building larger systems with a team. Modern coding tools such as Eclipse and FindBugs contain advanced tooling to help with designing an API and checking for bad usage. This session demonstrates the latest innovations, including new capabilities in Java 8, by presenting realistic examples based on real experiences in large codebases. They show that just a few Java tricks and simple annotations can make all the difference for building a great API.
Ahead-Of-Time Compilation of Java ApplicationsNikita Lipsky
Geekout 2016 presentation.
Ahead-of-time (AOT) native compilation has been available for .NET for quite some time, whereas Java SE, while being older than .NET, still does not have a standard AOT compiler. Some people ask why, some people think that it could only work for certain limited types of Java applications, some people think that it is not needed.
The truth, however, is that a Java AOT compiler has been available for over a decade, as part of a compliant Java SE implementation called Excelsior JET, and it proved to be useful for many organizations around the world. In this session, I would like to dispel the common myths about Java AOT compilation and show where it has advantages over JIT compilation from the technical point of view.
The State of Managed Runtimes 2013, by Attila SzegediZeroTurnaround
There’s JVM, and that’s it, right? Well, not exactly. Even within JVM, there’s an increasing support for running all kinds of non-Java languages: we have invokedynamic, but it’s being improved, and new layers of functionality are emerging on top of it, making JVM a better home for all kinds of programming languages. There’s life outside of JVM too. JavaScript seems to be a new assembler-lever compilation target even for C programs (I’ll show some amusing examples of what exactly you can run these days in a browser) , and there are some independent efforts at managed runtimes in various stages of completion that seem promising – PyPy, Topaz, Rubinius, Parrot VM (it’s alive again!). This talk is admittedly a language-runtime-enthusiast’s walk-through the things he finds interesting happening this year. Recorded at GeekOut 2013.
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]David Buck
presentation video: https://www.youtube.com/watch?v=gIffIZnmYBM
The invokedynamic instruction (part of JSR-292) has been around since JDK 7. Since it's introduction 4 years ago, we have seen it's adoption by many of the JVM's most popular languages, including Java itself! Despite its importance to most languages that run on the JVM, many developers still do not understand how it is used or implemented. Most resources available about JSR-292 are aimed at language implementers who are experts in compiler theory and language design. This session will be different, and will offer an overview of JSR-292 for people who are curious about how things work, but do not necessarily spend all day working on java bytecode.
Autonomous Machines with Project BonsaiIvo Andreev
Autonomous machines rely on fusion of many technologies to sense, plan, optimize and act as if an intelligent superhuman is in control.
Project Bonsai is a machine teaching service that combines machine learning (ML), calibration and optimization to create intelligent control systems using simulations. The teaching curriculum is performed using a proprietary “Inkling” language close to JavaScript and training a model is easy and interactive. Join this session for a Bonsai jump start and a demo and try it yourself – it is free.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1VoUxQr.
Rachel Reese talks about Jet.com's chaos testing methods and code in depth, but also lays out a path to implementation that everyone can use. Filmed at qconlondon.com.
Rachel Reese is a long-time software engineer and math geek. She currently helps run the Nashville F# User group, NashFSharp, and previously ran the Burlington, VT functional programming user group, VTFun. She's also an ASPInsider, an F# MVP, a community enthusiast, one of the founding lambdaladies, and a Rachii.
6 Traits of a Successful Test Automation ArchitectureErdem YILDIRIM
The sector demands that software development life cycle to be delivered faster and cheaper with increasing quality and reliability. TLC (testing life cycle) is a crucuel part of the time, cost and quality level for AUT (Application Under Test). Market got to point that all long ornate talks can be summed up in one word: EFFICIENCY. In quality aspect, automating testing activities had already been came forward to reduce development cycle times, cost, resources allocated with traditional test along past years. It's OK that automation increased the efficiency of the test process, so what about the efficiency of automation itself? Why most of the test automation projects fail (even if you're not aware of it is actually failing)? Because, automating without good test architecture may result in a lot of activity, but little value (if you are lucky). We will talk about following 6 main traits to build a successful test automation architecture; selection/implementation of test levels to be automated, design principles/patterns, locater strategy, tools / framework selection (aside from SeWD / Java), methodology (E2E Testing, TDD, BDD, Continuous Testing) and OOP pillars.
Spinning up new instances fast, and effective JIT compilation, may be game changers these days, but they are just a part of the story. What about leaks in the code taking all gained speed away? Java Flight Recorder is an event based tracing framework. It is built directly into the Java runtime and provides access to all internal data, while allowing additional custom enhancements. The goal is to present the value of JFR and how it is able to achieve low overhead (cca 1%). We explain fundamental elements and the performance. We also explore newly added features in current and upcoming releases of JDK Mission Control 8.x.
Ahead-Of-Time Compilation of Java ApplicationsNikita Lipsky
Geekout 2016 presentation.
Ahead-of-time (AOT) native compilation has been available for .NET for quite some time, whereas Java SE, while being older than .NET, still does not have a standard AOT compiler. Some people ask why, some people think that it could only work for certain limited types of Java applications, some people think that it is not needed.
The truth, however, is that a Java AOT compiler has been available for over a decade, as part of a compliant Java SE implementation called Excelsior JET, and it proved to be useful for many organizations around the world. In this session, I would like to dispel the common myths about Java AOT compilation and show where it has advantages over JIT compilation from the technical point of view.
The State of Managed Runtimes 2013, by Attila SzegediZeroTurnaround
There’s JVM, and that’s it, right? Well, not exactly. Even within JVM, there’s an increasing support for running all kinds of non-Java languages: we have invokedynamic, but it’s being improved, and new layers of functionality are emerging on top of it, making JVM a better home for all kinds of programming languages. There’s life outside of JVM too. JavaScript seems to be a new assembler-lever compilation target even for C programs (I’ll show some amusing examples of what exactly you can run these days in a browser) , and there are some independent efforts at managed runtimes in various stages of completion that seem promising – PyPy, Topaz, Rubinius, Parrot VM (it’s alive again!). This talk is admittedly a language-runtime-enthusiast’s walk-through the things he finds interesting happening this year. Recorded at GeekOut 2013.
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]David Buck
presentation video: https://www.youtube.com/watch?v=gIffIZnmYBM
The invokedynamic instruction (part of JSR-292) has been around since JDK 7. Since it's introduction 4 years ago, we have seen it's adoption by many of the JVM's most popular languages, including Java itself! Despite its importance to most languages that run on the JVM, many developers still do not understand how it is used or implemented. Most resources available about JSR-292 are aimed at language implementers who are experts in compiler theory and language design. This session will be different, and will offer an overview of JSR-292 for people who are curious about how things work, but do not necessarily spend all day working on java bytecode.
Autonomous Machines with Project BonsaiIvo Andreev
Autonomous machines rely on fusion of many technologies to sense, plan, optimize and act as if an intelligent superhuman is in control.
Project Bonsai is a machine teaching service that combines machine learning (ML), calibration and optimization to create intelligent control systems using simulations. The teaching curriculum is performed using a proprietary “Inkling” language close to JavaScript and training a model is easy and interactive. Join this session for a Bonsai jump start and a demo and try it yourself – it is free.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1VoUxQr.
Rachel Reese talks about Jet.com's chaos testing methods and code in depth, but also lays out a path to implementation that everyone can use. Filmed at qconlondon.com.
Rachel Reese is a long-time software engineer and math geek. She currently helps run the Nashville F# User group, NashFSharp, and previously ran the Burlington, VT functional programming user group, VTFun. She's also an ASPInsider, an F# MVP, a community enthusiast, one of the founding lambdaladies, and a Rachii.
6 Traits of a Successful Test Automation ArchitectureErdem YILDIRIM
The sector demands that software development life cycle to be delivered faster and cheaper with increasing quality and reliability. TLC (testing life cycle) is a crucuel part of the time, cost and quality level for AUT (Application Under Test). Market got to point that all long ornate talks can be summed up in one word: EFFICIENCY. In quality aspect, automating testing activities had already been came forward to reduce development cycle times, cost, resources allocated with traditional test along past years. It's OK that automation increased the efficiency of the test process, so what about the efficiency of automation itself? Why most of the test automation projects fail (even if you're not aware of it is actually failing)? Because, automating without good test architecture may result in a lot of activity, but little value (if you are lucky). We will talk about following 6 main traits to build a successful test automation architecture; selection/implementation of test levels to be automated, design principles/patterns, locater strategy, tools / framework selection (aside from SeWD / Java), methodology (E2E Testing, TDD, BDD, Continuous Testing) and OOP pillars.
Similar to [meetup] Mastering Java enhancements like a Pro: practical design patterns and anti-patterns (20)
Spinning up new instances fast, and effective JIT compilation, may be game changers these days, but they are just a part of the story. What about leaks in the code taking all gained speed away? Java Flight Recorder is an event based tracing framework. It is built directly into the Java runtime and provides access to all internal data, while allowing additional custom enhancements. The goal is to present the value of JFR and how it is able to achieve low overhead (cca 1%). We explain fundamental elements and the performance. We also explore newly added features in current and upcoming releases of JDK Mission Control 8.x.
Robo4J (Java Duke’s Choice Award 2017) is an upcoming open source framework for quickly building IoT systems (example: robots, button activator…) using popular hardware on Java SE platform. Nice example is Coff-E, an autonomous system, partly 3D-printed system, fully running on Java.
This talk will show how to painlessly wire different types of hardware together, configure and use them on Java platform (life coding demos, raspberrypi, lcd, sensors, servos… ). You will also learn how simple is to turn your hardware units into the micro-services. Talk will also touch how we started using Robo4J at M.A.N Truck & Bus AG.
After session you should be prepared to start building your own hardware systems on Java platform. All demos will be available on Robo4J GitHub repository.
How RaspberryPi workers building GraphDatabaseMiro Wengner
Distributed system consist from from RaspberryPi workers. These workers are building up GraphDatabse (Neo4j) based on simple logic of exchanging cars. The result of the exchanges is send to the BASE server and projected into GraphDatabase.
Server uses Spring Framework 4.x and each RaspberryPi worker Netty 4.x
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
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.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
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.
10. [java-platfom, enhacements]
• Important projects: Coin (7), Lamba(8), Jigsaw(9)…
• Project Valhalla: performance gains through generic API, primitives and value types, ML and BigData apps
• Hidden Classes(JEP-371), Warnings for Value-Based Classes (JEP-390)…
• Project Panama: interconnecting JVM and well de
fi
ned non-java APIs, easier access for I/O apps
• Foreign Function & Memory API (JEP-424), Vector API (JEP-426)…
• Project Amber: improving productivity through Java language evolution
• Local-Variable Type inference (JEP-286), Switch Extension (JEP-361), TextBlocks (JEP-378),
• Records (JEP-395), Pattern Matching (JEP-394, JEP-406, JEP-427), Sealed Classes (JEP-409), UTF-8 by Default (JEP-400),
• Record Patterns (JEP-405) …
• Project Loom: easy to use, hight-throughput, lightweight concurrency and programming approaches
• Virtual Threads (JEP-425), Structured Concurrency(JEP-428)…
?
11. OOP => EIPA
• Do NOT Repeat Yourself
• commonly APIE principles:
• Encapsulation: expose only required
• Inheritance: inevitable evolution
• Polymorphism: behaviour on demand
• Abstraction: standard features
Which one is the right ?
?
?
12. SOLID thinking before jump
• Single responsibility : engine (APIE)
• Open-Close: vehicle evolution (APIE)
• Liskov Substitution: car wash (AI)
• Interface Segregation: don’t force features (A,I)
• Dependency Inversion : di
ff
erent models in garage (A,I)
• Do NOT Repeat Yourself
• Separation of Concerns => Domains
• Extendability, Maintainability or Security
?
13. Do we like Anti-Patterns ?
• IMHO: yes we do
• it works for now … for me, FITYMI, Work On My Local Machine
• expectations too complex, keep it simple?
• Short cuts
• rotted code
• we
fi
x it later
• innovation through bottlenecks
• so when ? ?
14. [anti-pattern] natural appearance
• opposite for the good practice?
• highly risky, ine
ff
ective and counterproductive steps
• limits an ability to e
ff
ectively address the issue: bottleneck
• Java Platform is NOT a MAGIC :)
• squeezing the capabilities : EXAMPLE
• selecting the right tool: EXAMPLE
?
searching unicorns
Let’s dive deeper
15. [anti-patterns, platform] squeezing capabilities
?
MODEL:
record Sensor(int value) {}
LOGIC:
Collection<Sensor> set = provider.values();
for (Sensor e : set) {
SensorAlarmSystemUtil.evaluateAlarm(provider, e.value(), measurementCount);
}
UTILS:
void evaluateAlarm(Map<Integer, Sensor> storage, Integer criticalValue, long measurementNumber) {
if (!storage.containsKey(criticalValue)) {
System.out.println(“SHOULD NOT HAPPEN!”);
}
HOW DOES IT LOOK ?
16. [anti-patterns, platform] squeezing capabilities
• What about AutoBoxing ?
• code composition
• Platform optimalisation
• internal caches: Integers, Long …
?
@IntrinsicCandidate
public static Integer valueOf(int i) {
if (i >= IntegerCache.low && i <= IntegerCache.high)
return IntegerCache.cache[i + (-IntegerCache.low)];
return new Integer(i);
}
WHAT ABOUT PAUSES ?
17. [anti-patterns, platform] squeezing capabilities
?
record Sensor(Integer value) {}
Collection<Sensor> set = provider.values();
for (Sensor e : set) {
SensorAlarmSystemUtil.evaluateAlarm(provider, e.value(), measurementCount);
}
void evaluateAlarm(Map<Integer, Sensor> storage, Integer criticalValue, long measurementNumber) {
if (!storage.containsKey(criticalValue)) {
System.out.println(“SHOULD NOT HAPPEN!”);
}
FEEL DIFFERENCE ?
18. [anti-patterns, apis] selecting the right tool
?
MODEL:
for (int i = 0; i < THREADS_NUMBER; i++) {
builder.addRunnable(
new VehicleAnalyticalWorker(i, ELEMENTS_NUMBER, new ArrayList<>(), new ArrayList<>())
);
}
LOGIC:
public int countIntersections(VehicleDataContainer c) {
int count = 0;
for (int n : collection) {
if (c.getCollection().contains(n)) {
count++;
}
}
return count;
}
HOW DOES IT LOOK ?
19. [anti-patterns, apis] selecting the right tool
• Internal JDK APIs, java.base?
• Are we familiar with them ?
• Impact:
• produce less code,
• e
ff
ective behaviour
• optimisation under the hood
• selecting the right tool
?
examples: LANG, MATH, NET, NIO, SECURITY, TIME,
UTIL -> Collection Framework … WHAT A HEAT?
20. [anti-patterns, apis] selecting the right tool
?
MODEL:
for (int i = 0; i < THREADS_NUMBER; i++) {
builder.addRunnable(
new VehicleAnalyticalWorker(i, ELEMENTS_NUMBER, new HashSet<>(), new HashSet<>())
);
}
FEEL DIFFERENCE ?
Anti-pattern known as a CODE SMELL
without understanding => another ANTI-PATTERN
21. [anti-patterns]: source-code
Cut and paste programming
Spaghetti code
Blob
Lava
fl
ow
Functional decomposition
Boat anchor
expecting next challenge from outdated
God Class
PoC to Production
past is knocking
keep it single
22. [anti-patterns]: architecture
?
Golden hammer
Continuous obsolescence
Input kludge
Working in mine
fi
eld
Ambiguous viewpoint
Poltergeists
Dead end
believe and not verify
interface Vehicle {
void checkEngine();
void initSystem();
void initRadio(); /*DON’T*/
void initCassettePlayer(); /*DON’T*/
void initMediaSystem(); /*CURRENT*/
}
Test?patch appears like magic …
don’t remove
old good approach
onion
don't touch
23. [desing-patterns]: creational, structural, behavioral and refactoring
• readable, maintainable code, performance is not the “target”
• CleanCode, Best Practices ~ Design Patterns ?
• Pareto Principle (80/20) : depends on perspective
• Start small to bild something useful!
?
Creational
Structural
Behavioral
Concurrency
25. [design-patterns] creational
?
Factory Method
public final class DefaultVehicleFactory implements VehicleFactory<VehicleType> {
public static int WEIGHT_SECURITY_EQUIPMENTS = 5;
@Override
public Vehicle produce(VehicleType type) {
return switch (type){
case STANDARD -> {
var v = new StandardVehicle(10);
v.addLoad(WEIGHT_SECURITY_EQUIPMENTS);
yield v;
}
case SPORT -> new SportVehicle("super-fast");
};
}
}
centralise the class instantiation
26. [design-patterns] creational
?
Builder
public record StartCommand(Vehicle vehicle, AtomicBoolean executed) implements VehicleCommand {
public static final class Builder {
private Vehicle builderVehicle;
public Builder addVehicle(Vehicle v){
this.builderVehicle = v;
return this;
}
public StartCommand build(){
return new StartCommand(this);
}
}
private StartCommand(Builder builder){
this(builder.builderVehicle, new AtomicBoolean());
}
….
separate the composition from the representation
Do not do it!
28. [design-patterns] structural
?
Adapter
sealed interface VehicleCommand permits StartCommand, StopCommand {..}
record StartCommand(…) implements VehicleCommand {
…
@Override
public void process(String command) {
if(command.contains("start")){
switch (vehicle){
case StandardVehicle v when v.getLoadWeight() > 1 ->
System.out.printf("""
%s with description:'%s', weight:'%d'%n""", v, v.getDescription(), v.getLoadWeight());
case StandardVehicle v -> System.out.printf("""
%s with description:'%s'%n""", v, v.getDescription());
case SportVehicle v -> System.out.println(v);
default -> System.out.println("NOTHING");
}
executed.set(true);
allows to work classes together
29. [design-patterns] structural
?
Facade
sealed interface VehicleCommand permits StartCommand, StopCommand {..}
uni
fi
ed interfaces to underlaying subsystems
public interface VehicleFactory<T> {
Vehicle produce(T type);
}
31. [design-patterns] behavioral
?
Command like action, event on what client act
public record StartCommand(…) implements VehicleCommand {…
public final class StopCommand implements VehicleCommand {
private final Vehicle vehicle;
private boolean executed;
public StopCommand(Vehicle vehicle){
this.vehicle = vehicle;
}
@Override
public void process(String command) {
if(command.contains("stop")){
vehicle.stop();
executed = true;
…
32. [design-patterns] behavioral
?
Caching
Observer
public class Driver {
private final List<VehicleCommand> commands = new ArrayList<>();
public Driver addCommand(VehicleCommand command){…}
public void executeCommands(final String command){
commands.forEach(c -> {
// Records decomposition
if(c instanceof StartCommand(Vehicle v, AtomicBoolean state)){
….
}
public void printCommands() {
System.out.printf("""
Considered COMMANDS:%n%s""", commands.stream()
.map(VehicleCommand::status)
.collect(Collectors.joining("")));
react on demand reuse knowledge
34. [design-patterns] concurrency
?
Balking
var vehicle = new Vehicle();
var numberOfDrivers = 5;
var executors = Executors.newFixedThreadPool(2);
for (int i = 0; i < numberOfDrivers; i++) {
executors.submit(vehicle::drive);
}
vehicle is changing states, solution to critical section
enum VehicleState {
MOVING,
STOPPED,
}
35. [design-patterns] concurrency
?
ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
var sensor = new Sensor(readWriteLock.readLock(), readWriteLock.writeLock());
var sensorWriter = new SensorWriter("writer-1", sensor);
var writerThread = getWriterThread(sensorWriter);
ExecutorService executor = Executors.newFixedThreadPool(NUMBER_READERS);
var readers = IntStream.range(0, NUMBER_READERS)
.boxed().map(i -> new SensorReader("reader-" + i, sensor, CYCLES_READER)).toList();
readers.forEach(executor::submit);
Read Write Lock natural exclusivity for lock acquisition
36. Conclusion
• Design Patterns and new JDK features helps to:
• improve code clarity: Sealed Classes, Pattern Matching
• reduce verbosity: Switch Statement improvements, Records
• enforce maintainability: Project Amber, Project Loom
• simpli
fi
ed composition: VirtualThreads, StructuredConcurrency, Switch, Local-Variable Type
• observability, pro
fi
ling, debugging and understanding
• Java as the 1st language for the JVM
?
37. Q / A
twitter: @miragemiko
github:@mirage22
email: miro@openvalue.de
Thank YOU !