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

Building SDKs - The Kotlin Way

Building SDKs - The Kotlin Way

by Jossi Wolf
presented on August 30, 2019 @Kotlin/Everywhere Hamburg

Kotlin User Group Hamburg

August 30, 2019
Tweet

More Decks by Kotlin User Group Hamburg

Other Decks in Programming

Transcript

  1. 4. EXPERIMENTAL APIs. They are subject to change and not

    final!!! 3. Blah blah bla 2. Bla blah bla 1. Blah blah blah RELEASE NOTES
  2. 4. APIs have been removed. 3. Blah blah bla 2.

    Bla blah bla 1. Blah blah blah RELEASE NOTES
  3. Slack Message PROJECT MANAGER $CUSTOMER JUST CALLED THEY HAVE A

    BUILD ERROR WITH THE NEW SDK VERSION CAN YOU FIX THAT NOW PLS Friday, 9PM
  4. class CatPicturesAPI { /** * Experimental in case cats overtake

    the planet and * demand pets and treats in exchange for cat pictures */ @ExperimentalCatPicturesAPI fun getCatPicture(): CatPicture = CatPicture() }
  5. fun doCatPictureAPIStuff() { val catPicturesAPI = CatPicturesAPI() catPicturesAPI.getCatPicture() } This

    API is experimental and its usage must be marked with @UseExperimental.
  6. 4. APIs have been deprecated. 3. Blah blah bla 2.

    Bla blah bla 1. Blah blah blah RELEASE NOTES
  7. /** * Marks the annotated declaration as deprecated. */ TYPEALIAS)

    annotation class Deprecated( val message: String, val replaceWith: ReplaceWith = ReplaceWith(""), val level: DeprecationLevel = DeprecationLevel.WARNING )
  8. @Deprecated(“This is a legacy API. Please use the new CatPicturesAPI

    instead.") class LegacyCatPictureAPI { fun getCatPicture(): CatPicture = CatPicture() }
  9. /** * Marks the annotated declaration as deprecated. */ TYPEALIAS)

    annotation class Deprecated( val message: String, val replaceWith: ReplaceWith = ReplaceWith(""), val level: DeprecationLevel = DeprecationLevel.WARNING )
  10. @Deprecated( "This is a legacy API. Please use the new

    CatPicturesAPI instead.", ReplaceWith("CatPicturesAPI") ) class LegacyCatPictureAPI { fun getCatPicture(): CatPicture = CatPicture() }
  11. @Deprecated( "This is a legacy API. Please use the new

    CatPicturesAPI instead.", ReplaceWith("CatPicturesAPI") ) class LegacyCatPictureAPI { fun getCatPicture(): CatPicture = CatPicture() }
  12. class Laboratory { @Deprecated( "Typo in here. Please use getRandomChemical

    instead.", ReplaceWith("getRandomChemical") ) fun getRandommChemical(): Chemical = randomExperiment + randomExperiment + explosive }
  13. class Laboratory { @Deprecated( "Typo in here. Please use getRandomChemical

    instead.", ReplaceWith("getRandomChemical") ) fun getRandommChemical(): Chemical = randomExperiment + randomExperiment + explosive fun getRandomChemical(): Chemical = randomExperiment + randomExperiment + explosive }
  14. class Laboratory { @Deprecated( "Typo in here. Please use getRandomChemical

    instead.", ReplaceWith("getRandomChemical") ) fun getRandommChemical(): Chemical = getRandomChemical() fun getRandomChemical(): Chemical = randomExperiment + randomExperiment + explosive }
  15. class CatPicturesAPI { /** * Experimental in case cats overtake

    the planet and * demand pets and treats in exchange for cat pictures */ @ExperimentalCatPicturesAPI fun getCatPicture(): CatPicture = CatPicture() }
  16. class CatPictureAPI { /** * Experimental in case cats overtake

    the planet and * demand pets and treats in exchange for cat pictures */ @ExperimentalCatPicturesAPI fun getCatPicture(): CatPicture = CatPicture() }
  17. @Deprecated( message = "CatPicturesAPI has been renamed to CatPictureAPI“, replaceWith

    = ReplaceWith("CatPictureAPI") ) typealias CatPicturesAPI = CatPictureAPI
  18. SDK

  19. interface CanvasCapabilities interface SDKCapabilities: CanvasCapabilities class ArtboardSDK: SDKCapabilities { val

    canvasManager = CanvasManager() override fun draw() = canvasManager.draw() }
  20. interface CanvasCapabilities interface SDKCapabilities: CanvasCapabilities class ArtboardSDK: SDKCapabilities { val

    canvasManager = CanvasManager() override fun draw() = canvasManager.draw() }
  21. interface CanvasCapabilities interface SDKCapabilities: CanvasCapabilities class ArtboardSDK: SDKCapabilities { val

    canvasManager = CanvasManager() override fun draw() = canvasManager.draw() }