Protocol Buffer 设计:协作开发的原则和实践

At Lyft Media, we’re obsessed with building flexible and highly reliable native ad products. Since our technical stack encompasses mobile clients on both iOS and Android, as well as multiple backend services, it is crucial to ensure robust and efficient communication between all involved entities. For this task we are leveraging Protocol Buffers, and we would like to share the best practices that are helping us achieve this goal. This article focuses on our experience addressing the challenges that come with collaborating on shared protocols in teams where people with different levels of familiarity and historical context, or even people outside the team, get to contribute. The problem of development process quality is prioritized over raw efficiency optimizations.

在Lyft Media,我们致力于构建灵活且高度可靠的原生广告产品。由于我们的技术堆栈涵盖了iOS和Android上的移动客户端以及多个后端服务,因此确保所有相关实体之间的强大而高效的通信至关重要。为此,我们利用了Protocol Buffers,并且我们想分享帮助我们实现这一目标的最佳实践。本文重点介绍了我们在解决共享协议方面的挑战时的经验,这些挑战涉及到具有不同熟悉程度和历史背景的人员,甚至涉及到团队外的人员进行贡献。开发过程质量的问题优先于原始效率优化。

Note: This article focuses on the proto3 specification of the Protocol Buffers (protobuf) language. Code snippets illustrating the handling of generated protobuf messages are provided in Python.

注意:本文重点介绍 Protocol Buffers(protobuf)语言的 proto3 规范。提供了用 Python 处理生成的 protobuf 消息的代码片段。

Why Protocol Buffers?

为什么选择 Protocol Buffers?

  1. In comparison to text-based data serialization formats like JSON, protobufs offer both higher serialization efficiency & performance, and better backwards compatibility.
  2. 与 JSON 等基于文本的数据序列化格式相比,protobuf 提供了更高的序列化效率和性能,以及更好的向后兼容性。
  3. Our team works with Python, Swift, and Kotlin codebases extensively, and all of these languages have extensive protobuf support.
  4. 我们的团队广泛使用Python、Swift和Kotlin代码库,所有这些语言都对protobuf有广泛的支持。
  5. Protobufs are extensible with rich validation capabilities that help us reach our reliability goals while avoiding writing boilerplate code across platforms.
  6. Protobuf具有丰富的验证功能,可以扩展,帮助我们实现可靠性目标,同时避免在各个平台上编写样板代码。
  7. Protobufs boast rich internal tooling at Lyft, and widespread use in both mobile-to-serv...
开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-24 10:46
浙ICP备14020137号-1 $访客地图$