Python interface and protocol

Python isn’t like Java or C# where they have explicit interface keywords. So, how do interfaces work in Python? Traditionally, Python uses a different approach. Instead of explicit interfaces, it relies on duck typing. That means if an object behaves like a duck (has the necessary methods), it’s treated as a duck, regardless of its type. Duck Typing Python relies on duck typing: If an object behaves like a duck (i.e., has the required methods/properties), it is treated as a duck. No formal interface declaration is needed. ...

August 22, 2024 · 3 min · Hongzhu Cui

Quorum-based replication and Raft

Quorum-based replication and Raft are both techniques used in distributed systems to ensure consistency and fault tolerance, but they differ in their approaches and use cases. Quorum-Based Replication Quorum-based replication is a general approach to achieving consistency in distributed systems by requiring a majority (quorum) of nodes to agree on operations like reads and writes. It is often used in systems like distributed databases and key-value stores. Quorum Size: A quorum is a subset of nodes that must agree on an operation (e.g., read or write) for it to be considered successful. The quorum size is typically defined as a majority of nodes (e.g., N/2 + 1 for N nodes). Read and Write Quorums: ...

August 8, 2024 · 3 min · Hongzhu Cui

How callback works in C#?

An article explaining the fundamentals of callbacks in C# with simple examples.

June 17, 2024 · 3 min · Hongzhu Cui

Intact analysis, top-down analysis, and peptide mapping in mass spectrometry

Comparison of Intact Analysis, Top-Down Analysis, and Peptide Mapping in Mass Spectrometry.

June 8, 2024 · 3 min · Hongzhu Cui

Async/await under the hood

Comparison of await Implementation in C# and Python.

September 23, 2023 · 3 min · Hongzhu Cui