petrhurtak.com site logopetrhurtak.com

Common naming mistakes

Published
Updated:

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 is 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.

Authentication vs Authorization

  • Authentication is the process of finding out that somebody really is who they claim to be.
  • Authorization refers to rules that determine who is allowed to do what. E.g. Admin may be authorized to create and delete databases, while a regular user is only authorized to read.

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 a 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 is when you're referring to a resource just by its name or some other fragment.
  • URL is when you're giving both the name of a resource and the method of accessing it.
┌─────────────────────┐
│         URI         │
│                     │
│ ┌───────┐ ┌───────┐ │
│ │       │ │       │ │
│ │  URN  │ │  URL  │ │
│ │       │ │       │ │
│ └───────┘ └───────┘ │
└─────────────────────┘

Examples

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