Blogging about programming
Why comments aren't necessary
Many years ago, I learned from a developer I deeply admired that “comments are bad”. At the time, this seemed counterintuitive - weren’t comments supposed to make code more understandable? But because I respected his expertise, I pressed him to explain. His reasoning was straightforward: You don’t need comments if your code is self-explanatory. When you think about it, this makes a lot of sense. If you’re adding a comment to explain what the code does, you’re essentially admitting that t...
Building ten simple games with GPT-5
I wanted to test out the recently released GPT-5 model by building ten simple and popular games. All games were built in a one-shot prompt. Only the Tetris one didn’t fully work first-shot but a quick “redo your implementation” request fixed it. Each section below includes the exact prompt used for that game. All follow the same constraints: single self-contained HTML file, inline CSS/JS, optional CDN font/SFX, no build tools, and responsive layout. Pong Build a complete Pong game as ...
AI reignited my coding passion
I’ve been programming for nearly 40 years — started messing around with code at 8, built my first real shareware software at 15, and now, at 47, I thought I’d seen it all. But lately, AI tools like Claude Code, Cursor and Windsurf have taken my passion for coding to a whole new level . It’s the opposite of what I feel some senior developers are saying these days (if they have even tried it), and I get why — change can feel threatening. When I first dipped into AI, I’ll admit I felt a mix of a...
Tip: Use explicit log statements
Logging is a critical practice in software development, providing insights into the application’s behavior, helping diagnose issues, and facilitating debugging. However, the effectiveness of logging is significantly influenced by how log statements are written. It’s essential to make log statements explicit and contextual, which not only enhances the readability and maintainability of the code but also aids in troubleshooting. Why Explicit Log Statements Matter When you include context in y...
Tip: Avoid nested ternary operators (?:)
Nested ternary operators in a single line are difficult to read and understand. Instead, refactor them into a separate function or split them across multiple lines with clear grouping. Avoid <View style={{ alignItems: closeToRight ? 'flex-end' : closeToLeft ? 'flex-start' : 'center' }} /> Do function alignItemsByAdjustment (left, right) { if (right) { return 'flex-end' } else if (left) { return 'flex-start' } else { return 'center' } } <View style={{ alignIt...
Tip: Avoid let statements
Do not use let when only used for delayed initialization. Using let is a hint to developers, that variable will change over time so should be avoided if possible by restructuring initialization. Avoid let closeToLeft = false let closeToRight = false if (maxDepthPixelValue < 60) closeToLeft = true if (maxDepthPixelValue > Utils.width - 60) closeToRight = true Do const closeToLeft = (maxDepthPixelValue < 60) const closeToRight = (maxDepthPixelValue > Utils.width - 60)