Common naming mistakes

A Little collection of technical expressions that I either confuse often or that I see often confused by other people.

Parameter vs. argument

function log (parameter) {
  console.log(parameter)
}

log('argument')

Parameter

Variable in a function signature that is a placeholder for the actual value passed into the function.

Argument

The actual value passed into the function.

Function vs. method

function functionName (state) {
  return state + 1
}

class ClassName {
  constructor () {
    this.state = 0
  }

  methodName () {
    this.state += 1
  }
}

Function

  • Data is usually passed into the function explicitly.

Method

  • OOP paradigm.
  • Methods are called on instance or object instance.methodName().
  • Usually, it operates on data that is contained within the instance of the class.

Serial vs. parallel

Serial

input ── A ── B ── C ── response

Parallel

        ┌──── A ────┐
        │           │
input ──┼──── B ────┼── response
        │           │
        └──── C ────┘

URL vs. URI

URIs are identifiers, and that can mean name, location, or both. All URLs are URIs, but the opposite is not true. The part that makes something a URL is the inclusion of the access mechanism, or network location, such as https://, or mailto:.

  • URI: when you’re referring to a resource just by its name or some other fragment.
  • URL: When you’re giving both the name of a resource and the method of accessing it.

Examples

  • example.com URI.
  • https://example.com URI and URL.

Links

If you know about any other expressions that are often confused, tell me about them in comments.

Discuss on TwitterEdit on GitHub