关于函数命名,“ Generic”代表函数名称“ helloGCSGeneric”

我的问题是关于“通用”这样的命名。

我正在浏览GCP的云功能教程, documentation

本教程中有一个简单的示例。

/**
 * Generic background Cloud Function to be triggered by Cloud Storage.
 *
 * @param {object} event The Cloud Functions event.
 * @param {function} callback The callback function.
 */
exports.helloGCSGeneric = (data,context,callback) => {
  const file = data;

  console.log(`  Event: ${context.eventId}`);
  console.log(`  Event Type: ${context.eventType}`);
  console.log(`  Bucket: ${file.bucket}`);
  console.log(`  File: ${file.name}`);
  console.log(`  Metageneration: ${file.metageneration}`);
  console.log(`  Created: ${file.timeCreated}`);
  console.log(`  Updated: ${file.updated}`);

  callback();
};

即使对于我来说,此功能的作用也很容易。 在我的理解中,对象创建/更新完成时会触发该事件。

'helloGCSFinalization'或'helloGCSGeneration'很有意义,但是为什么将其命名为'Generic'? 在哪种情况下使用“通用”?我认为与C ++或Java等编程语言不同。

这个问题听起来很愚蠢,但是英语不是我的母语,我仍然想对这种命名环境有个全面了解。

谢谢!

chang661537 回答:关于函数命名,“ Generic”代表函数名称“ helloGCSGeneric”

这个非常有趣的问题。我徘徊了还有谁会尝试解决...

我也不是说英语的人,但是我将尝试以这种方式解决它:因为这是Google文档,所以我尝试使用Google Translator

这个通用术语的第一个描述是(至少在我这边:)):

一类或一组事物的特征或与之有关的特征;不 具体的。

您可能会发现同义词:一般,常见,非特定。

当然,我只能猜测,但是我认为该作者想到了:“只是功能触发了Google Cloud Storage”。尽管我同意computer programming theory中有这样的用语。

这只是我的声音...

本文链接:https://www.f2er.com/2659938.html

大家都在问