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

The Best Library I Ever Designed

The Best Library I Ever Designed

Andrea Leopardi

May 04, 2017
Tweet

More Decks by Andrea Leopardi

Other Decks in Programming

Transcript

  1. LIbRarY
    DEsiGnED
    tHe bESt
    I evER

    View full-size slide

  2. @wHatYOuhIDe

    View full-size slide

  3. FORZA FOOTBALL

    View full-size slide

  4. abStRacT
    COmPleX cODe

    View full-size slide

  5. abStRacT
    PAtTerNs/IDeAs

    View full-size slide

  6. TwO TyPEs
    OF liBrARiEs

    View full-size slide

  7. "leT mE HanDlE
    ThiS fOR yoU"

    View full-size slide

  8. {:ok, conn} = Redix.start_link()
    Redix.command(conn,
    ["GET", "my_key"])
    #=> {:ok, "my_value"}

    View full-size slide

  9. "HEre'S hOW yoU
    HanDlE ThiS"

    View full-size slide

  10. Saul.validate(
    some_data,
    one_of([&is_ref/1, &is_pid/1])
    )

    View full-size slide

  11. leT mE
    HanDlE ThiS
    fOR yoU
    heRE's How
    YOu hANdLe
    tHIs

    View full-size slide

  12. buILt-iN
    80
    exTEnSibLE
    20

    View full-size slide

  13. Mix.Shell
    Mix.Shell.IO
    Mix.Shell.Process
    Mix.Shell.Quiet

    View full-size slide

  14. geT Out OF poINtS

    View full-size slide

  15. LAw oF
    ABsTrACtiONs
    LEakY

    View full-size slide

  16. fragment(
    "lower(?)",
    post.title
    )

    View full-size slide

  17. LAnGuAge
    FEatURes
    USe

    View full-size slide

  18. Xandra.stream_pages!(query)
    |> Task.async_stream(mapper)
    |> Enum.reduce(acc, fun)

    View full-size slide

  19. EXisTInG
    cONveNtIoNs
    KnOW

    View full-size slide

  20. {:ok, term}
    {:error, term}

    View full-size slide

  21. FOcuSEd
    coMpOSabLE
    <3

    View full-size slide

  22. coNsISteNt
    pRinCIpLe Of LeAsT
    asTOniShMEnT

    View full-size slide

  23. TrANsParENt
    ThIN enOuGh ThAT yoU
    Can SEe ThROugH

    View full-size slide

  24. {:ok, socket}
    = :gen_tcp.connect
    GrEaT ErRorS

    View full-size slide

  25. DOcuME
    nTatIoN

    View full-size slide

  26. WrITe dOCs FOr
    YoUr FutURe sELf

    View full-size slide

  27. @wHatYOuhIDe

    View full-size slide