If tests are hard to write, the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t stand it anymore and they will either stop testing or test more superficially. At the other extreme, others struggle to write contrived, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Don't Be Mocked by your Mocks - Best Practices using MocksVictor Rentea
Do you ❤️ Mocks? When you write your first unit tests, especially on older codebases, mocking foreign code is key to survival. But as you grow older in the craft, you start piling up hours and days wasted to refactor fragile tests or to fix bugs that those heavy mock-based tests didn't catch. And so you start looking at Mocks differently.
Let's go through the key factors to consider to strike the optimal balance between what needs to be mocked away and what code should be tested in integration. There's sometimes a fine line there, often interwoven with strong emotions:
"Why am I testing this?"
"Argh… these tests take too long"
"Can this ever really break?"
etc...
Among the points that we'll touch on:
- Mocks vs Refactoring
- Mocks vs Reliability
- Fine vs Coarse Mocks
- Reproducibility
- Partial Mocks
- Mocking Statics
- Alternatives to Mocks
Speakers: Victor Rentea
Victor is a Java Champion and Independent Trainer with an impressive experience: thousands of developers in dozens of companies trained in dedicated company sessions. He is the founder of one of the largest developer communities in Romania, Bucharest Software Craftsmanship Community and a top international conference speaker.
To find more about him, join a live masterclass or call him in for a company dedicated training: victorrentea.ro
Integration testing with spring @snow oneVictor Rentea
This document provides an overview of integration testing strategies and techniques. It discusses the differences between unit tests and integration tests, including that integration tests involve multiple layers and dependencies like databases, files, and web services, making them slower and more fragile. It also covers best practices for integration tests such as using an in-memory database, WireMock for stubbing external services, transaction management, and strategies for cleaning up after tests.
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Functional Patterns with Java8 @Bucharest Java User GroupVictor Rentea
The slides for the presentation I gave at Bucharest Java User Group. This session was the largest Romanian Java community meetup ever organized until now.
Software Craftsmanship @Code Camp Festival 2022.pdfVictor Rentea
Decades ago, IT started as a single engineering practice, but over the years it grew increasingly fragmented. The overspecialization we face today, in the context of a management-first agile transformation leads to a lack of responsibility, blaming games, repeated patching, painful communication overhead, and fulminating costs. The software craftsmanship movement is rising in this post-agile world with professionals that take control of their careers and continuously learn in the pursuit of mastery. But changing mindset requires determined team efforts and communities, especially when working remotely. What techniques and tricks can you use to grow such a culture of learning in your team? Find out from the founder and lead of one of the largest software craftsmanship communities in the world.
This talk is about technical culture and attitude.
Victor Rentea introduces himself as a Java Champion, trainer, and speaker who focuses on topics like Hibernate, Spring, Java 8/FP, architecture, clean code, unit testing, reactive programming, and Java performance. He advocates building a deep, rich domain model with value objects and entities that encapsulate logic and enforce invariants. The document provides guidance on applying principles like separating concerns with layers, dependency inversion, and avoiding anemic domain models in order to build flexible, testable systems that are decoupled from frameworks and external dependencies.
Are you using Java8 Lambdas & Streams in your core business logic? Then you might be having this strange feeling that it’s not Java anymore: at times it’s cryptic, barely readable.. This was the topic of the workshop with the same name that I held at VoxxedDays Bucharest 2017. These are the slides backing the that workshop.
As a summary, the materials walk through the functional features of Java8, adding details along the way about how we can keep the code clean as we embrace the Java 8 features.
The entire desktop screencast + voice it's on youtube, here: https://youtu.be/uH9A37k2QkU
Decades ago, IT started as a single engineering practice, but as time passed by it got increasingly fragmented. Conflicts broke out between testers vs developers vs sysadmins vs DBAs vs many other roles. Recently, developers themselves split into many subspecialties like backend/frontend/iOS/Android/microservices/functions/etc. The overspecialization we face today causes huge communication overhead, a low bus factor, lack of responsibility, blaming, repeated isolated patching and fulminating costs. The software craftsmanship movement is rising in this post-agile world with professionals eager to take control of their careers and continuously learn in the pursuit of mastery. This talk will show you practical ways in which to seed a continuous learning culture in your team or company, and foster the enthusiasm of your developers.
Don't Be Mocked by your Mocks - Best Practices using MocksVictor Rentea
Do you ❤️ Mocks? When you write your first unit tests, especially on older codebases, mocking foreign code is key to survival. But as you grow older in the craft, you start piling up hours and days wasted to refactor fragile tests or to fix bugs that those heavy mock-based tests didn't catch. And so you start looking at Mocks differently.
Let's go through the key factors to consider to strike the optimal balance between what needs to be mocked away and what code should be tested in integration. There's sometimes a fine line there, often interwoven with strong emotions:
"Why am I testing this?"
"Argh… these tests take too long"
"Can this ever really break?"
etc...
Among the points that we'll touch on:
- Mocks vs Refactoring
- Mocks vs Reliability
- Fine vs Coarse Mocks
- Reproducibility
- Partial Mocks
- Mocking Statics
- Alternatives to Mocks
Speakers: Victor Rentea
Victor is a Java Champion and Independent Trainer with an impressive experience: thousands of developers in dozens of companies trained in dedicated company sessions. He is the founder of one of the largest developer communities in Romania, Bucharest Software Craftsmanship Community and a top international conference speaker.
To find more about him, join a live masterclass or call him in for a company dedicated training: victorrentea.ro
Integration testing with spring @snow oneVictor Rentea
This document provides an overview of integration testing strategies and techniques. It discusses the differences between unit tests and integration tests, including that integration tests involve multiple layers and dependencies like databases, files, and web services, making them slower and more fragile. It also covers best practices for integration tests such as using an in-memory database, WireMock for stubbing external services, transaction management, and strategies for cleaning up after tests.
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Functional Patterns with Java8 @Bucharest Java User GroupVictor Rentea
The slides for the presentation I gave at Bucharest Java User Group. This session was the largest Romanian Java community meetup ever organized until now.
Software Craftsmanship @Code Camp Festival 2022.pdfVictor Rentea
Decades ago, IT started as a single engineering practice, but over the years it grew increasingly fragmented. The overspecialization we face today, in the context of a management-first agile transformation leads to a lack of responsibility, blaming games, repeated patching, painful communication overhead, and fulminating costs. The software craftsmanship movement is rising in this post-agile world with professionals that take control of their careers and continuously learn in the pursuit of mastery. But changing mindset requires determined team efforts and communities, especially when working remotely. What techniques and tricks can you use to grow such a culture of learning in your team? Find out from the founder and lead of one of the largest software craftsmanship communities in the world.
This talk is about technical culture and attitude.
Victor Rentea introduces himself as a Java Champion, trainer, and speaker who focuses on topics like Hibernate, Spring, Java 8/FP, architecture, clean code, unit testing, reactive programming, and Java performance. He advocates building a deep, rich domain model with value objects and entities that encapsulate logic and enforce invariants. The document provides guidance on applying principles like separating concerns with layers, dependency inversion, and avoiding anemic domain models in order to build flexible, testable systems that are decoupled from frameworks and external dependencies.
Are you using Java8 Lambdas & Streams in your core business logic? Then you might be having this strange feeling that it’s not Java anymore: at times it’s cryptic, barely readable.. This was the topic of the workshop with the same name that I held at VoxxedDays Bucharest 2017. These are the slides backing the that workshop.
As a summary, the materials walk through the functional features of Java8, adding details along the way about how we can keep the code clean as we embrace the Java 8 features.
The entire desktop screencast + voice it's on youtube, here: https://youtu.be/uH9A37k2QkU
Decades ago, IT started as a single engineering practice, but as time passed by it got increasingly fragmented. Conflicts broke out between testers vs developers vs sysadmins vs DBAs vs many other roles. Recently, developers themselves split into many subspecialties like backend/frontend/iOS/Android/microservices/functions/etc. The overspecialization we face today causes huge communication overhead, a low bus factor, lack of responsibility, blaming, repeated isolated patching and fulminating costs. The software craftsmanship movement is rising in this post-agile world with professionals eager to take control of their careers and continuously learn in the pursuit of mastery. This talk will show you practical ways in which to seed a continuous learning culture in your team or company, and foster the enthusiasm of your developers.
Unit Testing like a Pro - The Circle of PurityVictor Rentea
Best practices on designing unit tests, designing testable production code, a glimpse of TDD, using mocks and isolating pure functions for easy testing. Talk distilled from http://victorrentea.ro/#unit-testing
Held at VoxxedDays Bucharest in March 2019.
Clean Pragmatic Architecture - Avoiding a MonolithVictor Rentea
Talk built based on several of my trainings: http://www.victorrentea.ro/#training
Covers: Clean/Onion/Hexagonal Architecture, Domain Entities, Value Objects, Repository, Extract When it Grows Principle, Dependency Inversion Principle, Clean Code and Design Patterns.
These are the backing slides of the talks given at JPoint 2017 and Devoxx PL 2017: https://www.youtube.com/embed/4-4ahz7zDiQ
The biggest challenge in performance tuning is identifying the root cause of the bottleneck. Once you find it, the fix often becomes trivial. However, this detective work takes patience, skills, and effort, so we often attempt to guess the cause, by trying out tentative fixes. The result: messy code, waste of time and money, and frustration. During this talk you will learn how to correctly zoom in on the bottleneck using three levels of profiling: distributed tracing with Zipkin, metrics with Micrometer, and profiling with the Java Flight Recorder already built into your JVM. We’ll focus on the latter and learn how to read a flame graph to trace some common issues of backend systems like connection/thread pool starvation, time-consuming aspects, hot methods, and lock contention, even if these occur in library code you did not write.
Slides of the talk held at JEEConf, Kiev and jPrime, Sofia. A personal view on the classic topics from the Uncle Bob's Clean Code bible, with some personal additions and tips&tricks. This topic actually represents the core of the training sessions that I provide as an independent trainer (www.victorrentea.ro)
Throughout the years, the Concentric Architectures (Onion, Hexagonal, Clean-..) have grown into the undisputed leader among backend systems architectures. With the rise of Domain-Driven Design, keeping your Domain ring 'agnostic' to the outside world has become the norm today. But history proved that any 'norm' in software architectures will cause overengineering if applied without criticism.
After a brief recap of these architectures, their pitfalls, and weaknesses, we'll see two alternatives that segregate code not in 'layers' or 'rings' but in vertical slices: Feature Slicing and Modular Monolith.
[Feature Slicing](vertical Slice Architecture) (aka *UseCase) has its own pitfalls and weaknesses, that we'll briefly review. But this will just warm us up for the next style.
Modular Monolith (aka Modulith) is an architecture style that helped many companies break their legacy codebases, and smoothly move to microservices. Most of the techniques discussed here can also come handy when one single microservice grew big and needs to be broken down.
Even more, greenfield projects today opt for this architecture instead of microservices, to avoid paying the high cost of distributability. Imagine cohesive but decoupled modules living in the same code base & deployment, but on which different teams work in harmony, delivering more value much faster than an equivalent microservice ecosystem.🦄
On the agenda:
- patterns to break data structures
- how to protect Domains inside modules
- communication patterns between modules
- breaking cyclic dependencies
Testing is fundamental in software development. Quality gates demand high coverage levels, pull requests need sufficient tests, leading to teams spending considerable time writing and maintaining them. But are we using our tests to their full potential?
'If code is hard to test, the design can be improved'. Starting from this mantra, this deep-dive session unveils hints to simplify code, break-down complexity, and effectively use functional programming. We'll delve into topics like fixture creep, partial mocks, onion architecture, and pure functions, providing numerous best practices and practical tips for your testing.
Be warned: This session may significantly disrupt your work routine and will likely change how you see testing. Attend at your own risk.
How should a professional software developer behave in code? What guidelines should one follow? How should we name our constructs? What about OOP principles? What's their real use?
This classic training module in my training curricula is the cornerstone of my professionalism. These are my conduit guidelines at work. I've held this training > 10 times, including at Voxxed Days Bucharest 2016 and at a Bucharest Java User Group meetup.
Clean Code @Voxxed Days Cluj 2023 - opening KeynoteVictor Rentea
Clean Code principles have become a cornerstone of professional developer teams worldwide. But frameworks and languages have evolved, and so have the challenges we’re facing today while crafting modern applications. Single-page apps, extremely DRY code, microservices, excessive functional programming, and reactive flows have all taken their toll on our code quality. Hop aboard this roundtrip of the most damaging Code Smells as of 2023 and fill your toolbox with a load of practical tricks you can immediately apply to your day-to-day work. All in an entertaining show spiced with live-coding moments.
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideVictor Rentea
This document outlines an agenda and presentation on clean code architecture. It discusses modeling data with entities and value objects, organizing logic by extracting services and applying the onion architecture. It emphasizes testing to reduce fear, and protecting developers through simplicity and avoiding overengineering. The presentation emphasizes keeping data transfer objects lightweight and external to the domain.
Clean architecture - Protecting the DomainVictor Rentea
The goal of architecture is to simplify the most complex parts of your logic. Any other goal should be secondary to this. The problem is that you can’t always anticipate where the complexity of your application will accumulate, especially when confronted with ever-changing requirements. The only way to keep your code simple is to gradually evolve the architecture without adding useless complexity up front, but always looking out for opportunities to break-down and refactor towards the most simple design that solves the problem. Drawing concepts from the Domain-Driven Development mindset, this talk summarizes the most important lessons learned designing and consulting many real-world projects. Along the way, you’ll hear about Value Objects and Entities, DTOs, Dependency Inversion Principle, Facades, the Onion Architecture and many pragmatic tips and tricks immediately applicable to your day-to-day work.
The Proxy Fairy, and The Magic of Spring FrameworkVictor Rentea
You can only claim you know Spring if you fully understand the Proxy design pattern, and how the framework uses it to do its magic. Join this live-coding session to explore 6 ways of intercepting method calls that you can use to cast your own spells and dramatically simplify your codebase.
Grab a strong coffee and prepare yourself for a whirlwind of live-coding, interwoven with deep theoretical concepts and implementation details that you have to master if you are using the Spring Framework. During this session, Victor will share one of the best parts of his Design Patterns training, applied to Spring. You'll hear about the Decorator pattern plus 2 ways to wire it with Spring, bare-hands interface proxies, concrete classes proxies, @Aspect applied to custom annotations, plus some of the most common standard off-the-shelf Spring aspects. Come and learn from a hands-on practitioner real-world best practices of using Aspects, design hints, under-the-hood implementation details, debugging tips, performance impact of aspects, all in an interactive, entertaining and extremely dynamic session.
- Talk held at JPoint 2019, Moscow
The document discusses clean code principles such as naming conventions, small functions, avoiding nulls and side effects, and using classes as containers for logic. It also emphasizes writing code for readability through techniques like extracting methods, renaming variables for clarity, and using comments to explain intentions rather than restate code. The presenter advocates for clean code as a way to improve code quality and maintainability over time.
Over the last year there has been a lot of buzz about Clean Architecture in the Android community, but what is Clean Architecture? How does it work? And should I be using it? Recently at Badoo we decided to rewrite our messenger component.
Over the years this core piece of functionality in our app has become large and unwieldy. We wanted to take a fresh approach to try and prevent this from happening again. We choose to use Clean Architecture to achieve our goal. This talk intends to share our journey from theory to implementation in an application with over 100 million downloads. By the end, you should not only understand what Clean Architecture is, but how to implement it, and whether you should.
There's another talk about Clean Architecture, SOLID, and our approach at InfoJobs. If you need the slides, don't hesitate to fork https://github.com/schibsted-android-training/workshop-5
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
In this presentation we will present the general philosophy of Clean Architecture, Hexagonal Architecture, and Ports & Adapters: discussing why these approaches are useful and general guidelines for introducing them to your code. Chiefly, we will show how to implement these patterns within your Spring (Boot) Applications. Through a publicly available reference app, we will demonstrate what these concepts can look like within Spring and walkthrough a handful of scenarios: isolating core business logic, ease of testing, and adding a new feature or two.
These are the slides of my "Fake it Outside-In TDD" session at the #XP2017 conference. Do not miss to check out the referenced screencasts that illustrate the approach very well: https://www.youtube.com/playlist?list=PL_ueet93U84VIy8O7U4dUV0GyGvuzFAt8
Curious about how chaos engineering can make your systems more resilient?
Get a comprehensive introduction to the history, principles, and practice of chaos engineering
You will walk away from this session with an in-depth understanding of what chaos engineering is, why it’s crucial to prevent outages, and how you can use it to build resilience into your own systems.
Lambdas and Streams Master Class Part 2José Paumard
These are the slides of the talk we made with Stuart Marks at Devoxx Belgium 2018. This second part covers the Stream API, reduction and the Collector API.
What is the state of lambda expressions in Java 11? Lambda expressions are the major feature of Java 8, having an impact on most of the API, including the Streams and Collections API. We are now living the Java 11 days; new features have been added and new patterns have emerged. This highly technical Deep Dive session will visit all these patterns, the well-known ones and the new ones, in an interactive hybrid of lecture and laboratory. We present a technique and show how it helps solve a problem. We then present another problem, and give you some time to solve it yourself. Finally, we present a solution, and open for questions, comments, and discussion. Bring your laptop set up with JDK 11 and your favorite IDE, and be prepared to think!
General overview of what is "Chaos Engineering", the current
"perturbation models" available and the benefits of Chaos Engineering to Customers, Business and Tech.
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.Never write another getter or equals method again.
After watching this you will be able to give answer on following Questions
What is lombok?
Why to use project Lombok?
How to integrate/plug lombok project jar with you Eclipse ID?
How to use lombok maven project?
What is @Getter/@Setter annotation in Lombok java?
How Project Lombok works?
What is @NonNull annotation?
What is @ToString annotation?
How to generate Equals and Hashcode using Lombok?
Check all lombok java example
What are the benefits/advantages of using lombok?
The document describes a meetup organized by Cork Software Crafters on breaking dependencies in legacy code. The meetup agenda includes a welcome from 6:15-6:30pm, an introduction from 6:30-6:45pm, hands-on time from 6:45-8:00pm, and a retrospective from 8:00pm to discuss solutions. The facilitator is Paulo Clavijo and participants are encouraged to suggest new topics and hands-on sessions for future meetups.
Tests are hard to write if the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t take it and they will either stop testing or test superficially. At the other end, others struggle to write contrieved, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Unit Testing like a Pro - The Circle of PurityVictor Rentea
Best practices on designing unit tests, designing testable production code, a glimpse of TDD, using mocks and isolating pure functions for easy testing. Talk distilled from http://victorrentea.ro/#unit-testing
Held at VoxxedDays Bucharest in March 2019.
Clean Pragmatic Architecture - Avoiding a MonolithVictor Rentea
Talk built based on several of my trainings: http://www.victorrentea.ro/#training
Covers: Clean/Onion/Hexagonal Architecture, Domain Entities, Value Objects, Repository, Extract When it Grows Principle, Dependency Inversion Principle, Clean Code and Design Patterns.
These are the backing slides of the talks given at JPoint 2017 and Devoxx PL 2017: https://www.youtube.com/embed/4-4ahz7zDiQ
The biggest challenge in performance tuning is identifying the root cause of the bottleneck. Once you find it, the fix often becomes trivial. However, this detective work takes patience, skills, and effort, so we often attempt to guess the cause, by trying out tentative fixes. The result: messy code, waste of time and money, and frustration. During this talk you will learn how to correctly zoom in on the bottleneck using three levels of profiling: distributed tracing with Zipkin, metrics with Micrometer, and profiling with the Java Flight Recorder already built into your JVM. We’ll focus on the latter and learn how to read a flame graph to trace some common issues of backend systems like connection/thread pool starvation, time-consuming aspects, hot methods, and lock contention, even if these occur in library code you did not write.
Slides of the talk held at JEEConf, Kiev and jPrime, Sofia. A personal view on the classic topics from the Uncle Bob's Clean Code bible, with some personal additions and tips&tricks. This topic actually represents the core of the training sessions that I provide as an independent trainer (www.victorrentea.ro)
Throughout the years, the Concentric Architectures (Onion, Hexagonal, Clean-..) have grown into the undisputed leader among backend systems architectures. With the rise of Domain-Driven Design, keeping your Domain ring 'agnostic' to the outside world has become the norm today. But history proved that any 'norm' in software architectures will cause overengineering if applied without criticism.
After a brief recap of these architectures, their pitfalls, and weaknesses, we'll see two alternatives that segregate code not in 'layers' or 'rings' but in vertical slices: Feature Slicing and Modular Monolith.
[Feature Slicing](vertical Slice Architecture) (aka *UseCase) has its own pitfalls and weaknesses, that we'll briefly review. But this will just warm us up for the next style.
Modular Monolith (aka Modulith) is an architecture style that helped many companies break their legacy codebases, and smoothly move to microservices. Most of the techniques discussed here can also come handy when one single microservice grew big and needs to be broken down.
Even more, greenfield projects today opt for this architecture instead of microservices, to avoid paying the high cost of distributability. Imagine cohesive but decoupled modules living in the same code base & deployment, but on which different teams work in harmony, delivering more value much faster than an equivalent microservice ecosystem.🦄
On the agenda:
- patterns to break data structures
- how to protect Domains inside modules
- communication patterns between modules
- breaking cyclic dependencies
Testing is fundamental in software development. Quality gates demand high coverage levels, pull requests need sufficient tests, leading to teams spending considerable time writing and maintaining them. But are we using our tests to their full potential?
'If code is hard to test, the design can be improved'. Starting from this mantra, this deep-dive session unveils hints to simplify code, break-down complexity, and effectively use functional programming. We'll delve into topics like fixture creep, partial mocks, onion architecture, and pure functions, providing numerous best practices and practical tips for your testing.
Be warned: This session may significantly disrupt your work routine and will likely change how you see testing. Attend at your own risk.
How should a professional software developer behave in code? What guidelines should one follow? How should we name our constructs? What about OOP principles? What's their real use?
This classic training module in my training curricula is the cornerstone of my professionalism. These are my conduit guidelines at work. I've held this training > 10 times, including at Voxxed Days Bucharest 2016 and at a Bucharest Java User Group meetup.
Clean Code @Voxxed Days Cluj 2023 - opening KeynoteVictor Rentea
Clean Code principles have become a cornerstone of professional developer teams worldwide. But frameworks and languages have evolved, and so have the challenges we’re facing today while crafting modern applications. Single-page apps, extremely DRY code, microservices, excessive functional programming, and reactive flows have all taken their toll on our code quality. Hop aboard this roundtrip of the most damaging Code Smells as of 2023 and fill your toolbox with a load of practical tricks you can immediately apply to your day-to-day work. All in an entertaining show spiced with live-coding moments.
Evolving a Clean, Pragmatic Architecture - A Craftsman's GuideVictor Rentea
This document outlines an agenda and presentation on clean code architecture. It discusses modeling data with entities and value objects, organizing logic by extracting services and applying the onion architecture. It emphasizes testing to reduce fear, and protecting developers through simplicity and avoiding overengineering. The presentation emphasizes keeping data transfer objects lightweight and external to the domain.
Clean architecture - Protecting the DomainVictor Rentea
The goal of architecture is to simplify the most complex parts of your logic. Any other goal should be secondary to this. The problem is that you can’t always anticipate where the complexity of your application will accumulate, especially when confronted with ever-changing requirements. The only way to keep your code simple is to gradually evolve the architecture without adding useless complexity up front, but always looking out for opportunities to break-down and refactor towards the most simple design that solves the problem. Drawing concepts from the Domain-Driven Development mindset, this talk summarizes the most important lessons learned designing and consulting many real-world projects. Along the way, you’ll hear about Value Objects and Entities, DTOs, Dependency Inversion Principle, Facades, the Onion Architecture and many pragmatic tips and tricks immediately applicable to your day-to-day work.
The Proxy Fairy, and The Magic of Spring FrameworkVictor Rentea
You can only claim you know Spring if you fully understand the Proxy design pattern, and how the framework uses it to do its magic. Join this live-coding session to explore 6 ways of intercepting method calls that you can use to cast your own spells and dramatically simplify your codebase.
Grab a strong coffee and prepare yourself for a whirlwind of live-coding, interwoven with deep theoretical concepts and implementation details that you have to master if you are using the Spring Framework. During this session, Victor will share one of the best parts of his Design Patterns training, applied to Spring. You'll hear about the Decorator pattern plus 2 ways to wire it with Spring, bare-hands interface proxies, concrete classes proxies, @Aspect applied to custom annotations, plus some of the most common standard off-the-shelf Spring aspects. Come and learn from a hands-on practitioner real-world best practices of using Aspects, design hints, under-the-hood implementation details, debugging tips, performance impact of aspects, all in an interactive, entertaining and extremely dynamic session.
- Talk held at JPoint 2019, Moscow
The document discusses clean code principles such as naming conventions, small functions, avoiding nulls and side effects, and using classes as containers for logic. It also emphasizes writing code for readability through techniques like extracting methods, renaming variables for clarity, and using comments to explain intentions rather than restate code. The presenter advocates for clean code as a way to improve code quality and maintainability over time.
Over the last year there has been a lot of buzz about Clean Architecture in the Android community, but what is Clean Architecture? How does it work? And should I be using it? Recently at Badoo we decided to rewrite our messenger component.
Over the years this core piece of functionality in our app has become large and unwieldy. We wanted to take a fresh approach to try and prevent this from happening again. We choose to use Clean Architecture to achieve our goal. This talk intends to share our journey from theory to implementation in an application with over 100 million downloads. By the end, you should not only understand what Clean Architecture is, but how to implement it, and whether you should.
There's another talk about Clean Architecture, SOLID, and our approach at InfoJobs. If you need the slides, don't hesitate to fork https://github.com/schibsted-android-training/workshop-5
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
In this presentation we will present the general philosophy of Clean Architecture, Hexagonal Architecture, and Ports & Adapters: discussing why these approaches are useful and general guidelines for introducing them to your code. Chiefly, we will show how to implement these patterns within your Spring (Boot) Applications. Through a publicly available reference app, we will demonstrate what these concepts can look like within Spring and walkthrough a handful of scenarios: isolating core business logic, ease of testing, and adding a new feature or two.
These are the slides of my "Fake it Outside-In TDD" session at the #XP2017 conference. Do not miss to check out the referenced screencasts that illustrate the approach very well: https://www.youtube.com/playlist?list=PL_ueet93U84VIy8O7U4dUV0GyGvuzFAt8
Curious about how chaos engineering can make your systems more resilient?
Get a comprehensive introduction to the history, principles, and practice of chaos engineering
You will walk away from this session with an in-depth understanding of what chaos engineering is, why it’s crucial to prevent outages, and how you can use it to build resilience into your own systems.
Lambdas and Streams Master Class Part 2José Paumard
These are the slides of the talk we made with Stuart Marks at Devoxx Belgium 2018. This second part covers the Stream API, reduction and the Collector API.
What is the state of lambda expressions in Java 11? Lambda expressions are the major feature of Java 8, having an impact on most of the API, including the Streams and Collections API. We are now living the Java 11 days; new features have been added and new patterns have emerged. This highly technical Deep Dive session will visit all these patterns, the well-known ones and the new ones, in an interactive hybrid of lecture and laboratory. We present a technique and show how it helps solve a problem. We then present another problem, and give you some time to solve it yourself. Finally, we present a solution, and open for questions, comments, and discussion. Bring your laptop set up with JDK 11 and your favorite IDE, and be prepared to think!
General overview of what is "Chaos Engineering", the current
"perturbation models" available and the benefits of Chaos Engineering to Customers, Business and Tech.
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.Never write another getter or equals method again.
After watching this you will be able to give answer on following Questions
What is lombok?
Why to use project Lombok?
How to integrate/plug lombok project jar with you Eclipse ID?
How to use lombok maven project?
What is @Getter/@Setter annotation in Lombok java?
How Project Lombok works?
What is @NonNull annotation?
What is @ToString annotation?
How to generate Equals and Hashcode using Lombok?
Check all lombok java example
What are the benefits/advantages of using lombok?
The document describes a meetup organized by Cork Software Crafters on breaking dependencies in legacy code. The meetup agenda includes a welcome from 6:15-6:30pm, an introduction from 6:30-6:45pm, hands-on time from 6:45-8:00pm, and a retrospective from 8:00pm to discuss solutions. The facilitator is Paulo Clavijo and participants are encouraged to suggest new topics and hands-on sessions for future meetups.
Tests are hard to write if the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t take it and they will either stop testing or test superficially. At the other end, others struggle to write contrieved, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Framework Design Guidelines For Brussels Users Groupbrada
This document summarizes 10 years of experience with framework design guidelines from Microsoft. It discusses core principles of framework design that have remained the same over 10 years, such as layering dependencies and managing types. It also outlines new advances like test-driven development, dependency injection, and tools for dependency management and framework design. The document concludes by emphasizing that framework design principles have stayed consistent while new techniques have emerged to help implement those principles.
The document discusses the building blocks of a SystemVerilog testbench. It describes the program block, which encapsulates test code and allows reading/writing signals and calling module routines. Interface and clocking blocks are used to connect the testbench to the design under test. Assertions, randomization, and other features help create flexible testbenches to verify design correctness.
Stopping the Rot - Putting Legacy C++ Under TestSeb Rose
The document discusses introducing unit testing to legacy C++ code. It covers choosing a testing framework, writing initial tests and mocks, and various refactoring techniques like wrapping dependencies, extracting components, and adding non-intrusive C seams to facilitate testing. The goal is to incrementally make the code more testable while maintaining functionality through practices like test-driven development.
Testing strategies for modern software architectures are evolving. As we transition from monolithic structures to team-sized microservices with crisp APIs aligned to bounded contexts, we encounter more stable testing surfaces. This shift leads many high-performing teams to favor integration tests over fine-grained, brittle unit tests. These integration tests, which are closer to the functional requirements, prove more trustworthy and are more resilient to internal refactoring, though they may come with a higher cost. In a vivid and engaging style, this talk addresses the primary challenges of integration testing in the microservices era: cognitive overload, test isolation, and test execution speed. Join the testing revolution and discover how to enhance your team's testing efficiency and effectiveness.
This document provides information on JavaScript patterns and best practices. It discusses 3 categories of design patterns (creational, structural, behavioral), antipatterns to avoid, and best practices for code reuse, namespaces, modules, private properties, and more. Specific patterns like builder, factory, decorator, facade, and proxy are covered. jQuery techniques like chaining, DOM manipulation, and plugin development are also summarized.
How do you tame a big ball of mud? One test at a time.Matt Eland
A broad and high level overview of .NET unit test libraries that will help you write better tests. Discussions around Scientist .NET, Bogus, AutoFixture, Snapper, and others.
Why another test framework in dotnet ? In this presentation, I will try to convince you to switch to xUnit. Main concepts & extensibility points are covered here. Happy testing !
The document provides a biography and background information on Daniel N. Egan, including his roles as a Microsoft Regional Director, Microsoft MVP for ASP.Net, author, and speaker. It then outlines the topics to be covered in the presentation, including object relational mappers, language enhancements in C# and VB.Net, LINQ goals, fundamentals and usage.
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
The microservices honeymoon is over. When starting a new project or revamping a legacy monolith, teams started looking for alternatives to microservices. The Modular Monolith, or 'Modulith', is an architecture that reaps the benefits of (vertical) functional decoupling without the high costs associated with separate deployments. This talk will delve into the advantages and challenges of this progressive architecture, beginning with exploring the concept of a 'module', its internal structure, public API, and inter-module communication patterns. Supported by spring-modulith, the talk provides practical guidance on addressing the main challenges of a Modultith Architecture: finding and guarding module boundaries, data decoupling, and integration module-testing. You should not miss this talk if you are a software architect or tech lead seeking practical, scalable solutions.
About the author
With two decades of experience, Victor is a Java Champion working as a trainer for top companies in Europe. Five thousands developers in 120 companies attended his workshops, so he gets to debate every week the challenges that various projects struggle with. In return, Victor summarizes key points from these workshops in conference talks and online meetups for the European Software Crafters, the world’s largest developer community around architecture, refactoring, and testing. Discover how Victor can help you on victorrentea.ro : company training catalog, consultancy and YouTube playlists.
This document provides instructions for a DevSecCon workshop on securing secrets in development pipelines. The workshop aims to help developers and managers address the problem of hardcoded secrets being checked into code repositories by demonstrating how to remove and rotate secrets using a secret management server integrated with Jenkins. Participants will carry out hands-on labs to find hardcoded secrets, replace them with environment variables stored in a secret server, and prevent secrets from being exposed in builds.
- Legacy Perl code is code that uses outdated practices, has no tests or documentation, and is difficult to understand and modify. It often results from organic growth over many years and developers.
- Unit testing legacy code provides safety during refactoring, speeds up development by replacing debugging, and creates regression tests. However, the code's dependencies make it difficult to isolate and test.
- Techniques like dependency injection, sprouting, monkey patching, and temporary object reblessing can help break dependencies and make legacy code more testable. Instrumentation with profilers also aids understanding the code.
The document provides an overview of Daniel Egan's professional experience including his roles as a Microsoft Regional Director, Microsoft MVP for ASP.Net, Chief Architect at Odyssey Consulting Group, author, instructor, and his involvement with various .Net user groups. It then outlines topics to be covered including object relational mappers, language enhancements in VB.Net and C# 3.0, LINQ and LINQ to SQL.
original (better quality) on https://docs.google.com/presentation/d/1bnwj8CrFGo5KekONYSeIHySdkoXZiewJxkHcZjXnzkQ/
slides from OpenDaylight Summit Oct 2016 Seattle
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Steven Smith
Design patterns help developers and teams solve problems using proven approaches. In this talk, you'll learn how to solve a series of real world problems by applying patterns. Not only do patterns help individual developers solve particular problems, but they also enable teams to discuss design decisions using a richer, more descriptive language. By the end, you'll have some concrete tools you can apply, and hopefully the desire to master more patterns as you continue to improve!
Patterns (contd)Software Development ProcessDesign patte.docxdanhaley45372
Patterns (contd)
Software Development Process
Design patterns used to handle change
More time extending and changing code than developing it.
The Strategy design pattern handle change by selecting from a family of external algorithms rather than rewrite.
Design point: Make code closed for modification of code, but open for extension
Problem
Computer object created
Description Method returns
Getting a Computer
Problem
Program has to change every time
Customer changes options
Decorator Pattern
Wrapper code used to extend your core code
Extend a class dynamically at runtime
Decorator uses wrapper code to extend core functionality - decorating the code
Decorator Pattern
description() returns “You are getting a computer”
Wrapper description() returns
“You are getting a computer and a disk”
Wrapper description() returns
“You are getting a computer and a disk and a monitor”
Decorator Pattern
Core component: Computer
Variables holding computer objects should also be able to hold objects that wrap computer objects.
Extend the wrapper classes from the Computer class.
Abstract class cannot be instantiated
Ensures all wrappers are consistent
Developers have to provide their own description
Decorator Pattern
Method calls the core computer object’s
description method and adds “and a disk”
Decorator Pattern
Method calls the core computer object’s
description method and adds “and a disk”
Extend the core object by wrapping it in decorator wrappers. Avoids modification of the core code.
Each successive wrapper called the description method of the object it wrapped and added something to it.
Factory Pattern
Based on type, call the
Connection method
Factory Pattern
Create a method that returns the
correct connection type
Factory Pattern
New operator used to create OracleConnection objects.
New operator used to create SqlServerConnection objects, and MySqlConnection objects.
New operator to instantiate many different concrete classes
Code becomes larger and needs to be replicated in many places
Factor that code out into a method.
Code keeps changing
Encapsulate code into a factory object
Goal: Separate out the changeable code and leave the core code closed for modification
Building the Factory
Creating the Factory
FirstFactory class encapsulates the connection object creation
Pass to it the type of connection (“Oracle”, “SQL Server”,)
Use the factory object to create connection objects with a factory method named createConnection
Building the Factory
Create the FirstFactory class.
Save the type of the database, passed to the FirstFactory class’s constructor.
Object-creation code changes
Check which type of object to be created
(OracleConnection, SqlServerConnection,
and then create it.
Factory Class
Create the Abstract Connection Class
Core code should not be modified or has to be modified
as little as possible.
Using the connection object returned by the
new factory object
Use t.
This is an introduction to unit testing using various mocking frameworks. It covers why you should consider using a mocking framework, how to apply mocks in your unit testing, and a high level comparison of various tools for mocking/stub creation. The distinction between mocks and stubs is clearly defined.
1. The document discusses object-oriented programming concepts like abstraction, encapsulation, inheritance, polymorphism, and dynamic binding.
2. It then provides details on the history and features of Java, including how Java code is compiled and run on the Java Virtual Machine.
3. Core object-oriented features of Java like classes, objects, constructors, and method overloading are explained.
Tracing the root cause of a performance issue requires a lot of patience, experience, and focus. It’s so hard that we sometimes attempt to guess by trying out tentative fixes, but that usually results in frustration, messy code, and a considerable waste of time and money. This talk explains how to correctly zoom in on a performance bottleneck using three levels of profiling: distributed tracing, metrics, and method profiling. After we learn to read the JVM profiler output as a flame graph, we explore a series of bottlenecks typical for backend systems, like connection/thread pool starvation, invisible aspects, blocking code, hot CPU methods, lock contention, and Virtual Thread pinning, and we learn to trace them even if they occur in library code you are not familiar with. Attend this talk and prepare for the performance issues that will eventually hit any successful system.
About authorWith two decades of experience, Victor is a Java Champion working as a trainer for top companies in Europe. Five thousands developers in 120 companies attended his workshops, so he gets to debate every week the challenges that various projects struggle with. In return, Victor summarizes key points from these workshops in conference talks and online meetups for the European Software Crafters, the world’s largest developer community around architecture, refactoring, and testing. Discover how Victor can help you on victorrentea.ro : company training catalog, consultancy and YouTube playlists.
The network is reliable, has zero latency, with infinite, free bandwidth... And then you wake up. The plan was to go to microservices to build those reliable, super-scalable systems you saw in the ad. But your systems only communicate over synchronous protocols and the team never had a serious discussion about timeouts, retries, circuit breakers, and bulkhead patterns. If that’s your crude reality, please attend this session!
One of the many challenges of a distributed architecture is preserving the consistency of data across different systems. During this one-hour presentation, we are going to explore a number of strategies for maintaining consistency, going from the most basic options up to an automated recovery mechanism using compensations and reservations - what’s commonly referred to as a “saga” pattern. Our journey will be based on a hypothetical food delivery application on which we will analyze various decisions and their tradeoffs. The discussion will stay at an abstract, architectural level for the most part, with only a few code examples.
In the agenda:
- Idempotency and Retries
- 2 Phase Commit
- Eventual Consistency
- Compensations
- Reservations
- The Saga Pattern
Ready for a deep dive into the world's most challenging programming paradigm? Reactive programming can simplify asynchronous and event-driven applications, but without a strong understanding, it can lead to frustration, recurring patchwork, missed deadlines, and costly bugs.
In this intensive three-hour session, we'll transition a traditional Spring application to WebFlux, revealing patterns and aanti-patterns when working with repositories, REST APIs, queues, and legacy libraries. You'll gain a clear understanding of often overlooked but critical aspects like subscribe signal, errors, cancellation, and signal loss. As a bonus, we'll debate the future of Reactive vs Virtual Threads, production-ready in Java 21.
This session is crucial for developers already working with reactive programming or those intending to make the leap.
Slides for my presentation about OAuth, going in depth in the details of the Authorization Code Grant and PKCE, also describing several security threats to OAuth
Refactoring blockers and code smells @jNation 2021Victor Rentea
The only way to survive in a codebase is by refactoring continuously. We know that since the Extreme Programming days. But what stops us from doing so today? In this talk, Victor summarizes what he learned discussing Clean Code and Refactoring with hundreds of teams throughout the world. You'll find ideas to tackle a broad spectrum of factors: technical, cultural, psychological, emotional, social, and even political. Using these you might unlock the freedom to refactor for you and your colleagues.
After this roundtrip, the talk briefly overviews several of the most dangerous code smells in the projects today: God Class, Duplicated Code vs Divergent Code, Temporal Coupling, Middle Man, Speculative Generality, Mutable Long-Lived State, Comments, and more. For each of them we’ll discuss a typical workaround, plus several subtleties and variations.
Hibernate and Spring - Unleash the MagicVictor Rentea
This document provides an overview of several Java technologies:
- JPA Auditing for tracking entity creation/modification dates and users
- Domain Events in DDD for triggering processing across aggregates
- javax.validation for validating entities before database writes
- Spring Data Repos for implementing repositories with query methods and custom logic
It also briefly discusses JPA auditing implementation, domain event publishing, custom validators, and the @NonNullApi annotation for preventing null returns from repositories.
Integration testing with spring @JAX MainzVictor Rentea
Our sleep is better with longer-scoped tests. Our life is brighter if we don’t rely heavily on fine-grained tests that break whenever we refactor even the smallest detail. I’m talking about tilting the balance towards more integration than unit testing. And for that, let’s look at the testing features offered by the most used Java Framework today. We’ll see how to write fake test implementations, how to mock an unwanted Spring bean, what a Transactional Test is, and if and how to test your web endpoints. Along the way, we’ll also see Flaky tests, and discuss best practices about integration testing – all in an entertaining live coding session.
Your takeaways from this talk will be a lot of good practices and techniques directly applicable to your day-to-day project.
The Proxy Fairy and the Magic of Spring @JAX Mainz 2021Victor Rentea
You can only claim you know Spring if you fully understand the Proxy design pattern and how the framework uses it to do its magic. Join this live coding session to explore 6 ways of intercepting method calls that you can use to cast your own spells and dramatically simplify your codebase.
Grab a strong coffee and prepare yourself for a whirlwind of **live-coding**, interwoven with **deep theoretical concepts and implementation details** that you need to master if you are using the Spring Framework. We’ll start from a Decorator pattern implementation, proving 2 ways to wire it with Spring, then move to bare-hands interface proxies, concrete classes proxies, @Aspect applied to custom annotations, plus some standard off-the-shelf Spring aspects.
Join this talk and learn real-world best practices to use with Aspects, design hints, under-the-hood implementation details, debugging tips, and performance impact of aspects. All in an interactive, entertaining, and extremely dynamic session.
Pure functions and immutable objects @dev nexus 2021Victor Rentea
aaaaThis presentation focuses on two of the most advanced design tools in your toolbox, whatever the language or framework you might be using. After understanding the basics, we'll see how these concepts can be used in real-world scenarios to simplify those several most complex use-cases in your application. At the end of a mix of slides and live-coding, you'll finally understand the power of these ideas and become prepared to apply them in your day-to-day work.
Along the way, we'll introduce concepts like Side Effects, Idempotency, Referential Transparency, Pure Functions and Deep/Shallow Immutability. Also, we'll talk about the powerful Functional Code / Imperative Shell architecture that you can use for your complex workflows.
Prepare for an entertaining, highly interactive session that will answer all your questions.
Written in Java and spoken in English.
This document describes Victor Rentea, an independent trainer and founder of the Bucharest Software Craftsmanship Community who has provided technical training to over 2000 developers over 8 years. It promotes Victor Rentea's training services on topics like Hibernate, Spring, Java performance, reactive programming, design patterns, clean code, refactoring, and unit testing in any language. The document also provides brief summaries of test-driven development and the three rules of TDD according to Uncle Bob, as well as a definition of code golf.
Definitive Guide to Working With Exceptions in Java - takj at Java Champions ...Victor Rentea
A Pragmatic approach to work with exceptions in Java. Talk recording: https://www.youtube.com/watch?v=LRwCE7GreSM&feature=youtu.be
Discussing checked exceptions, Vavr, Lombok, and JooL library, Spring Framework and many more.
Supporting in-depth article series: https://victorrentea.ro/blog/exception-handling-guide-in-java/
First, what are they? And why they are important? What do they allow us to do, and what problems do they shield us from?
After this talk, you'll inevitably fall in love with pure functions and immutable objects. We'll see how to implement them in Java, in the most geek ways possible, concerned about long-term maintainability of the code. Oh, and we'll also have Lombok and records along the way, plus lots of fun while tasting a bit of "a senior developer's night-life".
Given at jLove Dec 2020
Definitive Guide to Working With Exceptions in JavaVictor Rentea
Exceptions have been with us for 25 years in Java but have we learned to use them properly? Are checked exceptions a mistake? Should you use throw runtime or checked exceptions? And what to do with a checked exception, when you get one? And how to slay the boss of all exceptions: the NullPointerException.
Let’s put these old questions in the context of Java8+ lambdas, Vavr monads, Lombok, Spring, JAX-RS and other modern frameworks, and see the best practices of handling errors in Java today.Let’s put these old questions in the context of Java8+ lambdas, Vavr monads, Lombok, Spring, JAX-RS and other modern frameworks, and see the best practices of handling errors in Java today.
Decades ago, IT started as a single engineering practice, but as time passed by it got increasingly fragmented. Conflicts broke out between testers vs developers vs sysadmins vs DBAs vs many other roles. Recently, developers themselves split into many subspecialties like backend/frontend/iOS/Android/microservices/functions/etc. The overspecialization we face today is a rich source of communication overhead, a low bus factor, lack of responsibility, blaming, repeated isolated patching and fulminating costs. More than a ‘full-stack’ developer, a software craftsperson distinguishes oneself by acting professionally and taking responsibility for as many aspects of one’s work. Jump on this never-ending journey of continuous improvement and decide what’s the next level for your own case.
For a company/individual training, check out my website: victorrentea.ro
Engaging Isolation - What I've Learned Delivering 250 Webinar Hours during CO...Victor Rentea
In this workshop I will share my experience as a full-time trainer since the COVID-19 outbreak, discussing the techniques I tried, what failed, and what worked, how delivering workshops changed, and what must you do to adapt to today's savage training environment. This is not a sales pitch, but I really want to help you during these times.
Agenda:
- Impactful content type
- Ideal group size
- Ways to adjust the content to remote audiences
- Engaging techniques that really work
- Critical Timing: tricks for better time-use
- The art of asking for questions
- Ways to persist your impact after the session
- Building trust that Online Does Work!
- When and How to gather significant feedback?
- Marketing your webinar
Target Audience: The discussion is not technical (doesn't involve many programming concepts), so anyone interesting in delivering, facilitating or contracting effective online training sessions is invited. Also those preparing to deliver a talk at a conference can benefit from many ideas
What to do when you have a perfect model for your software but you are constrained by an imperfect business model?
This talk explores the challenges of bringing modelling rigour to the business and strategy levels, and talking to your non-technical counterparts in the process.
Flutter is a popular open source, cross-platform framework developed by Google. In this webinar we'll explore Flutter and its architecture, delve into the Flutter Embedder and Flutter’s Dart language, discover how to leverage Flutter for embedded device development, learn about Automotive Grade Linux (AGL) and its consortium and understand the rationale behind AGL's choice of Flutter for next-gen IVI systems. Don’t miss this opportunity to discover whether Flutter is right for your project.
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
SOCRadar's Aviation Industry Q1 Incident Report is out now!
The aviation industry has always been a prime target for cybercriminals due to its critical infrastructure and high stakes. In the first quarter of 2024, the sector faced an alarming surge in cybersecurity threats, revealing its vulnerabilities and the relentless sophistication of cyber attackers.
SOCRadar’s Aviation Industry, Quarterly Incident Report, provides an in-depth analysis of these threats, detected and examined through our extensive monitoring of hacker forums, Telegram channels, and dark web platforms.
Mobile app Development Services | Drona InfotechDrona Infotech
Drona Infotech is one of the Best Mobile App Development Company In Noida Maintenance and ongoing support. mobile app development Services can help you maintain and support your app after it has been launched. This includes fixing bugs, adding new features, and keeping your app up-to-date with the latest
Visit Us For :
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
Top 9 Trends in Cybersecurity for 2024.pptxdevvsandy
Security and risk management (SRM) leaders face disruptions on technological, organizational, and human fronts. Preparation and pragmatic execution are key for dealing with these disruptions and providing the right cybersecurity program.
SMS API Integration in Saudi Arabia| Best SMS API ServiceYara Milbes
Discover the benefits and implementation of SMS API integration in the UAE and Middle East. This comprehensive guide covers the importance of SMS messaging APIs, the advantages of bulk SMS APIs, and real-world case studies. Learn how CEQUENS, a leader in communication solutions, can help your business enhance customer engagement and streamline operations with innovative CPaaS, reliable SMS APIs, and omnichannel solutions, including WhatsApp Business. Perfect for businesses seeking to optimize their communication strategies in the digital age.
SMS API Integration in Saudi Arabia| Best SMS API Service
The tests are trying to tell you something@VoxxedBucharest.pptx
1. Your tests are trying
to tell you something ...
10 design hints you were missing
Read the article:
https://victorrentea.ro/blog/design-insights-from-unit-testing/
About the speaker:
https://victorrentea.ro
2. victorrentea.ro/training-offer
Hi, I'm Victor Rentea 🇷🇴
Java Champion, 17 years of code, code, code, code, code....
Consultant & Trainer: 5000 developers of 100+ companies in EU:
❤️ Clean Code, Architecture, Unit Testing
🛠 Spring Framework, Hibernate/JPA, Reactive/WebFlux
⚡️ Java Performance, Secure Coding 🔐
Conference Speaker – find many recoded talks online
Founder of Bucharest Software Crafters Community: 5000+ members
🔥 Free monthly Zoom webinars, 1-2 hours after work. Join at victorrentea.ro/community
Past events on my channel: youtube.com/vrentea
Father of 👧👦, woke up at night by a 😺: VictorRentea.ro
3. 3 VictorRentea.ro
From the Agile Ideology ...
Emergent Design
while we keep shipping shit working software fast,
the design of the system will naturally evolve by itself
(as opposed to large up-front design that can cause overengineering)
4. 4 VictorRentea.ro
Writing Tests give you hints
on when to improve the design
Emergent Design
that never emerged
😩
We need triggers!
When should I refine the design?
5. 5 VictorRentea.ro
Kent Beck
Creator of Extreme Programming (XP)
a very technical form of Agile
Inventor of TDD
Author of JUnit
Father of Unit Testing
6. 6 VictorRentea.ro
1. Passes all Tests 💪
2. Expresses Intent = SRP, Domain Names
2. No Duplication = DRY🌵
3. Keep it Simple = KISS💋
Rules of Simple Design
by Kent Beck
https://martinfowler.com/bliki/BeckDesignRules.html
design feedback 💎
10. 10 VictorRentea.ro
Why we 💖 Mocks
Isolated Tests
from external systems 🤔
Fast 🐇
no framework, DB, external APIs
Simpler
when testing high complexity 😵💫
Alternatives:
in-mem DB
Testcontainers 🐳
WireMock
Cheating*
* James Coplien in https://rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste.pdf
11. 11 VictorRentea.ro
Logic
under test
Cyclomatic Complexity
= number of independent execution paths through code ≈ max no. tests
Test
Test
Test
Test
Test
Test
Test
CC=5 CC=6
f(a) g(b)
calls
f() calling g() together have a CC =
Many
To cover all branches
Heavy
setup and input data
Tests for a+b become...
3
0
15. 15 VictorRentea.ro
The test has 20 lines full of mocks
😵💫
😡
BURN THE TEST!
has a bad cost/benefit ratio
HONEYCOMB TESTING
Outside-in from integration- to unit- test
WHAT AM I TESTING HERE ?
syndrome
Tested prod code has 4 lines
😩
f(..) {
a = api.fetchB(repoA.find(..).getBId());
d = service.createD(a,b,repoC.find(..));
repo3.save(d);
mq.send(d.id);
}
REDESIGN PRODUCTION
Collapse Middle-Man / useless layer
17. 17 VictorRentea.ro
The Bad Monolith ("Big ball of mud") has
- Highly coupled code
- Huge complexity behind a few entry points the need for lots of Unit Tests
Microservices / Modulith
- Huge complexity in a single microservice = bad practice Break µservice/module
- Many APIs, hiding a decent amount of complexity (🙏)
- Easier to test more at the API level Honeycomb Testing Strategy
Testing Microservices is different
18. 18 VictorRentea.ro
Integration
test the entire microservice in isolation
Integrated
may fail because of another system
Implementation Detail
complex parts of the code
Start up all microservices in the ecosystem.
Expensive, flaky, but business-critical e2e tests (eg checkout)
Responsibility of a central QA team(?)
Test end-to-end as many flows in your system.
Starts up the entire system (@SpringBootTest)
Keep tests isolated without mocks
Separate tests for the parts of the code naturally isolated
with high internal complexity.
Mocks are allowed
Still: test roles, not methods/classes
Write social unit tests
Honeycomb Testing Strategy
(suitable for microservices)
Testcontainers 🐳
WireMock
DB ES Kafka ...
API
many tests on
one entrypoint
decouple and test alone
https://engineering.atspotify.com/2018/01/testing-of-microservices/
19. 19 VictorRentea.ro
⚠️
Test manageable complexity without mocks
A B
Instead, test "components" (groups of objects)
#0
Internal refactoring won't break tests
20. 20 VictorRentea.ro
You get most design feedback
from tests in 'Implementation Detail'
Implementation
Detail
22. 22 VictorRentea.ro
var bigObj = new BigObj();
bigObj.setA(a);
bugObj.setB(b);
prod.method(bigObj);
Tests must create bigObj just to pass two inputs🧔
method(bigObj)
MUTABLE
DATA in 2023?
using only 2 of the 15 fields in bigObj
method(a, b)
Precise Signatures prod.method(a, b);
Also, simpler tests:
Pass only necessary data to functions ✅
when(bigObj.getPart1())
.thenReturn(p1);
⛔️ Don't Mock Getters ⛔️
Mock behavior, not data
prod.method(new AB(a, b));
method(ab)
Parameter Object
Testing highly complex logic:
⛔️ Don't have Mocks return Mocks⛔️
23. 23 VictorRentea.ro
🏰
Constrained Objects
= data structures that guard their internal consistency by throwing exceptions,
(eg required fields, string size / regex, or more complex domain rules)
Mutable (eg Domain Entities, Aggregates)
via constructor and setters/mutator methods
Immutable❤️ (Value Objects)
via constructor
24. 24 VictorRentea.ro
A group of classes has a
clear role and manageable complexity (A)
An Object is Constrained ✅ but Large (B)
Object Mother Pattern*
eg. TestData.john(): Customer
coupling
Break Domain Entities
in separate Bounded Contexts
packages > modulith > microservices
Test the entire group with a social unit-test✅:
requires larger setup and larger input
* https://martinfowler.com/bliki/ObjectMother.html (2006)
Same test data factory used in different verticals
customer | order
↓
Break Object Mother per vertical
CustomerTestData | OrderTestData
Creating valid test data gets cumbersome
CREEPY
A shared class creating valid test objects
25. 26 VictorRentea.ro
Your complex logic directly uses
APIs or heavy libraries: Unit-testing your logic
requires understanding the semantics of:
The External API: to populate/assert DTOs
The Library: to mock it
... api.call(apiDetails);
... dto.getStrangeField()
... Lib.use(mysteriousParam,...)
Unit Tests speak your Domain Model
Unit Tests are first-class citizens of your project
#respect them
Agnostic Domain
Isolate complex logic from the outside world
... clientAdapter.call(domainStuff)
... domainObject.getMyField()
... libAdapter.use(😊)
26. application / infra
Value Object
Entity
id
Domain
Service
Domain
Service
agnostic
domain
My DTOs
External
API
External
DTOs
Clien
t
External
Systems
Façade
Controller Repo
IAdapter
Adapter
⛔️
⛔️
Deep complexity is kept inside
for easier testing
Simplified Onion Architecture
Interf
Ugly
Invasive
Library
29. 30 VictorRentea.ro
class Big {
f() { //complex
g();
}
g() { //complex
}
}
Inside the same class,
a complex function f()
calls a complex g()
g() is complex => unit-tested separately
When testing f(), can I avoid executing g()?
That is: can I mock a local method call?
class HighLevel {
LowLevel low;
f() {//complex
low.g();
}
} class LowLevel {
g() {/*complex*/}
}
↓
Partial Mock (@Spy)
Hard to maintain tests:
Which method is real, which is mocked?🧔
Split by Layers of Abstraction
(high-level policy vs low-level details)
Tolerable testing Legacy Code
If splitting the class doesn't feel right,
test f+g together with bigger tests
30. 31 VictorRentea.ro
class HighLevel {
LowLevel low;
f() {//complex
low.g();
}
}
Split by Layers of Abstraction
= vertical split of a class
class LowLevel {
g() {/*complex*/}
}
31. 32 VictorRentea.ro
class Wide {
A a;
B b; //+more dependencies
complexA() {..a.fa()..}
complexB() {..b.fb()..}
}
@ExtendWith(MockitoExtension)
class WideTest {
@Mock A a;
@Mock B b;
@InjectMocks Wide wide;
// 5 tests for complexA()
// 4 tests for complexB()
}
↓
Separate test classes: ComplexATest, ..B..
(keep before useful for all tests 👌)
Complex methods in the same class
use different sets of dependencies:
class ComplexA {
A a; // +more
complexA() {
..a.fa()..
}
}
class ComplexB {
B b; // +more
complexB() {
..b.fb()..
}
}
@BeforeEach
void fixture() {
when(a.fa()).then...
when(b.fb()).then...
}
Split Unrelated Complexity not used when
testing complex1()
what part of the before
is used by my failed test?
** Mockito (since v2.0) throws UnnecessaryStubbingException if a when..then is not used by a @Test, when using MockitoExtension
** This is
BIG
🧔
FIXTURE CREEP
test setup
DRY Principle
32. 33 VictorRentea.ro
Split Unrelated Complexity
= horizontal split a class
class ComplexA {
A a; // +more
complexA() {
..a.fa()..
}
}
class ComplexB {
B b; // +more
complexB() {
..b.fb()..
}
}
36. 37 VictorRentea.ro
BAD HABIT
Mock Roles, not Objects
http://jmock.org/oopsla2004.pdf
You implement a new feature
> ((click in UI/postman)) > It works > Yee-Haa!
OMG, I forgot about unit-tests 😱
...then you write unit tests
by mocking all dependencies
of the prod class you wrote
Several years later, you complain that
your tests are fragile and impede refactoring
Contract-Driven Design
Before mocking a dependency,
clarify its responsibility
=
Changing an API you mocked is painful
😭
37. 38 VictorRentea.ro
"Unit Testing means mocking all dependencies of a class"
- common belief
"It's perfectly fine for unit tests to talk to databases and filesystems!"- Ian Cooper
Unit Testing
= ?
38. 39 VictorRentea.ro
timeframe for developing your feature
When do you start writing tests?
✅ understand the problem => early questions to biz
✅ early design feedback 💎 💎 💎
✅ real test coverage => courage to refactor
41. 42 VictorRentea.ro
1) Has no Side-Effects
(doesn't change anything)
INSERT, POST, send message, field changes, files
2) Same Inputs => Same Output
(no external source of data)
GET, SELECT, current time, random, …
Pure Function
aka "Referential Transparency"
42. 43 VictorRentea.ro
No Network or files
No Changes to Data
No time/random
Pure Functions
use immutable objects❤️
they are super fast
(simplified definition)
43. 44 VictorRentea.ro
a = repo1.findById(..)
b = repo2.findById(..)
c = api.call(..)
🤯complexity🤯
repo3.save(d);
mq.send(d.id);
Very complex logic
using many dependencies
(eg: computePrice, applyDiscounts)
Many tests
using heavy mocking
when(..).thenReturn(a);
when(..).thenReturn(b);
when(..).thenReturn(c);
prod.complexAndCoupled();
verify(..).save(captor);
verify(..).send(...);
x15=😖
Easier to test w/ less mocks ✅
d = prod.pure(a,b,c);
assertThat(d)...
Reduce Coupling of Complex Logic
D pure(a,b,c) {
🤯complexity🤯
return d;
}
Easier to understand ✅
46. 47 VictorRentea.ro
method(Mutable order, d) {
ds.applyDiscounts(order, d);
var price = cs.computePrice(order);
return price;
}
... but you use mutable objects
Swapping two lines can still cause bugs
that is: 4000 ✅ tests, ❌ bugs in production
You have 4.000 unit tests,
100% test coverage 😲
👏
↓
Paranoid Testing
(verifying method call order)
Immutable Objects
method(Immutable order, d) {
var discountedOrder = ds.applyDiscounts(order, d);
var price = cs.computePrice(discountedOrder);
return price;
}
TEMPORAL
COUPLING
Swapping two lines
❌ does not compile
47. 48 VictorRentea.ro
1. Collapse Middle-Man vs "What am I testing here?" Syndrome
2. Honeycomb Testing Strategy vs Fragile microscopic Unit Tests
3. Precise Signatures
4. Tailored Data Structures vs Creepy Object Mother
5. Keep complexity inside Agnostic Domain not on APIs or Extensive
Libraries
6. Separate Complexity by Layers of Abstraction ↕️ vs @Spy
7. Separate Unrelated Complexity ↔️ vs Fixture Creep (bloated setup)
8. Refine Roles (Mock Roles, not Objects) vs blindly @Mock all dependencies
9. More Complexity => Less Dependencies vs Mock-full tests
10.Promote Immutable Objects vs Temporal Coupling
Design Hints from Tests
50. 51 VictorRentea.ro
Unit Testing Reading Guide
1] Classic TDD⭐️⭐️⭐️ (mock-less) https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530
Mock Roles, not Objects ⭐️⭐️⭐️: http://jmock.org/oopsla2004.pdf
"Is TDD Dead?" https://martinfowler.com/articles/is-tdd-dead/
Why Most Unit Testing is Waste (James Coplien): https://rbcs-us.com/documents/Why-Most-Unit-Testing-is-Waste.pdf
vs Integrated Tests are a Scam(J Brains): https://blog.thecodewhisperer.com/permalink/integrated-tests-are-a-scam
2] London TDD⭐️⭐️⭐️ (mockist) https://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627
3] Patterns⭐️ https://www.amazon.com/Art-Unit-Testing-examples/dp/1617290890
4] https://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054/
5] (skip through) https://www.amazon.com/Unit-Testing-Principles-Practices-Patterns
51. 52 VictorRentea.ro
Write more automated tests,
earlier, to have time to listen to
what tests are trying to tell you
Join my community to keep in touch,
FOR free monthly, ONLINE debates :
victorrentea.ro
Notas do Editor
I'm victor rentea, I'm a java champion of Romania, working in our field for 17 years.
8 years ago I realized coding was not enough for me, and I started looking around to help the others.
Today this is my full-time job: training and consultancy for companies throughout Europe.
My favorite topics are ...
but of course, to talk about these topics you have to master the frameworks you use, so I do intense workshops on Spring Framework, ....
More senior groups often call me for performance tuning or secure coding. If you want to know more, you can find there my full training offer
Besides the talks at different conferences that you can find online, I try to to one webinar each month for my community.
A few years ago I started this group on meetup to have where to share my ideas and learn from the others in turn.
- This community has exceeded my wildest dreams, turning into one of the largest communities in the world on Software Craftsmanship.
- So what happens there? One day a month we have a zoom online webinar of 1-2 hours after work, during which we discuss one topic and then debate ideas from the participants – usually we have close to 100 live participants, so it's very engaging. If you want to be part of the fun, DO join us, it's completely free.
- Many past events are available on my youtube channel.
- Outside of work, I have 2 kids and a cat that wakes us up in the middle of the night.