• Principle of Architecture

  • Two most important concepts in architecture are composition and layer of abstraction.
    • A complex problem is solved by breaking it down to smaller sub-problems.
    • A complex software is a composition of modularized solutions. Modules are composed together at different layers of abstraction levels.
  • Principle of Vibe Achitecture

    • Don’t: control behavior of a program.
    • Do: control universal properties and algebraic laws which a program conform to.
      • See the 2, 3 and 4 steps below.
  • Steps to Design a Module (via Chatting with LLMs)

    • Note: “Module” here refers to an abstract entity that’s relatively small and self-sufficient. It could be a function, a custom type or a module containing a bunch of collaborative types.
    • Figure out functional/behavioral requirements: do wishful thinking on how to use it. logseq.order-list-type:: number
      • Describe conceptual functionalities and be intentionally vague on shape of API. logseq.order-list-type:: number
    • Figure out universal properties in the lens of category theory. Look for relevant categorical objects providing guarantee on those properties. logseq.order-list-type:: number
    • Figure out algebraic structure and algebraic laws your module must conform to. Look for relevant algebraic data types (ADTs) obeying those laws. logseq.order-list-type:: number
    • Based on results of discussion of the 2nd and 3rd steps, derive canonical API for your module. Canonical roughly means the API is minimal and unique to meet all requirements. It might not be performant or convenient yet. logseq.order-list-type:: number
    • Implementation: add convenient APIs, implement methods, review non functional requirements like performance, latency, compatibility, etc. logseq.order-list-type:: number
    • Testing: property-based unittests logseq.order-list-type:: number
  • Not covered in this note

    • Evolution of APIs
    • Observability of APIs
    • Error handlings
    • tricky stateful APIs