nus-cs3281 / 2024

1 stars 2 forks source link

Book: SE@Google Ch 27: Dependency Management #5

Open ziqing26 opened 8 months ago

ziqing26 commented 8 months ago

Book: SE@Google Chapter: 21 Link

Summary:

Managing dependencies in complex API ecosystems is challenging, but the problems are often addressed by semantic versioning (SemVer). While SemVer / Minimum Version Selection (MVS) is effective on a smaller scale, its reliance on predicting change severity without knowledge of how APIs are consumed becomes increasingly problematic as dependency networks grow.

The chapter proposes a change in perspective by advocating for a shift from relying on compatibility estimates provided by maintainers to embracing an evidence-based approach. In this approach, compatibility is determined by running tests on downstream packages that are affected by the changes. This aims to enhance the fidelity of dependency networks, offering a potential solution to the challenges of version selection in large-scale ecosystems.

Key Points:

Why Dependency Management is Difficult:

Compatibility Promises:

Dependency management involves considering ongoing maintenance costs, security vulnerabilities, changing platforms, and evolving dependency networks. Clear compatibility promises from dependency providers help manage the impact of updates and changes over time.

Examples of Compatibility Models:

Google's Dependency Management:

Dependency Management Models:

  1. Nothing Changes (Static Dependency Model): Assumes no changes to dependencies, prioritizing stability but not sustainable in the long term.
  2. Semantic Versioning (SemVer): Common practice involving version numbers with major, minor, and patch components. Ensures compatibility with specified version ranges but may lead to dependency hell.
    • Problem comes with scale: Overconstraining and overpromising in version constraints, combined with human fallibility, can result in dependency hell.
    • Hyrum’s Law: “With a sufficient number of users, every observable behavior of your system will be depended upon by someone.”
    • Alternatives - Minimum Version Selection (MVS): attempt to address some of these challenges, but the debate on SemVer's effectiveness continues.
  3. Bundled Distribution Models: Involves packaging compatible versions of dependencies together for distribution. Distributors play a crucial role in selecting and testing versions.
  4. Live at Head: Google's proposed model where dependencies are always at the latest version. Relies on API providers testing against the entire ecosystem and using tools for smooth updates.

Live at Head Model:

Dependency Management with Infinite Resources:

SemVer's Current Reliance:

Improved Dependency Management:

Practical Experience over Estimation:

Challenges in Implementing the Model:

OSS Case Studies on Exporting Dependencies:

Considerations:

Case Study: open sourcing gflags:

Case Study: AppEngine:

Considerations for Exposing Dependencies: