Debugging Life, One Musing at a Time

Welcome to my little corner of the internet! 馃彔

  • This is where I ramble about all things software engineering, bioinformatics, machine learning, and cloud tech鈥攂asically, the stuff that keeps my brain buzzing.
  • Expect a mix of insights, battle scars, and “aha!” moments from my adventures.
  • Feel free to stick around鈥攍et鈥檚 explore and debug life together. 馃殌

Functional programming in Python, Java, C#

Functional programming (FP) is a paradigm that emphasizes immutability, pure functions, and higher-order functions. While Python, Java, and C# are all multi-paradigm languages (supporting both object-oriented and functional programming), they each have different levels of FP support. Here鈥檚 a comparison: 1. First-Class Functions All three languages support first-class functions, meaning functions can be assigned to variables, passed as arguments, and returned from other functions. Python: Full support for first-class functions using lambda, map(), filter(), reduce(), and list comprehensions. Java: Added functional support in Java 8 with lambda expressions and the Stream API. C#: Supports functional programming via delegates, lambda expressions, and LINQ (Language Integrated Query). 2. Higher-Order Functions A function is considered higher-order if it takes another function as an argument or returns one. ...

October 28, 2024 路 3 min 路 Hongzhu Cui

Python interface and protocol

Python isn鈥檛 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鈥檚 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., ( \frac{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