Search HoldMyTwist

Browse all posts

Episode 15

The Stall That Opened Too Soon

Duck: Welcome to my booth! Try not to stare at the lantern that's not up there yet. Robot: You have to build the frame before you can hang the lantern from it.

Episodes

Computing Basics

    Duck opens up a half completed stall in the monitor.
    The frame parts are sitting out on the counter.
    A blank menu paper is sitting on the stall counter.
    Robot puts down four task cards on the outside desk: F frame, H hang lantern, M print menu, O open.
    Robot draws from F to H on a blank task board.
    Robot sets arrows H to O and M to O.
    Here's a closeup showing Duck attaching the lantern to the frame he's just built.
    Duck pins up the printed menu to the stall. The lantern is up, but the stall is not open yet.
    Duck grins (exaggeratedly relieved) and flips the OPEN sign around to the outside. Robot points to the same arrows and displays order done: F,H,M,O.
    Duck has a blank piece of paper next to the task board.
    Here's a close up as the menu is printing and the frame parts are still there in pieces.
    Robot is checking both valid orders. Duck is next to the printer in the monitor.
    Robot crosses off sequence F,O,H,M since O comes before H and M. The arrows H -> O and M -> O are shown in highlight.
    Duck has the spool of (insulated) wire in the monitor. Robot puts the W task card on the physical board outside of the monitor.
    Robot checks for existence of frames F and wiring W before hanging H in the candidate order.
    Duck will follow this list then (hang lantern, print menu, open stall).
    Robot shows F,W,H,M,O and W,F,H,M,O order strips (with labels) outside of the monitor. F-frame task and W-wiring task swap. Duck inside of the monitor is looking.
    empty soup pot

    Episode transcript

    Opening time

    Duck opens up a half completed stall in the monitor.

    Duck: Welcome to my booth! Try not to stare at the lantern that's not up there yet.

    The frame parts are sitting out on the counter.

    Robot: We still need to build up the frame.

    A blank menu paper is sitting on the stall counter.

    Duck: Opened too early.

    Robot puts down four task cards on the outside desk: F frame, H hang lantern, M print menu, O open.

    Diagram values: F FRAME; H HANG LANTERN; M PRINT MENU; O OPEN

    Robot: What needs to be ready to go before we open?

    Things that must come first

    Robot draws from F to H on a blank task board.

    Diagram values: F → H

    Robot: You have to build the frame before you can hang the lantern from it.

    Robot sets arrows H to O and M to O.

    Diagram values: F → H → O; M → O

    Duck: You can't open up until you hang the lantern and get the menu printed. People will need both.

    Here's a closeup showing Duck attaching the lantern to the frame he's just built.

    Diagram values: F ✓; H ✓; M; O

    Robot: Frame it first, then mount the lantern.

    Duck pins up the printed menu to the stall. The lantern is up, but the stall is not open yet.

    Diagram values: F ✓; H ✓; M ✓; O

    Duck: Menu printed! Whew... so I can stop pretending to have soup.

    Duck grins (exaggeratedly relieved) and flips the OPEN sign around to the outside. Robot points to the same arrows and displays order done: F,H,M,O.

    Diagram values: F,H,M,O

    Robot: Open it.

    A different good order

    Duck has a blank piece of paper next to the task board.

    Diagram values: F → H → O; M → O

    Duck: Can I print and build later?

    Here's a close up as the menu is printing and the frame parts are still there in pieces.

    Diagram values: M,F,H,O

    Robot: You can print out the menu prior to building the frame.

    Robot is checking both valid orders. Duck is next to the printer in the monitor.

    Diagram values: F,H,M,O ✓; M,F,H,O ✓

    Duck: Great news for my printer.

    Robot crosses off sequence F,O,H,M since O comes before H and M. The arrows H -> O and M -> O are shown in highlight.

    Diagram values: F,O,H,M ✗

    Robot: All prerequisites need to be run before the task.

    One more prerequisite

    Duck has the spool of (insulated) wire in the monitor. Robot puts the W task card on the physical board outside of the monitor.

    Diagram values: F → H; W → H; H → O; M → O; F,W,H,M,O

    Duck: Is this order still valid?

    Robot checks for existence of frames F and wiring W before hanging H in the candidate order.

    Diagram values: F ✓; W ✓; H

    Robot: You need to wire and frame first. Then hang. That's correct.

    Duck will follow this list then (hang lantern, print menu, open stall).

    Diagram values: F,W,H,M,O ✓

    Duck: Then lantern. Then menu. Then opening. All arrows are in agreement.

    Robot shows F,W,H,M,O and W,F,H,M,O order strips (with labels) outside of the monitor. F-frame task and W-wiring task swap. Duck inside of the monitor is looking.

    Diagram values: F,W,H,M,O ✓; W,F,H,M,O ✓

    Robot: They don't depend on each other.

    empty soup pot

    Duck: Nice. So we just wait for the soup.

    The lesson

    A dependency is a prerequisite between tasks. A task has to wait for its prerequisites to be done. Printing the menu does not depend on the frame. This means you can arrange the tasks in multiple ways. Any arrangement where each prerequisite task comes before the task that needs it is a topological order in this graph.

    Try it

    Diagram values: F → H; H → O; M → O

    Think of order M,F,O,H. Is this order valid?

    Answer

    Diagram values: M,F,O,H ✗; M,F,H,O ✓

    The order you suggested is bogus: you're opening O before hanging H. Make H before O, and you get M,F,H,O. You could print the menu first, since it's not dependent on the frame.

    Sources

    dependency ordering (opens in a new tab)