Codepocalypse Now LangChain4j vs. Spring AI

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

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

Thank You, DEVOXX FRANCE

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(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

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