1

The context of this question is naming a function in programming. I'd like to find a good name for a function that takes a parameter of type prerequisite.

For instance, if I have a function that takes a parameter of type requirement, then the name of it could be require.

But what would be a good corresponding name when the parameter is a prerequisite?

1
  • 1
    You could just use prerequire. Perhaps it doesn't exist, but ultimately meaning is what's important and if you think that's clearer in the context of what you're doing than substituting with an entirely different word which may be less concise, then stay with that.
    – Neil
    Jun 29, 2011 at 9:39

5 Answers 5

4

Unfortunately, "require" is to "prerequisite" as "require" is to "requirement", since a prerequisite is essentially a requirement.

However, you should name a function for what it does, not for what parameters it takes. If you prefer long function names, ensure_prerequisite_is_met() would do; if you like them shorter, check_prereq().

2
  • Or maybe "require as prerequisite"
    – GEdgar
    Jun 29, 2011 at 14:13
  • @GEdgar: the trouble with require as a function name is that it's more of an assertion than an action. require_prerequisite(X) doesn't hint at what happens if X doesn't exist, or even what happens if it does.
    – user1579
    Jun 29, 2011 at 14:32
2

I was thinking about a similar word in a different context and the word I was looking for was "presuppose," as in, "being a doctor presupposes having a medical degree".

Google says that "presuppose" means:

(of an action, process, or argument) require as a precondition of possibility or coherence.

1

A prerequisite means something that is required beforehand, and there is no single verb to express that. You would have to specify both require and when it should be required, for example RequireBeforeInstallation, or use EnsureRequirementsBeforeInstallation.

1

In the computing context we would say "x depends upon y" if y is a pre-requisite for x. This may or may not extend to wider usage. In a job context, you'd just use "requires", as in "to be a doctor requires a medical degree". The pre part is implicit.

0

A good corresponding name could be:

Require beforehand.

It's easier to understand, and its a very short way of stating it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.