Upgrade to Pro — share decks privately, control downloads, hide ads and more …

API4Future - A journey how to create a stable API

C59c6666e76977dde33948515fdb3a90?s=47 ElmarDott
November 20, 2021

API4Future - A journey how to create a stable API

API Changes always are very risky activities and need a good planning to not crash a project. Because this could cost a lot of adjustments and work for API consumers. In this talk I will share my experience how to prevent common problems designing APIs.

By experience, enterprise applications have a long lifetime period. This is one oft the reasons why we need to pay a lot of attention for maintenance. But how we are able to avoid chaos in the project? With some Code Examples in Java I will demonstrate how a stable API get developed. Some questions I will answer in this talk:
• Quality and Maintenance
• Architecture & Design Pattern for APIs
• API Documentation & Versioning

--------------------------------------------------------------------------------------------------
Homepage : https://elmar-dott.com
AnchorFM : https://anchor.fm/elmar-dott
Twitter - https://twitter.com/ElmarDott
GitHub - https://github.com/ElmarDott
Lbry - https://lbry.tv/@elmar.dott:8
BitChute - https://www.bitchute.com/channel/3IyCzKdX8IpO/
--------------------------------------------------------------------------------------------------

C59c6666e76977dde33948515fdb3a90?s=128

ElmarDott

November 20, 2021
Tweet

Transcript

  1. Ba rCamp 2021 Dom i n i c an R

    e p u b l i c on l i n e © 2021 ElmarDott API4Future - A journey how to create a stable API
  2. © 2021 Ba rCamp RD Sp e a k e

    r El ma r Do t t (M. Schulz) studied at HS Merseburg, Germany, computer science and holds an engineers degree in software engineering. He tweets regularly about several technical topics. The main topics in his field of work are Build and Configuration Management, Software Architecture and Release Management. About more than 15 years he is working in different large Web Application projects all over the world. He is an independent consultant / trainer. To share his knowledge he gives talks on conferences, if he is not writing on a new article about software engineering. https://elmar-dott.com + Consultant + Writer + Speaker + Trainer +
  3. © 2021 Ba rCamp RD Ag e nd a Samples

    for APIs Design Pattern Changes and Maintenance Documentation with API Guardian RESTful API & Swagger The API checklist
  4. © 2021 Ba rCamp RD Known API s XML Extensible

    Markup Language //multiple APIs JDBC Java Database Connectivity //rudimentary API PDF Portable Document Format //manufacturer-specific APIs MySQL MariaDB PostgreSQL Oracle SAX – Simple API for XML DOM – Document Object Model Stax – Streaming API for XML iText vs. OpenPDF
  5. © 2021 Ba rCamp RD De s i g n

    Pa t t e rn Adaptor: also known as Wrapper, coupels an interface to another when they not compatible to each other. Facade: group multiple interfaces together, to a simplified one. Proxy: also an generalization of a complex interface. Can understood as complement to the facade that combines several interfaces into a single one.
  6. © 2021 Ba rCamp RD Ar c h i t

    e c t u r e Service LAYER Presentation LAYER Business LAYER Application LAYER Domain LAYER Orchestration LAYER API Interfaces RESTful Services Domain Objects Managed Beans Access Java Server Faces Controller Model View DAO Implementation
  7. © 2021 Ba rCamp RD Ma i n t e

    n an c e // Java Standard API List<String> collection = new ArrayList<>(); // User defined Project based API IList<String> collection = new ListImpl<>(); Architecture & Structure • my.pkg.business: Interfaces • my.pkg.application: Implemetation • my.pkg.application.hepler: Helper
  8. © 2021 Ba rCamp RD Doc um e n t

    a t i on w i t h API Gu a rd i an https://github.com/apiguardian-team/apiguardian <dependency> <groupId>org.apiguardian</groupId> <artifactId>apiguardian-api</artifactId> <version>1.1.2</version> </dependency> repositories { mavenCentral() } dependencies { compileOnlyApi("org.apiguardian:apiguardian-api:1.1.2") } @API(status = STABLE, since = "1.0", consumers = "GenrericHbmDAO") public interface GenericDAO<T, PK extends Serializable> extends Serializable { … }
  9. © 2021 Ba rCamp RD REST fooul 01: RolesDO role

    = rolesDAO.find(roleName); 02: String json = rolesDAO.serializeAsJson(role); 03: if (role != null) { 04: response = Response.status(Response.Status.OK) 05: .type(MediaType.APPLICATION_JSON) 06: .entity(json) 07: .encoding("UTF-8") 08: .build(); 09: } else { 10: response = Response 11: .status(Response.Status.NOT_FOUND) 12: .build(); 13: }
  10. © 2021 Ba rCamp RD Sw a gg e r

  11. © 2021 Ba rCamp RD Ch e c k l

    i s t • implement against interfaces • KISS: Keep It Simple, Stupid. • work with standardized structures they can reused • name interfaces more general • name implementation in the way they are specialized • have a well and full documentation of your interfaces • bundle API changes in a specialized major release • take care of compatibility
  12. © 2021 Ba rCamp RD Cr e d e n

    t i a l s --------------------------------------------------------- Homepage : https://elmar-dott.com GitHub : https://github.com/ElmarDott AnchorFM : https://anchor.fm/elmar-dott Twitter : https://twitter.com/ElmarDott Speaker Deck : https://speakerdeck.com/elmardott Lbry : https://lbry.tv/@elmar.dott:8 BitChute : https://www.bitchute.com/channel/3IyCzKdX8IpO/ --------------------------------------------------------- Danke / thank you / Gracias
  13. None