logo
/
プログラミングで良く使用する単語一覧
使う単語を絞ることで理解しやすくなる

対義語を理解する

  • add / remove
  • insert / delete
  • get / set
  • start /stop
  • begin / end
  • send / receive
  • first / last
  • get / release
  • put / get
  • up / down
  • show / hide
  • source / target
  • open / close
  • source / destination
  • increment / decrement
  • lock / unlock
  • old / new
  • next / previous
  • Begin ⇔ End
  • Start ⇔ Stop
  • Top ⇔ Bottom
  • High ⇔ Low
  • Big ⇔ Small
  • Create ⇔ Destroy
  • Previous ⇔ Next
  • Allocate ⇔ Free
  • Attach ⇔ Detach
  • Get ⇔ Set
  • Get ⇔ Put
  • Input ⇔ Output
  • Show ⇔ Hide
  • Go ⇔ Back
  • Up ⇔ Down
  • Upper ⇔ Lower

動詞

Prefix

is

Describes a characteristic or state of the current context (usually boolean).
const color = "blue";
const isBlue = color === "blue"; // characteristic
const isPresent = true; // state

if (isBlue && isPresent) {
  console.log("Blue is present!");
}

can

期待する動作ができるか ※shouldと重複する?
function canRemove(date, createDate){
	return date - createDate >= 100
}

has

Describes whether the current context possesses a certain value or state (usually boolean).
/* Bad */
const isProductsExist = productsCount > 0;
const areProductsPresent = productsCount > 0;

/* Good */
const hasProducts = productsCount > 0;

should

Reflects a positive conditional statement (usually boolean) coupled with a certain action.
function shouldUpdateUrl(url, expectedUrl) {
  return url !== expectedUrl;
}

min / max

Represents a minimum or maximum value. Used when describing boundaries or limits.
/**
 * Renders a random amount of posts within
 * the given min/max boundaries.
 */
function renderPosts(posts, minPosts, maxPosts) {
  return posts.slice(0, randomBetween(minPosts, maxPosts));
}

prev /next

Indicate the previous or the next state of a variable in the current context. Used when describing state transitions.
async function getPosts() {
  const prevPosts = this.state.posts;

  const latestPosts = await fetch("...");
  const nextPosts = concat(prevPosts, latestPosts);

  this.setState({ posts: nextPosts });
}