English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

English is not my primary language but I'm "forced" to write code and code's comments in English. I'm now trying to develop a PHP code (doesn't really matter this aspect) like this:

function divide($x, $y) {}

Which describes a function that divide $x / $y. Now I want to be able to add a comment related to that function listing few pre-conditions such as

@[A]: $x is an int
@[A]: $y is an int
@[A]: $y != 0

and a list of post-conditions (that are verified only if the pre-conditions are respected), such as:

@[B]: returns $x / $y

How should I call [A] and [B] using a contract metaphor?

Something like [A] = "law" and [B] = "assurance" (which is obliviously wrong). How should I better call them to make it appears that

If you follow all the [A]s I'll guarantee you that [B] will be verified.


share|improve this question

closed as too localized by Daniel, JSBձոգչ, RegDwigнt Mar 13 '12 at 18:16

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I'm afraid this site is the wrong place to post. See the FAQ: "please, don’t ask any questions about these topics: ... How to name this function/variable in my program" – Daniel Mar 13 '12 at 17:33
@Danielδ, I didn't read that :P Sorry. But this is not about a variable or a function but about commenting which is somehow just writing. – Shoe Mar 13 '12 at 17:36
It's my turn to apologize - I didn't follow your question closely enough. – Daniel Mar 13 '12 at 17:41
In my experience the whole thing -- preconditions, function spec, and postconditions -- is the contract. – Monica Cellio Mar 13 '12 at 17:43
+1 for obliviously wrong, a bon mot if I ever heard one. – John Lawler Mar 13 '12 at 18:17
up vote 1 down vote accepted

I suggest stipulation and guarantee.


something stipulated; especially : a condition, requirement, or item specified in a legal instrument


an assurance for the fulfillment of a condition: as

share|improve this answer
Thank you...... – Shoe Mar 13 '12 at 18:08
you are quite welcome! – cornbread ninja 麵包忍者 Mar 13 '12 at 18:34

As noted in the Design-by-contract webpage mentioned in a comment, conditions on inputs are known as preconditions, and on outputs as postconditions. Of the former, wikipedia says:

A precondition is a condition or predicate that must always be true just prior to the execution of some section of code or before an operation in a formal specification. If a precondition is violated, the effect of the section of code becomes undefined and thus may or may not carry out its intended work.

and of postconditions it says

A postcondition is a condition or predicate that must always be true just after the execution of some section of code or after an operation in a formal specification.

Edit: You could also use phrasings like "The caller agrees to ...", "If these stipulated conditions are met, the routine will...", "Given that ..., the routine is required to ...". You might also refer to the preconditions as "Requirements" or "Stipulations", and the postconditions as "Guarantees" or "Undertakings". Mix and match to similar effect. For example:

If the caller meets stipulations P,Q,R, the program undertakes to deliver X,Y,Z.
If the caller satisfies requirements P,Q,R, the program guarantees it will return X,Y,Z.

share|improve this answer
Yep, sorry, but I'd like not to use PRE/Precondition or POST/Postcondition for a trauma closely related to these words I got recently (not kidding). And I'd love to be more metaphor-likely using abstract words referring to the contract itself. Maybe something formal. – Shoe Mar 13 '12 at 17:48
If you are writing in-code comments, precondition and postcondition probably are the terms you should use, in spite of personal preference. – jwpat7 Mar 13 '12 at 17:52
Something like "Contract" and "Guarantees"? Like, "If you sign this contract I'll give you these guarantees?" – Shoe Mar 13 '12 at 18:01
@CharliePigarelli, I updated answer slightly, and deleted a comment. – jwpat7 Mar 13 '12 at 18:15
@Charlie: If you know the precise terms but just don't like them, that's too localized and off-topic. Brainstorming metaphors is not the purpose of this site, and not a good fit for the SE format. Sorry. – RegDwigнt Mar 13 '12 at 18:16

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