Skip to content

NetLogo Style Guide

Jeremy B edited this page May 21, 2024 · 3 revisions

Nearly every major programming language has its own style guide: a set of conventions about how one should write code. The more consistent the style, the more readable a project tends to be.

NetLogo model development is no exception to this rule. The NetLogo style guide is meant to serve as a reference document for NetLogo developers and model makers to showcase our chosen model-authoring style. While community members shouldn't perceive the document as completely immutable, we do use the guide as the definitive way of authoring and reviewing models featured in the NetLogo Models Library.

The guide addresses all aspects of a model including details on file naming and in-depth guides on each main NetLogo app screen:

File Naming Guidelines

Capitalization & spacing

Correct: My Amazing Model.nlogo

Incorrect: my amazing model.nlogo, My amazing model.nlogo, MyAmazingModel.nlogo

As of NetLogo 6.1, the stuff before the .nlogo is considered the title of the model, so you want it to look clean and readable.

Filename & punctuation

  • Hyphens and apostrophes are OK. Slashes and colons are not.

Word order

  • Name closely related models so they alphabetize together, even if makes the names read oddly. So for example: GasLab Gas in a Box, GasLab Free Gas, CA 1D Elementary, CA 1D Totalistic, etc.

3D

All 3D models should have "3D" (and not "3-D" or "3d") at the end of the name: Flocking 3D.