Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Custom and Generated Code Side by Side with JHipster

3,249 views

Published on

After more than a year of using JHipster for real on several applications, I share the different technics we used to upgrade generated code

Published in: Technology
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Custom and Generated Code Side by Side with JHipster

  1. 1. https://jhipster.tech @java_hipster Custom and Generated Code Side by Side @agoncal
  2. 2. https://jhipster.tech @java_hipster
  3. 3. https://jhipster.tech @java_hipster Website Call for Paper Scheduling Mobile App Ticketing Scanning Digital Signage Tweet wallAccounting Sponsor Venue 3rd party
  4. 4. https://jhipster.tech @java_hipster
  5. 5. https://jhipster.tech @java_hipster Website Call for Paper Scheduling Mobile App Ticketing Scanning Digital Signage Tweet wallAccounting Sponsor Venue 3rd party Grew up organically No communication No SSO No multitenancy No container Fed up of polyglot
  6. 6. https://jhipster.tech @java_hipster
  7. 7. https://jhipster.tech @java_hipster Website Call for Paper Scheduling Mobile App Ticketing Scanning Digital Signage Tweet wallAccounting Sponsor Venue 3rd party Deployer
  8. 8. https://jhipster.tech @java_hipster Patterns We Used Prototype Bootstrap Side by side Quickly test Throw away
  9. 9. https://jhipster.tech @java_hipster Prototype
  10. 10. https://jhipster.tech @java_hipster Prototype JDL
  11. 11. https://jhipster.tech @java_hipster Patterns We Used Prototype Bootstrap Side by side Quickly test Throw away Bootstrap code Bootstrap model Change the generated code
  12. 12. https://jhipster.tech @java_hipster Bootstrap JDL
  13. 13. https://jhipster.tech @java_hipster Patterns We Used Prototype Bootstrap Side by side Quickly test Throw away Bootstrap code Bootstrap model Change the generated code JDL centric Regenerate code frequently Don’t change generated code Develop our own code
  14. 14. https://jhipster.tech @java_hipster Side by Side JDL
  15. 15. https://jhipster.tech @java_hipster Contact/Organisation JDL entity Organisation (spn_organisation) { name String required maxlength(NAME_MAX_LENGTH), description String maxlength(DESCRIPTION_MAX_LENGTH), businessIdentification String, corporateName String, } entity Contact (spn_contact) { firstName String required maxlength(NAME_MAX_LENGTH), lastName String required maxlength(NAME_MAX_LENGTH), email String required minlength(EMAIL_MIN_LENGTH) maxlength(EMAIL_MAX_LENGTH), } relationship OneToMany { Organisation{contacts(lastName)} to Contact{organisation(name) required} }
  16. 16. https://jhipster.tech @java_hipster Contact/Organisation Code organisation .json Domain Contact Organisation 1..* Organisation Repository RepositoryService Organisation Service REST Organisation Resource Angular Organisation Service Organisation /api Organisation Component Organisation Repository Extended Organisation Service Extended Organisation Resource Extended Organisation Service Extended /api/ext Organisation Component Extended organisation- extended.json
  17. 17. https://jhipster.tech @java_hipster Repository @Repository public interface OrganisationRepository extends JpaRepository<Organisation, Long>, JpaSpecificationExecutor<Organisation> { } @Repository public interface OrganisationRepositoryExtended extends OrganisationRepository { @Query("select spn_organisation from Organisation spn_organisation left join fetch spn_organisation.contacts where spn_organisation.id =:id") Optional<Organisation> findOneWithEagerRelationships(@Param("id") Long id); }
  18. 18. https://jhipster.tech @java_hipster Service @Service @Transactional public class OrganisationService { private final OrganisationRepository organisationRepository; public OrganisationService(OrganisationRepository organisationRepository) { this.organisationRepository = organisationRepository; } @Service @Transactional public class OrganisationServiceExtended extends OrganisationService { private final OrganisationRepositoryExtended organisationRepository; public OrganisationServiceExtended(OrganisationRepositoryExtended organisationRepository) { super(organisationRepository); this.organisationRepository = organisationRepository; }
  19. 19. https://jhipster.tech @java_hipster Resource @RestController @RequestMapping("/api") public class OrganisationResource { private final OrganisationService organisationService; @RestController @RequestMapping("/api/extended") public class OrganisationResourceExtended { private final OrganisationServiceExtended organisationService;
  20. 20. https://jhipster.tech @java_hipster Angular Service @Injectable({ providedIn: 'root' }) export class OrganisationService { private resourceUrl = SERVER_API_URL + 'api/organisations'; constructor(private http: HttpClient) {} create(organisation: IOrganisation): Observable<EntityResponseType> { } @Injectable({ providedIn: 'root' }) export class OrganisationExtendedService extends OrganisationService { private resourceUrlExtended = SERVER_API_URL + 'api/extended/organisations'; constructor(private httpExt: HttpClient) { super(httpExt); }
  21. 21. https://jhipster.tech @java_hipster Contact/Organisation Code organisation .json Domain Contact Organisation 1..* Organisation Repository RepositoryService Organisation Service REST Organisation Resource Angular Organisation Service Organisation /api Organisation Component Organisation Repository Extended Organisation Service Extended Organisation Resource Extended Organisation Service Extended /api/ext Organisation Component Extended organisation- extended.json DTO Mapper Exception
  22. 22. https://jhipster.tech @java_hipster First Sprints (development) ● Start with a monolith ● JWT ● Avoid liquibase changeset ● Liquibase context for dev data ● Use Query filters ● Our side-by-side code ○ Components ○ Repositories ○ Services ○ Endpoint
  23. 23. https://jhipster.tech @java_hipster Later Sprints (production) ● Moved to microservices ● Keycloak ● Use liquibase changeset ● Add Gatling / Protractor ● Production in the cloud
  24. 24. https://jhipster.tech @java_hipster Lessons Learnt ● Start will less tech/features, add them later ● Keep JDL up to date ● Never touch generated code ● Keep up with JHipster version ● Use DTO ● Use Query filters ● Run -Pprod builds from start ● Introduce new i18n when needed ● Use PrimeNG components
  25. 25. https://jhipster.tech @java_hipster Lessons Learnt ● PostgreSQL is a fantastic DB (JSon, full text) ● Same DB in dev and prod ● Stick to JHipster ● Docker is good for dev (we don’t use it in prod) ● Reduce the number of technologies ○ Microservices are difficult enough ○ Each new service has a cost in the Cloud
  26. 26. https://jhipster.tech @java_hipster What’s Missing? ● Better directory structure / naming convention ○ Using angularSuffix for now ● Richer model ○ One-to-many unidirectional, Embeddable, List<datatypes> ● More best practices ○ Exception handling in services, Async calls ● Flexible endpoints ○ /api, /internal, /public ● More PostgreSQL support ○ Full text search, JSON
  27. 27. https://jhipster.tech @java_hipster What’s Missing? ● Generate more code with a richer JDL ○ Constants (ending up in Constants.java) ○ Enums (with no entity), helper classes... ○ Repository ○ Service ○ Endpoint ○ Angular services
  28. 28. https://jhipster.tech @java_hipster Contributing back ● Full-text search with PostgreSQL ● Reference data ○ Country (iso2, iso3, name, dial, continent, flag, latitude, longitude, zoom) ○ Language (alpha3b, alpha2, name, flag32) ○ Currency (alphabeticCode, name, numericCode, minorUnit, symbol)
  29. 29. https://jhipster.tech @java_hipster Website Call for Paper Scheduling Mobile App Ticketing Scanning Digital Signage Tweet wallAccounting Sponsor Venue 3rd party Deployer Road Map
  30. 30. https://jhipster.tech @java_hipster Thanks https://github.com/agoncal/agoncal-talks/tree/master/2018-06-JHipsterConf @agoncal

×