Skip to content

How to name functions when you're writing about them #32

Closed
@hollance

Description

@hollance

I just updated my Candy Crush tutorial to Swift and found that referencing function names from the text can be awkward.

For example, I have the method:

func convertPointFromColumn(column: Int, row: Int) -> CGPoint

This uses the style where the first argument is named as part of the function name.

So in the text, should I refer to this as:

  • convertPointFromColumn()
  • convertPointFromColumn(row:)
  • convertPointFromColumn(column:, row:)

The first one is the shortest but also incomplete because row: is part of the function name.

The second one might be misleading because a reader may think row: is the argument, not part of the name.

The third one is the most correct, but also the longest and "noisiest".

Note that Xcode calls this method convertPointFromColumn(_, row:). That's also an option but not a very nice one...

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