Skip to content

Discussion: Naming convention for main code folder (toolbox/ vs src/ vs <toolboxname>/) #36

@ehennestad

Description

@ehennestad

I'd like to open a discussion about the recommendation to use toolbox/ as the main folder for user-facing MATLAB code in open-source projects. I realise there is probably some history behind this choice that I’m not aware of, so apologies if this topic has already been settled.

The way I see it, there are three candidate options:

  1. toolbox/
  2. src/
  3. <toolboxname>/

1. toolbox/

  • ✅ Fits well with the MATLAB Toolbox framework (e.g., toolbox packaging and generating an .mltbx file).

  • ✅ Standard name—if you know the pattern, you immediately know where the end-user code is located.

  • ❌ MATLAB-centric term; might confuse developers who are used to other languages (Python, Java, etc.).

  • ❌ Very specific, and not every package feels like a toolbox.

2. src/

  • ✅ Widely used across many languages and immediately recognizable.

  • ✅ Standard name—if you know the pattern, you immediately know where the end-user code is located.

  • ❌ Short for “source” and reads a bit awkwardly. (“addpath src”)

3. <toolboxname>/

  • ✅ Can create a shallower folder structure—no need for src/<toolboxname> or toolbox/<toolboxname>.

  • ❌ Harder to spot quickly when entering an unfamiliar repository; it requires scanning all folder names.


Overall, I tend to prefer src/ because of its widespread use and the generality of the term. Of course most of this is highly subjective, but would be interested to hear other opinions and reasonings!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions