SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Code generation with giant
        CRUD
        Tom Klaasen
           10to1
Tom Klaasen


    Works professionally with Java since 1999


    Co-founder of 10to1 (http://www.10to1.be)


    Has worked on a project involving a lot of


    code generation over the last 2 years
    tom@10to1.be





                      www.javapolis.com
Overall Presentation Goal




       Reducing typing with code
              generation




                    www.javapolis.com
The question




       Who wants to type in 1000+
            Java class files?




                 www.javapolis.com
The problem


    Mission: “Create generic CRUD screens for


    a domain model”




                     www.javapolis.com   6
The problem


    “Our domain model will likely contain a few


    hundred classes”




                      www.javapolis.com   7
The problem


    “Oh, and we’re not sure which parts will


    stay generic and which won’t”




                      www.javapolis.com    8
The problem


    “And please, have it done in 3 months, with


    4 developers”




                      www.javapolis.com   9
The problem


    “And use RUP. But don’t wait for the


    analysts to finish their job, because we
    don’t have that kind of time”
         Change your code when the Use Cases are
     

         finished




                         www.javapolis.com     10
The problem

    “(And don’t wait for the data modellers


    either. We really don’t have any time.)”




                       www.javapolis.com       11
The problem


    Domain model with 500+ classes


    Each class: 1 interface, 2 implementations


    Relations between those objects are first-


    class citizens
         Also 1 interface, 2 implementations
     

    Some classes have a lot of performance-


    gaining methods
         Fine-grained getters and setters for the relations
     

    Each class has 10+ attributes


         Each needing a getter and a setter
     

                            www.javapolis.com
The problem


    For each domain class:


         DAO
     

         Manager
     

         FormAction
     

         form.jsp
     

         searchform.jsp
     

         list.jsp
     

         editflow.xml
     

    Another 1000 lines of Java, JSP and XML


    code
                          www.javapolis.com   13
The problem


    Result: 2000+ lines of code per domain


    object
    For 4000 domain objects




    Who wants to type these in?





                     www.javapolis.com   14
The problem


    Most of the constructs will change over


    time
         4000 x 2000 lines of code are subject to change
     



    Who wants to make these corrections?





                           www.javapolis.com       15
Other constraints


    2 years ago: beginning of 2005


    Java 1.4





                        www.javapolis.com   16
The approach


    Generate everything


    But: make it possible to hand-code


    everything
    Attribute definitions: in the DB





                     www.javapolis.com   17
Generation process: first generation

                                            .hbm.xml    DB Tables


                                              .jsp


                                           FormAction
              Domain
DB
               .java

                                            Flow.xml


                                            Manager


                                             DAO




                       www.javapolis.com                18
The tools


    AppFuse + AppGen


         Ant
     

         XDoclet
     

         Hibernate
     

    Home-written Access tool





                     www.javapolis.com   19
The tools


    XDoclet: extended with custom annotations


         @gui hidden=”false”
     

         @relation mandatory=”true”
     




                          www.javapolis.com   20
Disadvantages


    Ant: messed-up build scripts


    XDoclet


         2 ‘design decisions’ for each information to be
     

         passed
         slow
     




                            www.javapolis.com        21
Improvements


    Maven


         Clean project structure
     

    FreeMarker


         More flexible than XDoclet
     

         Read directly from the DB
     

    Don’t always generate everything


    More and more hand-coded ‘generic’ files


         As knowledge about the domain grew
     




                            www.javapolis.com   22
The end situation

                                           .hbm.xml   DB Tables




              Domain
DB
               .java




                                             .jsp




                       www.javapolis.com              18
                                                      23
The pros


    Always flexible


         When no knowledge available: generate
     

         everything
         Override with hand-coded parts where necessary
     

         When patterns and securities arise: hand-code
     

         them in a generic way




                          www.javapolis.com      24
Comparison with other solutions


    Hand-code everything (and every change)


         Hire a lot of code monkeys
     

    Design everything generically, correctly the


    first time
         And good luck with that
     

    Trails


         Code is not generated
     

         Thus impossible to override
     

    Rails (with JRuby)


         This started in 2005, remember?
     

                           www.javapolis.com   25
Conclusion




 Code generation can make you flexible
   and responsive. Do try this at home.
             (Or at work)




                 www.javapolis.com
Q&A
View JavaPolis talks @ www.parleys.com
Thank you for your
    attention

Contenu connexe

Tendances

The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1Haci Murat Yaman
 
How Shopify Is Scaling Up Its Redis Message Queues
How Shopify Is Scaling Up Its Redis Message QueuesHow Shopify Is Scaling Up Its Redis Message Queues
How Shopify Is Scaling Up Its Redis Message QueuesRedis Labs
 
Ruby on Rails Workshop
Ruby on Rails WorkshopRuby on Rails Workshop
Ruby on Rails WorkshopYos Riady
 
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018Mike Hale
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​FDConf
 
«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​
«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​
«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​FDConf
 
React Native from Scratch | Session 01
React Native from Scratch | Session 01React Native from Scratch | Session 01
React Native from Scratch | Session 01Amir Ahangari
 
Reef: AJAX the way it should be 
Reef: AJAX the way it should be Reef: AJAX the way it should be 
Reef: AJAX the way it should be ESUG
 
A Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceA Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceValeri Karpov
 
Introduction to GraphQL - RVA JavaScript 2019
Introduction to GraphQL -  RVA JavaScript 2019Introduction to GraphQL -  RVA JavaScript 2019
Introduction to GraphQL - RVA JavaScript 2019Matt Lavin
 
Why we released the kraken
Why we released the krakenWhy we released the kraken
Why we released the krakenCristiano Betta
 
Cross-platform JavaScript
Cross-platform JavaScriptCross-platform JavaScript
Cross-platform JavaScriptHristo Chakarov
 

Tendances (19)

The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1
 
How Shopify Is Scaling Up Its Redis Message Queues
How Shopify Is Scaling Up Its Redis Message QueuesHow Shopify Is Scaling Up Its Redis Message Queues
How Shopify Is Scaling Up Its Redis Message Queues
 
Ruby on Rails Workshop
Ruby on Rails WorkshopRuby on Rails Workshop
Ruby on Rails Workshop
 
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​
 
«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​
«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​
«Разрушаем Вавилонскую Башню WWW с помощью веб-компонент»​
 
React Native from Scratch | Session 01
React Native from Scratch | Session 01React Native from Scratch | Session 01
React Native from Scratch | Session 01
 
Reef: AJAX the way it should be 
Reef: AJAX the way it should be Reef: AJAX the way it should be 
Reef: AJAX the way it should be 
 
A Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceA Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-Service
 
Node as an API shim
Node as an API shimNode as an API shim
Node as an API shim
 
Introduction to GraphQL - RVA JavaScript 2019
Introduction to GraphQL -  RVA JavaScript 2019Introduction to GraphQL -  RVA JavaScript 2019
Introduction to GraphQL - RVA JavaScript 2019
 
Why we released the kraken
Why we released the krakenWhy we released the kraken
Why we released the kraken
 
resume
resumeresume
resume
 
sponge-tech
sponge-techsponge-tech
sponge-tech
 
Cross-platform JavaScript
Cross-platform JavaScriptCross-platform JavaScript
Cross-platform JavaScript
 
Evolution of java script libraries
Evolution of java script librariesEvolution of java script libraries
Evolution of java script libraries
 
Html5
Html5Html5
Html5
 
Overcome a Frontier
Overcome a FrontierOvercome a Frontier
Overcome a Frontier
 
HTML5 and friends
HTML5 and friendsHTML5 and friends
HTML5 and friends
 

Similaire à Code Generation with giant CRUD

Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryMatt Butcher
 
Node.js #digpen presentation
Node.js #digpen presentationNode.js #digpen presentation
Node.js #digpen presentationGOSS Interactive
 
Java overview the piramide of success
Java overview the piramide of successJava overview the piramide of success
Java overview the piramide of successArtem Bilan
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesJazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesSimon Willison
 
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...jward5519
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?jbandi
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008rajivmordani
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Coursepeter_marklund
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachPROIDEA
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for youSimon Willison
 
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to JavaPawanMM
 
Productive Rails development with RubyMine
Productive Rails development with RubyMineProductive Rails development with RubyMine
Productive Rails development with RubyMineolegshpynov
 
Surviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studySurviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studypeter_ibuildings
 

Similaire à Code Generation with giant CRUD (20)

Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQuery
 
Why Use Rails by Dr Nic
Why Use Rails by  Dr NicWhy Use Rails by  Dr Nic
Why Use Rails by Dr Nic
 
Node.js #digpen presentation
Node.js #digpen presentationNode.js #digpen presentation
Node.js #digpen presentation
 
Java overview the piramide of success
Java overview the piramide of successJava overview the piramide of success
Java overview the piramide of success
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesJazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
 
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
 
Java and the Web
Java and the WebJava and the Web
Java and the Web
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to Java
 
Productive Rails development with RubyMine
Productive Rails development with RubyMineProductive Rails development with RubyMine
Productive Rails development with RubyMine
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
 
Surviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studySurviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-study
 

Plus de Tom Klaasen

Tasker supports Field Service Technicians
Tasker supports Field Service TechniciansTasker supports Field Service Technicians
Tasker supports Field Service TechniciansTom Klaasen
 
How mobile apps create profit for your company
How mobile apps create profit for your companyHow mobile apps create profit for your company
How mobile apps create profit for your companyTom Klaasen
 
What I learned from twunch
What I learned from twunchWhat I learned from twunch
What I learned from twunchTom Klaasen
 
Agile tour agile development
Agile tour   agile developmentAgile tour   agile development
Agile tour agile developmentTom Klaasen
 
What I learnt from @twunch
What I learnt from @twunchWhat I learnt from @twunch
What I learnt from @twunchTom Klaasen
 
Prawn: Creating PDF in Ruby
Prawn: Creating PDF in RubyPrawn: Creating PDF in Ruby
Prawn: Creating PDF in RubyTom Klaasen
 

Plus de Tom Klaasen (7)

Tasker supports Field Service Technicians
Tasker supports Field Service TechniciansTasker supports Field Service Technicians
Tasker supports Field Service Technicians
 
How mobile apps create profit for your company
How mobile apps create profit for your companyHow mobile apps create profit for your company
How mobile apps create profit for your company
 
What I learned from twunch
What I learned from twunchWhat I learned from twunch
What I learned from twunch
 
Report
ReportReport
Report
 
Agile tour agile development
Agile tour   agile developmentAgile tour   agile development
Agile tour agile development
 
What I learnt from @twunch
What I learnt from @twunchWhat I learnt from @twunch
What I learnt from @twunch
 
Prawn: Creating PDF in Ruby
Prawn: Creating PDF in RubyPrawn: Creating PDF in Ruby
Prawn: Creating PDF in Ruby
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Code Generation with giant CRUD

  • 1.
  • 2. Code generation with giant CRUD Tom Klaasen 10to1
  • 3. Tom Klaasen Works professionally with Java since 1999  Co-founder of 10to1 (http://www.10to1.be)  Has worked on a project involving a lot of  code generation over the last 2 years tom@10to1.be  www.javapolis.com
  • 4. Overall Presentation Goal Reducing typing with code generation www.javapolis.com
  • 5. The question Who wants to type in 1000+ Java class files? www.javapolis.com
  • 6. The problem Mission: “Create generic CRUD screens for  a domain model” www.javapolis.com 6
  • 7. The problem “Our domain model will likely contain a few  hundred classes” www.javapolis.com 7
  • 8. The problem “Oh, and we’re not sure which parts will  stay generic and which won’t” www.javapolis.com 8
  • 9. The problem “And please, have it done in 3 months, with  4 developers” www.javapolis.com 9
  • 10. The problem “And use RUP. But don’t wait for the  analysts to finish their job, because we don’t have that kind of time” Change your code when the Use Cases are  finished www.javapolis.com 10
  • 11. The problem “(And don’t wait for the data modellers  either. We really don’t have any time.)” www.javapolis.com 11
  • 12. The problem Domain model with 500+ classes  Each class: 1 interface, 2 implementations  Relations between those objects are first-  class citizens Also 1 interface, 2 implementations  Some classes have a lot of performance-  gaining methods Fine-grained getters and setters for the relations  Each class has 10+ attributes  Each needing a getter and a setter  www.javapolis.com
  • 13. The problem For each domain class:  DAO  Manager  FormAction  form.jsp  searchform.jsp  list.jsp  editflow.xml  Another 1000 lines of Java, JSP and XML  code www.javapolis.com 13
  • 14. The problem Result: 2000+ lines of code per domain  object For 4000 domain objects  Who wants to type these in?  www.javapolis.com 14
  • 15. The problem Most of the constructs will change over  time 4000 x 2000 lines of code are subject to change  Who wants to make these corrections?  www.javapolis.com 15
  • 16. Other constraints 2 years ago: beginning of 2005  Java 1.4  www.javapolis.com 16
  • 17. The approach Generate everything  But: make it possible to hand-code  everything Attribute definitions: in the DB  www.javapolis.com 17
  • 18. Generation process: first generation .hbm.xml DB Tables .jsp FormAction Domain DB .java Flow.xml Manager DAO www.javapolis.com 18
  • 19. The tools AppFuse + AppGen  Ant  XDoclet  Hibernate  Home-written Access tool  www.javapolis.com 19
  • 20. The tools XDoclet: extended with custom annotations  @gui hidden=”false”  @relation mandatory=”true”  www.javapolis.com 20
  • 21. Disadvantages Ant: messed-up build scripts  XDoclet  2 ‘design decisions’ for each information to be  passed slow  www.javapolis.com 21
  • 22. Improvements Maven  Clean project structure  FreeMarker  More flexible than XDoclet  Read directly from the DB  Don’t always generate everything  More and more hand-coded ‘generic’ files  As knowledge about the domain grew  www.javapolis.com 22
  • 23. The end situation .hbm.xml DB Tables Domain DB .java .jsp www.javapolis.com 18 23
  • 24. The pros Always flexible  When no knowledge available: generate  everything Override with hand-coded parts where necessary  When patterns and securities arise: hand-code  them in a generic way www.javapolis.com 24
  • 25. Comparison with other solutions Hand-code everything (and every change)  Hire a lot of code monkeys  Design everything generically, correctly the  first time And good luck with that  Trails  Code is not generated  Thus impossible to override  Rails (with JRuby)  This started in 2005, remember?  www.javapolis.com 25
  • 26. Conclusion Code generation can make you flexible and responsive. Do try this at home. (Or at work) www.javapolis.com
  • 27. Q&A View JavaPolis talks @ www.parleys.com
  • 28. Thank you for your attention