Tag Archives: Readable Code

How to Write Easily Readable Code

via How to Write Easily Readable Code.

Since we read more code than we write, it makes sense to write code that is easy to read. But what makes code more readable seems a bit like asking “What makes one author more readable than another?”

There are some principles that developers tend to agree on – most notably how to express their intent in code. Ask a programmer to name some of them and you’ll likely hear something like this:

  • Well-named variables, methods, and class
  • Consistent formatting
  • Small methods
  • Minimal nesting and code branches

Let’s take some of those ideas and apply them in practice, starting with a functional, if confusing, bit of code and improving it.