6
First of all, I don’t know if it’s a concept restricted to languages like Typescript or Javascript, so I assume it’s general purpose.
I came across the following codes that I will use as an example base:
// F.W. ephemeral
const getAccessTokenOfUser = (id: string) => {
// ....
return token;
};
I thought that F.W.
referred to a person’s name, but I discovered that F.W.
means Fancy Word (fancy word in en).
In getAccessTokenOfUser
, the concept of ephemeral
(ephemeral) is of something that does not last long, or that lasts 1 day. What agrees as the code that I analyzed, because the key of the token
, which is a JWT, lasts 1 day.
In another code snippet, simplified to exemplify, I have the following:
/**
* @param {string} storageType F.W. Idempotent, according what is defined on STORAGE in .env
* file and never change during life time.
*
* @returns {boolean} F.W. Predicate, according what is defined in storageType.
*/
export const storageTypeStatusIsProductionReady = (
storageType: string
): boolean => {
const storage = {
a: {
// ...
isProductionReady: false
},
b: {
// ...
isProductionReady: true
}
};
// ...
return storage[storageType].isProductionReady;
};
He makes reference to Idempotent
and Predicate
in this Jsdoc and from what I understand,
these words "key", so to speak, represent some standardized meaning of some action, value or resource.
Analyzing the function storageTypeStatusIsProductionReady
, she returns a Boolean true
or false
, then, from what I understand, Predicate refers to a group of possible values to be returned. Something like predictable or predetermined to return (I think functional programming defines like that) according to what it is Idempotent
like the storageType
.
It seems to me that these Fancy Words are words that serve semantic value, not for machines, but for people who will analyze, document and/or use a particular piece of code. I may be mistaken, but from what I understood of the above mentioned examples, they have greater significance to document codes.
I would like to know more about the subject of Fancy Words, which other words have the highest semantic value and which are most used. If Fancy Words are key words to define programming concepts, if it is a synonym for some concept I already know...
... or if it was only a standard adopted only by the creators of the above codes.
As far as I know, predicate is usually a function that is passed to... determine a "predicate"! For example, some say that the callback going on to
Array.prototype.filter
JS is a predicate (note that returns a Boolean). As for the others, I’ve never even seen them. :P But let me observe - maybe it would be better to use the [language-independent] tag, since it seems to me to be something that goes beyond the scope of JS, TS or any language...– Luiz Felipe
@Luizfelipe edited. I’ve never even seen it. I’m starting to think (according to @Piovezan’s reply) that it’s just someone wanting to write "beautiful".
– Cmte Cardeal
Another thing... I was curious to know where the code snippets were taken from. Was it from an open Github repository? : D
– Luiz Felipe
No, it was from a post in a group of international Nodejs in Linkedin (again), where the author talked about commenting on the code with semantic words of common use. I guess it was just for other people to think "Wow!!! What a well-documented code..."
– Cmte Cardeal
I think I’ll even rule out the question... :(
– Cmte Cardeal
@Luizfelipe has an Issue that mentions
predicate
....– Cmte Cardeal
Yes... As I said in my first comment, of the terms you quoted in your question, the only one I have ever had contact with (and still have) is predicate. Commonly used with "programming jargon" - I see more commonly in functional programming contexts, incidentally.
– Luiz Felipe
Let’s go continue this discussion in chat.
– Cmte Cardeal
@Cmtecardeal I am suspicious to speak :) but I do not think I should exclude the question, has a relationship with programming concepts and also counts as a grammatical curiosity that it is not impossible for someone else in the area to be interested in looking for.
– Piovezan