Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

0

摘要

近日,Lyft 在 InfoQ 上分享了一篇关于使用 Protocol Buffers 进行系统间集成的经验,重点介绍了协作式协议设计的最佳实践。Lyft 软件工程师 Roman Kotenko 在文章中提出了协议设计的关键原则和最佳实践,旨在提高知识共享、一致性和开发流程质量。

协议设计的关键原则

Kotenko 在文章中强调了协议设计的关键原则,包括:

1. 清晰性:设计良好的协议在定义消息时,要明确哪些字段必须要设置。这样可以防止在实现过程中漏掉某些信息。

2. 可扩展性:协议结构的构建必须要考虑到未来的愿景和潜在的发展路线图。这样,一些可预见的新增内容和破坏性变更就可以提前考虑到。

Lyft 的最佳实践

Lyft 在使用 Protocol Buffers 多年后,积累了丰富的经验,并总结了一些最佳实践:

1. 使用消息校验功能:Lyft 强调了使用 Protocol Buffers 的消息校验功能的收益。protovalidate 项目是一个基于用户定义的校验规则在运行时校验消息的推荐方式。

2. 统一常量值:Lyft 团队创建了一种方式,用来统一在协议定义中跨多个实体的常量值。

3. 使用通用数据类型:在通用的用例中使用众人熟知的数据类型,包括未知的枚举值。

4. 利用“optional”标签:利用 Protobuf 3.15 引入的新“optional”标签明确标记可选字段。

5. 查看特定语言的教程:查看特定语言的教程对于了解所需的设置和所有微妙的细节至关重要。

总结

Lyft 通过分享协作式 Protocol Buffers 设计的最佳实践,为其他公司提供了宝贵的经验和指导。这些实践有助于提高知识共享、一致性和开发流程质量,从而提升整个团队的协作效率。


>>> Read more <<<

Views: 0

0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注