Codepocalypse Now: LangChain4j vs. Spring AI

A presentation at DevoxxFR in April 2025 in Paris, France by Viktor Gamov

Slide 1

Slide 1

Codepocalypse Now LangChain4j vs. Spring AI

Slide 2

Slide 2

@jbaruch http://speaking.jbaru.ch @gamussa https://speaking.gamov.io/

Slide 3

Slide 3

Why Frameworks? / Devoxx France Codepocalypse Now LangChain4j vs. Spring AI

Slide 4

Slide 4

Thank You, DEVOXX FRANCE

Slide 5

Slide 5

Prompt-Driven Development: Aligning Ideas, Tests, and Code @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 6

Slide 6

We have a Trust problem @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 7

Slide 7

@jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 8

Slide 8

AI generated code is not great @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 9

Slide 9

On top of that, it is dangerou s @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 10

Slide 10

Asking it to fix it is as reliabl e as the rest of it @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 11

Slide 11

Baruch Sadogursky - @jbaru ch × Developer Advocate at large (talk to me!) × Development -> DevOps -> #DPE @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 12

Slide 12

shownotes × × × × speaking.jbaru.ch Slides Video All the links! @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 13

Slide 13

Software design documents @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 14

Slide 14

Software design documents × Write-once × Read-maybe-once × (Mis)understood by humans @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 15

Slide 15

So why don’t they work? × Human (mis)understanding × Vague responsibility boundaries @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 16

Slide 16

@jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 17

Slide 17

@jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 18

Slide 18

@jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 19

Slide 19

We have a Trust problem (not only with AI) @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 20

Slide 20

Next thing you know: It’s a vein Software I know really well Software I like @jbaruch @gamussa diagram @Devoxxfr #pdd speaking.jbaru.ch

Slide 21

Slide 21

But hey, we do have working s oftware sometimes × Good intentions × Professionalism × Tests and QA × End result observation @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 22

Slide 22

Until gen AI changed the game × × × × Good intentions Professionalism Tests and QA End result observation @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 23

Slide 23

AI Coding Agents Software quality @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 24

Slide 24

I find your lack of trust disturbing @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 25

Slide 25

Idea! Verifiable intent What if we code in the intent and always verify against it? @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 26

Slide 26

Let’s express intent in tests × × × × Instead of SDDs Always up-to-date Generate consensus Parsed by the machine @jbaruch @gamussa @Devoxxfr TDD? #pdd speaking.jbaru.ch

Slide 27

Slide 27

@jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 28

Slide 28

What if it (almost) won’t look × × × × × like code? Instead of SDDs Always up-to-date Generate consensus Parsed by the machine Describe behavior instead of tests @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 29

Slide 29

What if it (almost) won’t look × × × × × like code? Always up-to-date BDD? Generate consensus Parsed by the machine Describe behavior instead of tests Almost plain English human language @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 30

Slide 30

@jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 31

Slide 31

But writing tests first is still Business people won’t write tests @jbaruch a good idea, right?! But the developers Still will, right?! @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 32

Slide 32

Why developers won’t write te sts first × Developers are solution-biased × We already know how to solve the problem × Legacy code bases @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 33

Slide 33

LLMs to the rescue! @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 34

Slide 34

How everything comes togeth er Business people define what software should do @jbaruch LLM creates specs @gamussa Specs are reviewed and agreed upon @Devoxxfr Tests are generate d and reviewed #pdd Code is written to satisfy the tests -> specs -> design speaking.jbaru.ch

Slide 35

Slide 35

Why does it work? × × × × × Business people write text Specs are reviewed by all SDDs are Specs are living docs Everything else is derived from specs Previous steps are protected @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 36

Slide 36

PDD is BDD as it meant to be × Define and agree on intent × AI is protected from circular verification × Up-to-date context docs at all times @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 37

Slide 37

Rules/Guidelines × Mostly refined by Cascade × The full version covers an existing codebase scenario × Has a link in /docs @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 38

Slide 38

New project × Phase 1: Define requirements using the memento pattern × Phase 2: Define test scenarios and specs × Phase 3: Implement tests and business logic @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 39

Slide 39

Existing project × Phase 0: Examine code and produce full test coverage × Existing tests are protected @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 40

Slide 40

Protection rules × Requirement documents are protected after Phase 1. × If changes are needed, the phase is reset × Test scenarios and specs are protected after Phase 2. @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 41

Slide 41

Recovery rules × Source control commits after stages × Requirements changes trigger phase reset and re-alignment × Might convert the project into ”existing” mode @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 42

Slide 42

Cascade in Windsurf Pros × Speed × Conversation and reflection × Selectable models @jbaruch @gamussa Cons × Not IntelliJ IDEA × .windsurfrules system is not ideal @Devoxxfr #pdd speaking.jbaru.ch

Slide 43

Slide 43

Junie in intellij idea Pros × IntelliJ IDEA × Execution Plan × guidelines.md is better @jbaruch @gamussa Cons × Speed × Introversion × No chat/reflection mode @Devoxxfr #pdd speaking.jbaru.ch

Slide 44

Slide 44

Better Rules system? × × × × × Multiple files for different scenarios Flexible actuators File references for reuse Optionally, part of the documentation .cursor/rules for the best implementation ATM @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 45

Slide 45

Too much code? × New prompt – new context window × Memento pattern FTW × But what if even the initial context is too large? × Is it the perfect argument for microservices? @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 46

Slide 46

Who should fix the code? × Code inspections (linting in VS Code) integration × “Switch from AI generation to tool calling when needed” × Leonid Kuligin – “What is an AI agent? How to develop one?” @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 47

Slide 47

Developer productivity @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 48

Slide 48

Is it engaging? @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 49

Slide 49

Looks like a pretty easy fix… @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 50

Slide 50

Are the stops intentional? ”rich mode”? @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 51

Slide 51

Use tools, add guardrails Using IntelliJ IDEA code inspections @jbaruch @gamussa Machineverify stages compliance Physically protect stage assets @Devoxxfr #pdd speaking.jbaru.ch

Slide 52

Slide 52

Is it too rigid? × The process feels the opposite of agile × Making changes is a pain × Are there other options? @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 53

Slide 53

(Summary) PDD – BDD finally m a kes sense × Generates consensus × Features are verifiable back to requirements × We can start trusting AI code (🤞) × But there is still work to be done @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 54

Slide 54

THANKS! Q&A and Twitter X/Bsky/LinkedIn ads: x x x x x @jbaruch @gamussa @devoxxfr #pdd speaking.jbaru.ch @jbaruch @gamussa @Devoxxfr #pdd speaking.jbaru.ch

Slide 55

Slide 55