SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar a 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
 

Similar a 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
 

Más 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
 

Más 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
 

Último

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

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