JuliaImages / JuliaImages/juliaimages.github.io

Towards consistent style, part 1: a naming guide

Open
#229 30 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
33
Forks
52
PR merge metrics
No merged PRs in 30d

Description

JuliaImages has grown over several years through the efforts of many people; now that Julia is itself stable, I anticipate new waves of growth in the coming years. To help ensure its health and vibrancy, I think we need to establish some guidelines that will help give such a large, distributed project a unified feel. To me, step 1 of this process is to develop a naming guide and to rename some of our functions or objects accordingly. The sooner we do this the better.

A naming guide should not be arbitrary, but be based on principles. I propose we use this issue to hash out the principles. Here are a few thoughts to get the discussion rolling:

  • maintain consistency with the Julia Style Guide
  • operations whose primary goal is to construct something should be nouns:
    • when the goal is to create a specific type, use the uppercase constructor name (e.g., HOG())
    • when the type created depends on the inputs, use a lowercase function (e.g., colorview)
  • operations that fetch a property or type parameter should be nouns (e.g., axes, eltype)
  • for functions that compute something or perform an operation, start with a verb (e.g., warp)
  • "lazy" computations should use the noun form (e.g., mappedarray rather than maparray)

More examples of current names that are consistent with these guidelines:

  • testimage, line are fine as-is (by the "constructors are nouns" convention)
  • colorview as a lazy computation is better than an alternative like combinechannels
  • the new build_histogram and adjust_histogram (implemented in JuliaImages/Images.jl#761, JuliaImages/Images.jl#762) are better than imhist and histeq (which, for now, still remain)

Some examples of current names that would change due to these guidelines:

  • imfilter violates the "start with a verb" convention. filterarray, mapstencil (inspired by mapwindow) would both be acceptable
  • imshow->showimage
  • while dilate is good, tophat seems wrong, though I don't immediately have a suggestion as to how to change it

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed principles and the linked Julia Style Guide, then examine the naming examples and the referenced JuliaImages/Images.jl#761 and #762. Done would require an agreed naming guide and resolved decisions about which existing names, such as imfilter and imshow, should change.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.