SlideShare a Scribd company logo
1 of 20
Easy Driver

                     • Libreria Java con un
                       generatore di codice ad
                       essa associato, che crea
                       le classi necessarie per
                       accedere ad un database
                       relazionale.



sabato 12 febbraio 2011
High Level


                     • Livello più alto di JDBC
                     • Niente uso di stringhe e meno errori a
                       run-time.




sabato 12 febbraio 2011
Piccolo è Bello

                     • E’ uno strato piccolo
                     • E’ uno strumento
                       semplice da usare
                     • Non è in competizione
                       con Hibernate o TopLink



sabato 12 febbraio 2011
Chi ti slega da un altro,
                          lo fa per legarti a sé stesso.


                     • Ci sono dei database come
                       PostgreSQL, che sono liberi e
                       cercano di aderire il più possibile
                       agli standard.

                     • Gli ORM generici non sfruttano
                       pienamente la funzionalità di un
                       database.



sabato 12 febbraio 2011
Indipendenti, ma contenti?
                     • EJB QL ha le funzionalità che vi
                       servono ?

                     • Non sentite la mancanza di una
                       funzione che estragga il mese da
                       una data dentro ad una query?

                     • Vi pagano lo studio di nuove
                       sintassi?



sabato 12 febbraio 2011
Il capo ha fretta

             • In molti contesti la cosa più
               importante e produrre
               presto qualcosa.

             • Una bella architettura
               richiede tempo, che si può
               chiedere, mai pretendere.

             • Il capo non ha sempre
               ragione, però va capito.



sabato 12 febbraio 2011
Obbiettivi

             • Ritorno alla semplicità.
             • Facilità nel cambio di linguaggio di
               programmazione.

             Java sarà il linguaggio preferito dalla community
             anche in futuro o si orienterà verso le grandi
             corporate? Quanto costa migrare in Python o C++ ?



sabato 12 febbraio 2011
Idea 1: una classe
          rappresenta i metadati di
          una tabella.

          Idea 2: il lavoro duro e
          noioso lo fa un generatore.

sabato 12 febbraio 2011
Dove si va ?

          Compatibilità con
          SQLite e porting
          verso C++ e
          Objective C



sabato 12 febbraio 2011
Easy Driver cerca aiuto

                     Aiutare un generatore di codice può aiutare un
                     consulente oppure un’azienda concorrente ?



                     Può darsi, però anche i concorrenti possono aiutarsi a
                     volte, per slegarsi da fornitori scomodi...




sabato 12 febbraio 2011
Easy Driver è credibile ?

               Sicuramente non è completo, ma c’è una base
               funzionante, collaborare può voler dire anche solo
               segnalare i difetti e proporre nuovi sviluppi.
               La credibilità di un progetto è data dalla gente che
               partecipa, più aiutate, più sarà credibile.




sabato 12 febbraio 2011
A me basta il mio
                                strumento!
                     • Non esistono i coltellini svizzeri, c’è posto
                          per un altro strumento nelle nicchie
                          lasciate aperte dai framework principali.
                     • Nelle schede industriali, nell’hardware
                          embedded o mobile, uno strumento
                          leggero, aiuta...



sabato 12 febbraio 2011
Ai clienti piacerà ?

                     • Che vantaggio avrebbero i clienti attuali ?
                     • E’ un buon modo per fare demo in modo
                          agile, comunque fare presto aiuta a
                          trovarne dei nuovi.




sabato 12 febbraio 2011
General Public License

                     • Sarebbe meglio LGPL?
                     • La diffusione del kernel di Linux non è stata
                          ostacolata dalla licenza. Si invita chi fa un
                          lavoro derivato ad applicare la stessa
                          licenza, altrimenti mi si contatti almeno,
                          l’obbiettivo è fare conoscenza...



sabato 12 febbraio 2011
Il generatore




sabato 12 febbraio 2011
La struttura
                          package org.byteliberi;

                          import org.byteliberi.easydriver.*;
                          import org.byteliberi.easydriver.fields.*;

                          public enum TabellaB {
                          !   INSTANCE;

                          !   private DBTable table;
                          !   private IntField id;
                          !   private VarcharField vc;

                          !   private TabellaB() {
                          !   !   this.table = new DBTable("tabella_b");
                          !   !   this.id = new IntField("id", false, table);
                          !   !   this.vc = new VarcharField("vc", true, table);
                          !   !   this.table.setPrimaryKey(new PrimaryKey(this.id));
                          !   }

                          !   public final DBTable getTable() {
                          !   !   return table;
                          !   }

                          !   public final IntField getId() {
                          !   !   return id;
                          !   }

                          !   public final VarcharField getVc() {
                          !   !   return vc;
                          !   }

                          }



sabato 12 febbraio 2011
Object Model
                          package org.byteliberi;

                          public class TabellaBObjectModel {

                          !   private Integer id;
                          !   private String vc;

                          !   public TabellaBObjectModel() {
                          !   }

                          !   public TabellaBObjectModel(final Integer id) {
                          !   !   this.id = id;
                          !   }

                          !   public final Integer getId() {
                          !   !   return id;
                          !   }

                          !   public final String getVc() {
                          !   !   return vc;
                          !   }

                          !   public final void setId(final Integer id) {
                          !   !   this.id = id;
                          !   }

                          !   public final void setVc(final String vc) {
                          !   !   this.vc = vc;
                          !   }
                          }




sabato 12 febbraio 2011
Factory
                          package org.byteliberi;

                          import java.sql.ResultSet;
                          import java.sql.SQLException;
                          import org.byteliberi.easydriver.ObjectFactory;

                          public class TabellaBObjectModelFactory implements ObjectFactory<TabellaBObjectModel> {

                          !   public TabellaBObjectModelFactory() {
                          !   }

                          !   @Override
                          !   public final TabellaBObjectModel map(final ResultSet rs) throws SQLException {
                          !   !   final TabellaB table = TabellaB.INSTANCE;
                          !   !   final TabellaBObjectModel vo = new TabellaBObjectModel();
                          !   !   vo.setId( table.getId().map(rs, 1) );
                          !   !   vo.setVc( table.getVc().map(rs, 2) );
                          !   !   return vo;
                          !   }
                          }




sabato 12 febbraio 2011
Struttura a Servizi
 public final TabellaBObjectModel selectByPK(final Connection con, final Integer id) throws SQLException {
 !   !    final TabellaB tableStruct = TabellaB.INSTANCE;
 !   !    final SelectQuery<TabellaBObjectModel> query =
                                    new SelectQuery<TabellaBObjectModel>(TabellaB.INSTANCE.getTable(),
                                    new TabellaBObjectModelFactory());
 !   !    query.setWhere(new Equals(tableStruct.getId()));
 !   !    query.prepareQuery(con);
 !   !    query.addParameter(id);
 !   !    return query.getSingleResultAndClose();
 !   }

 !     public final int deleteByPK(final Connection con, final Integer id) throws SQLException {
 !     !   final TabellaB tableStruct = TabellaB.INSTANCE;
 !     !   final DeleteQuery query = tableStruct.getTable().createDeleteQuery();
 !     !   query.setWhere(new Equals(tableStruct.getId()));
 !     !   query.prepareQuery(con);
 !     !   query.addParameter(id);
 !     !   return query.execute();
 !     }

 !     public final int insert(final Connection con, final TabellaBObjectModel model) throws SQLException {
 !     !   final TabellaB tableStruct = TabellaB.INSTANCE;
 !     !   final InsertQuery query = tableStruct.getTable().createInsertQuery();
 !     !   query.prepareQuery(con);
 !     !   query.addParameter(model.getId());
 !     !   query.addParameter(model.getVc());
 !     !   return query.execute();
 !     }

 !     public final int updateByPK(final Connection con, final Integer id, final TabellaBObjectModel model)
                                     throws SQLException {
 !     !   final TabellaB tableStruct = TabellaB.INSTANCE;
 !     !   final UpdateQuery query = tableStruct.getTable().createUpdateQuery();
 !     !   query.setWhere(new Equals(tableStruct.getId()));
 !     !   query.prepareQuery(con);
 !     !   query.addParameter(model.getId());
 !     !   query.addParameter(model.getVc());
 !     !   query.addParameter(id);
 !     !   return query.execute();
 !     }
sabato 12 febbraio 2011
http://www.byteliberi.org/




sabato 12 febbraio 2011

More Related Content

Similar to Easy Driver

Scala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perchéScala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perchéEdmondo Porcu
 
Open Jei Di Key not only for DJ's
Open Jei Di Key not only for DJ'sOpen Jei Di Key not only for DJ's
Open Jei Di Key not only for DJ'sCodemotion
 
Delphi & Dintorni Webinar - Diventa un mago del Testing
Delphi & Dintorni Webinar - Diventa un mago del TestingDelphi & Dintorni Webinar - Diventa un mago del Testing
Delphi & Dintorni Webinar - Diventa un mago del TestingMarco Breveglieri
 
Inversion of control e Dependency Injection (ITA)
Inversion of control e Dependency Injection (ITA)Inversion of control e Dependency Injection (ITA)
Inversion of control e Dependency Injection (ITA)Giancarlo Valente
 
Dependency injection: the good parts
Dependency injection:  the good partsDependency injection:  the good parts
Dependency injection: the good partsMassimo Groppelli
 
Agileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastrutturaAgileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastrutturaXPeppers
 
Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)
Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)
Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)Carlo Fedeli
 
ios 8 - parte 1 - intro - ita
ios 8 - parte 1 - intro - itaios 8 - parte 1 - intro - ita
ios 8 - parte 1 - intro - itaDario Rusignuolo
 
Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...
Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...
Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...Codemotion
 
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con DelphiDelphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con DelphiMarco Breveglieri
 
Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013Alessandro del Gobbo
 
Database project alla riscossa
Database project alla riscossaDatabase project alla riscossa
Database project alla riscossaGian Maria Ricci
 
GAE python GDG Milano - L02
GAE python GDG Milano - L02GAE python GDG Milano - L02
GAE python GDG Milano - L02Paolo Dadda
 
Creare un Information Radiator con Delphi
Creare un Information Radiator con DelphiCreare un Information Radiator con Delphi
Creare un Information Radiator con DelphiMarco Breveglieri
 

Similar to Easy Driver (20)

Scala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perchéScala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perché
 
Open Jei Di Key not only for DJ's
Open Jei Di Key not only for DJ'sOpen Jei Di Key not only for DJ's
Open Jei Di Key not only for DJ's
 
Delphi & Dintorni Webinar - Diventa un mago del Testing
Delphi & Dintorni Webinar - Diventa un mago del TestingDelphi & Dintorni Webinar - Diventa un mago del Testing
Delphi & Dintorni Webinar - Diventa un mago del Testing
 
Inversion of control e Dependency Injection (ITA)
Inversion of control e Dependency Injection (ITA)Inversion of control e Dependency Injection (ITA)
Inversion of control e Dependency Injection (ITA)
 
Dependency injection: the good parts
Dependency injection:  the good partsDependency injection:  the good parts
Dependency injection: the good parts
 
L'avventura dell'interprete UI - Un'indagine Java di Lotus Holmes
L'avventura dell'interprete UI - Un'indagine Java di Lotus HolmesL'avventura dell'interprete UI - Un'indagine Java di Lotus Holmes
L'avventura dell'interprete UI - Un'indagine Java di Lotus Holmes
 
TDD DataBase
TDD DataBaseTDD DataBase
TDD DataBase
 
Agileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastrutturaAgileday2013 pratiche agili applicate all'infrastruttura
Agileday2013 pratiche agili applicate all'infrastruttura
 
Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)
Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)
Il "rilascio" con Octopus Deploy (visto dagli occhi di un dev)
 
ios 8 - parte 1 - intro - ita
ios 8 - parte 1 - intro - itaios 8 - parte 1 - intro - ita
ios 8 - parte 1 - intro - ita
 
Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...
Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...
Continuous Delivery Database - Diego Mauricio Lagos Morales - Codemotion Rome...
 
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con DelphiDelphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
Delphi & Dintorni Webinar - Padroneggiare i principi SOLID con Delphi
 
Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013Introduzione a Drupal 7 - 14/03/2013
Introduzione a Drupal 7 - 14/03/2013
 
Database project alla riscossa
Database project alla riscossaDatabase project alla riscossa
Database project alla riscossa
 
GAE python GDG Milano - L02
GAE python GDG Milano - L02GAE python GDG Milano - L02
GAE python GDG Milano - L02
 
Java basics
Java basicsJava basics
Java basics
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
VS Package @ CD2008
VS Package @ CD2008VS Package @ CD2008
VS Package @ CD2008
 
Corso Java - Introduzione
Corso Java - IntroduzioneCorso Java - Introduzione
Corso Java - Introduzione
 
Creare un Information Radiator con Delphi
Creare un Information Radiator con DelphiCreare un Information Radiator con Delphi
Creare un Information Radiator con Delphi
 

More from Codemotion

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Codemotion
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyCodemotion
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaCodemotion
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserCodemotion
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Codemotion
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Codemotion
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Codemotion
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 - Codemotion
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Codemotion
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Codemotion
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Codemotion
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Codemotion
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Codemotion
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Codemotion
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Codemotion
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...Codemotion
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Codemotion
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Codemotion
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Codemotion
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Codemotion
 

More from Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Easy Driver

  • 1. Easy Driver • Libreria Java con un generatore di codice ad essa associato, che crea le classi necessarie per accedere ad un database relazionale. sabato 12 febbraio 2011
  • 2. High Level • Livello più alto di JDBC • Niente uso di stringhe e meno errori a run-time. sabato 12 febbraio 2011
  • 3. Piccolo è Bello • E’ uno strato piccolo • E’ uno strumento semplice da usare • Non è in competizione con Hibernate o TopLink sabato 12 febbraio 2011
  • 4. Chi ti slega da un altro, lo fa per legarti a sé stesso. • Ci sono dei database come PostgreSQL, che sono liberi e cercano di aderire il più possibile agli standard. • Gli ORM generici non sfruttano pienamente la funzionalità di un database. sabato 12 febbraio 2011
  • 5. Indipendenti, ma contenti? • EJB QL ha le funzionalità che vi servono ? • Non sentite la mancanza di una funzione che estragga il mese da una data dentro ad una query? • Vi pagano lo studio di nuove sintassi? sabato 12 febbraio 2011
  • 6. Il capo ha fretta • In molti contesti la cosa più importante e produrre presto qualcosa. • Una bella architettura richiede tempo, che si può chiedere, mai pretendere. • Il capo non ha sempre ragione, però va capito. sabato 12 febbraio 2011
  • 7. Obbiettivi • Ritorno alla semplicità. • Facilità nel cambio di linguaggio di programmazione. Java sarà il linguaggio preferito dalla community anche in futuro o si orienterà verso le grandi corporate? Quanto costa migrare in Python o C++ ? sabato 12 febbraio 2011
  • 8. Idea 1: una classe rappresenta i metadati di una tabella. Idea 2: il lavoro duro e noioso lo fa un generatore. sabato 12 febbraio 2011
  • 9. Dove si va ? Compatibilità con SQLite e porting verso C++ e Objective C sabato 12 febbraio 2011
  • 10. Easy Driver cerca aiuto Aiutare un generatore di codice può aiutare un consulente oppure un’azienda concorrente ? Può darsi, però anche i concorrenti possono aiutarsi a volte, per slegarsi da fornitori scomodi... sabato 12 febbraio 2011
  • 11. Easy Driver è credibile ? Sicuramente non è completo, ma c’è una base funzionante, collaborare può voler dire anche solo segnalare i difetti e proporre nuovi sviluppi. La credibilità di un progetto è data dalla gente che partecipa, più aiutate, più sarà credibile. sabato 12 febbraio 2011
  • 12. A me basta il mio strumento! • Non esistono i coltellini svizzeri, c’è posto per un altro strumento nelle nicchie lasciate aperte dai framework principali. • Nelle schede industriali, nell’hardware embedded o mobile, uno strumento leggero, aiuta... sabato 12 febbraio 2011
  • 13. Ai clienti piacerà ? • Che vantaggio avrebbero i clienti attuali ? • E’ un buon modo per fare demo in modo agile, comunque fare presto aiuta a trovarne dei nuovi. sabato 12 febbraio 2011
  • 14. General Public License • Sarebbe meglio LGPL? • La diffusione del kernel di Linux non è stata ostacolata dalla licenza. Si invita chi fa un lavoro derivato ad applicare la stessa licenza, altrimenti mi si contatti almeno, l’obbiettivo è fare conoscenza... sabato 12 febbraio 2011
  • 15. Il generatore sabato 12 febbraio 2011
  • 16. La struttura package org.byteliberi; import org.byteliberi.easydriver.*; import org.byteliberi.easydriver.fields.*; public enum TabellaB { ! INSTANCE; ! private DBTable table; ! private IntField id; ! private VarcharField vc; ! private TabellaB() { ! ! this.table = new DBTable("tabella_b"); ! ! this.id = new IntField("id", false, table); ! ! this.vc = new VarcharField("vc", true, table); ! ! this.table.setPrimaryKey(new PrimaryKey(this.id)); ! } ! public final DBTable getTable() { ! ! return table; ! } ! public final IntField getId() { ! ! return id; ! } ! public final VarcharField getVc() { ! ! return vc; ! } } sabato 12 febbraio 2011
  • 17. Object Model package org.byteliberi; public class TabellaBObjectModel { ! private Integer id; ! private String vc; ! public TabellaBObjectModel() { ! } ! public TabellaBObjectModel(final Integer id) { ! ! this.id = id; ! } ! public final Integer getId() { ! ! return id; ! } ! public final String getVc() { ! ! return vc; ! } ! public final void setId(final Integer id) { ! ! this.id = id; ! } ! public final void setVc(final String vc) { ! ! this.vc = vc; ! } } sabato 12 febbraio 2011
  • 18. Factory package org.byteliberi; import java.sql.ResultSet; import java.sql.SQLException; import org.byteliberi.easydriver.ObjectFactory; public class TabellaBObjectModelFactory implements ObjectFactory<TabellaBObjectModel> { ! public TabellaBObjectModelFactory() { ! } ! @Override ! public final TabellaBObjectModel map(final ResultSet rs) throws SQLException { ! ! final TabellaB table = TabellaB.INSTANCE; ! ! final TabellaBObjectModel vo = new TabellaBObjectModel(); ! ! vo.setId( table.getId().map(rs, 1) ); ! ! vo.setVc( table.getVc().map(rs, 2) ); ! ! return vo; ! } } sabato 12 febbraio 2011
  • 19. Struttura a Servizi public final TabellaBObjectModel selectByPK(final Connection con, final Integer id) throws SQLException { ! ! final TabellaB tableStruct = TabellaB.INSTANCE; ! ! final SelectQuery<TabellaBObjectModel> query = new SelectQuery<TabellaBObjectModel>(TabellaB.INSTANCE.getTable(), new TabellaBObjectModelFactory()); ! ! query.setWhere(new Equals(tableStruct.getId())); ! ! query.prepareQuery(con); ! ! query.addParameter(id); ! ! return query.getSingleResultAndClose(); ! } ! public final int deleteByPK(final Connection con, final Integer id) throws SQLException { ! ! final TabellaB tableStruct = TabellaB.INSTANCE; ! ! final DeleteQuery query = tableStruct.getTable().createDeleteQuery(); ! ! query.setWhere(new Equals(tableStruct.getId())); ! ! query.prepareQuery(con); ! ! query.addParameter(id); ! ! return query.execute(); ! } ! public final int insert(final Connection con, final TabellaBObjectModel model) throws SQLException { ! ! final TabellaB tableStruct = TabellaB.INSTANCE; ! ! final InsertQuery query = tableStruct.getTable().createInsertQuery(); ! ! query.prepareQuery(con); ! ! query.addParameter(model.getId()); ! ! query.addParameter(model.getVc()); ! ! return query.execute(); ! } ! public final int updateByPK(final Connection con, final Integer id, final TabellaBObjectModel model) throws SQLException { ! ! final TabellaB tableStruct = TabellaB.INSTANCE; ! ! final UpdateQuery query = tableStruct.getTable().createUpdateQuery(); ! ! query.setWhere(new Equals(tableStruct.getId())); ! ! query.prepareQuery(con); ! ! query.addParameter(model.getId()); ! ! query.addParameter(model.getVc()); ! ! query.addParameter(id); ! ! return query.execute(); ! } sabato 12 febbraio 2011