Software Protocol

From GM-RKB
Jump to navigation Jump to search

A Software Protocol is a protocol that specifies rules governing how software operations or software components proceed and interact, including the states they pass through and the transitions allowed between those states.

  • Context:
    • It can (typically) specify which calls, messages or events a participant may send or accept at each step, and in what order.
    • It can (typically) be expressed as a finite-state machine, a message-sequence description, or a written step-by-step procedure.
    • It can (typically) be enforced by code, checked by tests or monitors, or followed by a person using a runbook.
    • It can (typically) state what each participant may assume once a step has completed, so the next step can rely on it.
    • …
    • It can (often) govern a whole lifecycle, as a session protocol does for a software session.
    • It can (often) define what a participant does after a failed or interrupted step: retry, recover from saved state, or stop.
    • It can (often) use a time-out to decide when an unanswered request is treated as failed; a time-out is a policy, not proof that the other participant has failed.
    • It can (often) require idempotent operations or duplicate detection, so that a retried step whose first attempt may have succeeded does not take effect twice.
    • It can (often) include a version or capability exchange, so that participants built at different times can agree on what both support.
    • It can (often) be published as a technical protocol standard when its participants are separate systems of a distributed system.
    • …
    • It can be written in a specification language, such as TLA+, so that its allowed sequences can be checked mechanically before it is implemented.
    • It can have its message or call formats described in an interface definition language, separately from the rules about their order.
    • It can be described with session types, which let a type checker confirm that each participant sends and receives messages in the agreed order.
    • …
    • It can range from being an In-Process Software Protocol to being an Inter-System Software Protocol, depending on its software protocol participant distribution.
    • …
  • Example(s):
    • Session Protocols, such as:
      • an AI agent's initialization protocol, which brings its work session into a verified starting state.
      • SSH session-channel rules (RFC 4254) for opening a session, starting a shell or command in it, and closing the channel.
    • Software protocols between separate systems, such as:
      • ONC remote procedure call message rules (RFC 5531), by which one program asks another system to run a procedure and return the result.
    • Software protocols within one program, such as:
      • Python's iterator protocol, under which a loop calls an object's next-item method until it signals the end, and an iterator that has signalled the end must keep doing so on later calls.
    • …
  • Counter-Example(s):
    • A clinical study protocol, which prescribes a procedure for the people running a study rather than for software.
    • A diplomatic protocol, which governs conduct between states and involves no software.
    • A physical-layer signalling specification, which governs electrical or optical signals on a medium rather than software behavior.
    • A software interface considered on its own, which lists the operations a component offers but not the order or conditions in which they may be used.
    • A Swift protocol declaration, which, despite the name, lists the methods and properties a conforming type must provide; unless it also states an order of use, it is an interface rather than a software protocol in this page's sense.
    • …
  • See: Technical Protocol, Communication Protocol, Software Interface, Session Protocol, Finite-State Machine.

References

2009

2006

Undated

  • Python Software Foundation. Python Standard Library: Built-in Types, Iterator Types. Supports the iterator example: "Once an iterator’s __next__() method raises StopIteration, it must continue to do so on subsequent calls."
  • Apple / Swift project. The Swift Programming Language: Protocols. Supports what the Swift counter-example says a protocol declaration lists: "A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality."