A larger program often splits client code from server code. This page renders the files as separate source and replay blocks so each file can keep its own panel.

module boundary One module can prepare a request while another module handles the command. Replay keeps each source file separate.

Client Module

command
task_client.py
Replay: real traced execution (multi-file project)
command = "status"
request = {"command": command, "user": "reader"}

print("send=" + request["command"])
print("user=" + request["user"])
command = "ping"
request = {"command": command, "user": "reader"}

print("send=" + request["command"])
print("user=" + request["user"])
command = "count"
request = {"command": command, "user": "reader"}

print("send=" + request["command"])
print("user=" + request["user"])
  1. command ← status, request ← {'command': 'status', 'user': 'reader'}

    1command→ status = "status"  #@command="ping", "count"2request→ {'command': 'status', 'user': 'reader'} = {"command": commandstatus, "user": "reader"}34print("send=" + request["command"]status)5print("user=" + request["user"]reader)
    outputsend=status
    user=reader
  1. command ← ping, request ← {'command': 'ping', 'user': 'reader'}

    1command→ ping = "ping"2request→ {'command': 'ping', 'user': 'reader'} = {"command": commandping, "user": "reader"}34print("send=" + request["command"]ping)5print("user=" + request["user"]reader)
    outputsend=ping
    user=reader
  1. command ← count, request ← {'command': 'count', 'user': 'reader'}

    1command→ count = "count"2request→ {'command': 'count', 'user': 'reader'} = {"command": commandcount, "user": "reader"}34print("send=" + request["command"]count)5print("user=" + request["user"]reader)
    outputsend=count
    user=reader

Server Module

command
task_server.py
Replay: real traced execution (multi-file project)
command = "status"


def handle(command):
    if command == "ping":
        return "pong"
    if command == "count":
        return "items=2"
    return "ready"


response = handle(command)
print("response=" + response)
command = "ping"


def handle(command):
    if command == "ping":
        return "pong"
    if command == "count":
        return "items=2"
    return "ready"


response = handle(command)
print("response=" + response)
command = "count"


def handle(command):
    if command == "ping":
        return "pong"
    if command == "count":
        return "items=2"
    return "ready"


response = handle(command)
print("response=" + response)
  1. command ← status

    1command→ status = "status"  #@command="ping", "count"234def handle(command):5    if command == "ping":6        return "pong"7    if command == "count":8        return "items=2"9    return "ready"101112response = handle(commandstatus)13print("response=" + response)
  2. def handle(command):

    4def handle(commandstatus):5    if command == "ping":6        return "pong"7    if command == "count":8        return "items=2"9    return "ready"
  3. response ← ready

    12response→ ready = handle(commandstatus)13print("response=" + responseready)
    outputresponse=ready
  1. command ← ping

    1command→ ping = "ping"234def handle(command):5    if command == "ping":6        return "pong"7    if command == "count":8        return "items=2"9    return "ready"101112response = handle(commandping)13print("response=" + response)
  2. def handle(command):

    4def handle(commandping):5    if command == "ping":6        return "pong"
  3. if command == "ping":

    4def handle(command):5    if commandping == "ping":6        return "pong"7    if command == "count":
  4. response ← pong

    12response→ pong = handle(commandping)13print("response=" + responsepong)
    outputresponse=pong
  1. command ← count

    1command→ count = "count"234def handle(command):5    if command == "ping":6        return "pong"7    if command == "count":8        return "items=2"9    return "ready"101112response = handle(commandcount)13print("response=" + response)
  2. def handle(command):

    4def handle(commandcount):5    if command == "ping":6        return "pong"
  3. if command == "count":

    6    return "pong"7if commandcount == "count":8    return "items=2"9return "ready"
  4. response ← items=2

    12response→ items=2 = handle(commandcount)13print("response=" + responseitems=2)
    outputresponse=items=2