CodeSOD: Public Private Partne... Note

CodeSOD: Public Private Partnership

A developer found a discrepancy within an API's concurrency handling code. The comment for a status property stated it should be private to prevent misuse. However, the property's definition declared it as public. This public definition allows external consumers to modify the status, contradicting the comment's intention. The author highlights the irony of expecting API users to read documentation and adhere to suggested privacy of public methods. Such a mismatch is particularly concerning within a concurrency API. The potential for misuse and resulting chaos is emphasized. Despite the risk, the code remains publicly accessible, with only the comment serving as a warning. This highlights a common oversight where documentation and implementation diverge.