Urgent.News

What's breaking now, across thousands of outlets.

Tech

Stop Writing Smart Code. Start Writing Dumb Code.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian Kernighan We’ve all been there. You open a pull request, high on caffeine, and drop a 4-line nested ternary operation wrapped in an array reduce function that performs an O(n) lookup in milliseconds. It works.…

Debugging takes twice as long as initially writing the code. Consequently, if you craft code as complex as possible, you inherently are not well-equipped to debug it. The author, Brian Kernighan, shares a personal experience of writing an intricate yet efficient line of code that led to confusion and frustration three months later when responding to an incident.

The discussion emphasizes that over-engineering and overly clever code can create technical debt, making future maintenance difficult. The "smart" approach, exemplified by a complex JavaScript function, is contrasted with what the author calls "dumb" code - code that is clear, explicit, and easy to understand. "Dumb" code is advocated as it leads to better maintainability, as it eliminates the need for extensive decoding by future self or colleagues.

The author urges developers to follow a checklist before pushing code to ensure it's readable, maintainable, and easy to debug.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Hyundai Card Expands Fall Cultural Lineup With Wayne Thiebaud, Silica Gel and More

Hyundai Card is expanding its cultural programming this fall with a broad lineup spanning contemporary art, rock and classical music, documentaries and live performances.The card company will present…

  • Hyundai Card expands fall cultural lineup with Wayne Thiebaud retrospective.
  • Korean rock band Silica Gel performs first Asian tour at KSPO DOME.
  • Diverse programs include documentaries, classical music, and busking shows.

More from Friday 11 September →