• Home
  • About
    • About The Coder
    • Language List
  • The Rules
    • Rule #1: Clarity Trumps Everything
    • Rule #2: Source Code is for Humans
    • Rule #3: Don’t Ignore Warnings
    • Rule #4: Comment As You Go!
    • Rule #5: Always Use Parentheses
  • CS-101
  • Guestbook

The Hard-Core Coder

~ I just can't stop writing code!

The Hard-Core Coder

Tag Archives: code clarity

Rule #5: Always Use Parentheses

19 Sunday Apr 2020

Posted by Wyrd Smythe in CS101

≈ Leave a comment

Tags

code clarity, computer programming, operator precedence, order of operations, parentheses, readable code, software design

Enough stories, time for a new rule. Which is to always use parentheses in all except the simplest of math expressions. Languages have a precedence protocol, so the compiler can figure it out, but human readers may be confused.

As always, the underlying motivation involves code clarity for other humans reading the source code — the most important rule of all.

Continue reading →

Write a Formal Letter

10 Tuesday Jun 2014

Posted by Wyrd Smythe in CS101

≈ Leave a comment

Tags

code clarity, computer programmers, computer programming, readable code

Think of writing code as you think of writing a formal letter.

When you write a formal letter, you have two goals: you have a message to communicate, and you must follow the protocol of a formal letter. Your message comes through when your writing is clear and good. Following the protocol is a matter of knowing and following some syntax rules.

A message + formal syntax. The result is a document with a context.

Continue reading →

Always Use Less-Than

05 Wednesday Mar 2014

Posted by Wyrd Smythe in CS101, Opinion

≈ 4 Comments

Tags

code clarity, computer programming, greater-than, less-than, readable code

Here’s a simple tip! I can’t begin to count how many potential code bugs this has eliminated. It takes some getting used to but once you make it automatic it’s a real help in keeping code and your thinking correct.

The tip is this: when you write relational expressions, always use less-than, never use greater-than. (Less-than-or-equal is okay, too.)

Continue reading →

Rule #2: Source Code is for Humans

03 Monday Mar 2014

Posted by Wyrd Smythe in CS101

≈ Leave a comment

Tags

code clarity, computer programming, readable code, variable names

When you write code, always remember Rule #2: Source code is for humans. This rule ties to Rule #1 about clarity. You’re writing for humans, so write clearly! The compiler can understand any syntactically correct ball of mud you make, but humans need all the help you can give them. Write for your human readers, not the compiler.

Continue reading →

Rule #1: Clarity Trumps Everything

26 Wednesday Feb 2014

Posted by Wyrd Smythe in CS101

≈ Leave a comment

Tags

code clarity, computer languages, computer programming, readable code

Clarity is the #1 priority when writing code. Clarity trumps everything else; it’s even more important than the code being correct! One of the biggest wins a serious programmer can offer is writing clear, readable code.

Continue reading →

Follow The Hard-Core Coder on WordPress.com

The Posts

  • Thinking Ahead
  • Brian Kernighan: Successful Language Design
  • My Python App Framework
  • Multiplication Visualized
  • Square Root of 2
  • Life With Class
  • John Conway’s Life
  • Python Decorators, part 2
  • Python Decorators, part 1
  • Function Currying

The Topics

  • Blog (4)
  • CS101 (29)
  • Fun (22)
  • Interesting (1)
  • Opinion (12)
  • Stories (12)
  • Uncategorized (1)

The Month

March 2021
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Feb    

The Past

It’s me!

Wyrd Smythe

Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts.

View Full Profile →

The Main Blog

Visit Logos con carne

Lots of wyrds... with meat!

Posts

RSS Feed

Comments

RSS Feed

Enter your email address to follow The Hard-Core Coder and get email when there is a new post.

Blog at WordPress.com.