Logic separate from methods - More types and fields; verbose - Mixing mechanics and logic · Relatively few API methods · Request/response pattern - Maybe not totally obvious + Colocate method and logic + Fewer types and fields + Mechanics and logic separate · More API methods · More complex input/output
Lifecycle encapsulation - Tricky to get determinism - Tricky to make re-entrant · Simpler components · When easy > correct - More work for caller - More state to track + Less scaffolding in component + Straightforward determinism + Much easier to test! · More complex components · When correct > easy
net.Listen("tcp", ":8080") go sm.Run(ctx) // cancel() go http.Serve(ln, api) // ln.Close() go cronJobs(sm) // ? go signalCatcher(???) // ? // wait for shutdown somehow