Skip to content

Instantly share code, notes, and snippets.

@gushogg-blake
Last active May 20, 2022 16:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gushogg-blake/247b1bf2ed46b035d1c8a2c1e776b607 to your computer and use it in GitHub Desktop.
Save gushogg-blake/247b1bf2ed46b035d1c8a2c1e776b607 to your computer and use it in GitHub Desktop.
A proposal for // ENTRYPOINT comments to indicate where a project connects to the outside world

Entrypoints

This is a proposal to adopt the use of // ENTRYPOINT comments next to a program's top-level entrypoints, such as the main function, event handlers, and network listeners.

The idea is to allow new contributors and curious readers to quickly gain an overview of the project's main functions in a way that's easy to understand, and for the entrypoints to act as sensible starting points (and helpful mental anchor points) for further exploration.

The presence of ENTRYPOINT comments should allow the reader to quickly begin to answer questions like what does this program do? (provided the main function is sufficiently readable); what happens when I press a key?; and how does this program respond to network requests?.

Tooling

Further, the idea is for IDEs and other tools to recognise the convention and provide useful insights and actions based on it. For example, an IDE might use the collection of ENTRYPOINT comments to display an overview with quick links to each entrypoint, much like systems that display TODO and FIXME comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment