C Programming Practices: Purity, Speed, and Correctness

2025-09-18

This document presents notes on C programming practices, covering coding style, function and variable naming conventions, formatting, commenting, and clever C tricks like bit counting and loop unrolling. The author emphasizes striving for code purity, speed, and correctness, offering insights into utilizing header files, compilers effectively, and revisiting common programming paradigms like the use of GOTO statements. The goal is to improve the quality and efficiency of C programming.

Read more
Development

Singular vs. Plural Database Table Names: The Case for Singular

2025-09-09

A common debate in database design revolves around whether table names should be singular or plural. While plural names (e.g., `users`) seem intuitive, the author argues that singular names (e.g., `user`) offer significant advantages. Singular names improve readability in SQL joins and prevent inconsistencies with ORMs that automatically pluralize names. Maintaining singular names ensures schema consistency and avoids potential naming conflicts.

Read more
Development

Every Line of Code Is a Potential Bug

2025-02-27

A programmer, attempting to optimize code efficiency in a multithreaded program, changed the wait time from a fixed 1 second to the remaining time. This seemingly simple optimization introduced a potential bug: negative time calculations could result in exceptions. This illustrates a crucial point: code should be kept concise; avoid unnecessary optimizations, as each line introduces potential bugs. Over-optimization doesn't improve efficiency but increases complexity and risk.

Read more
Development bugs