<<Clean Code>> Quotes: 5. Formatting

The Purpose of Formatting

Vertical Formatting

The Newspaper Metaphor

Vertical Openness Between Concepts

Vertical Density

Vertical Distance

Vertical Ordering

Horizontal Formatting

Horizontal Openness and Density

private void measureLine(String line) {
lineCount++;
int lineSize = line.length();
totalChars += lineSize();
lineWidthHistogram.addLine(lineSize, lineCount);
recordWidestLine(lineSize);
}
public class Quadratic {
public static double root1(double a, double b, double c) {
double determinant = determinant(a, b, c);
return (-b + Math.sqrt(determinant) / (2*a);
}
private static double determinant(double a, double b, double c) {
return b*b - 4*a*c;
}
}

Horizontal Alignment

private   Long            requestParsingTimeLimit;
protected Request request;
private FitNesseContent context;
this.context = context;
input = s.getInputStream()
requestParsingTimeLimit = 900;

Indentation

Dummy Scopes

Team Rules

A climber who enjoys skiing and scuba diving, and writes iOS code during the day. Made in China, evolving in the USA.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

GarageFarm.NET adds GPU rendering solutions to one of their new services

Reflecting on my first pair programming interview

Set sysctl kernel parameters — Ansible module sysctl

Checking Retailer Stock Using Python

Ansible Installation on RedHat8

Open Software and Public Administration: online the Guidelines for software acquisition and reuse

Different ways to use environment variables in Golang

Don’t Objectify Me! Or Do : Class-Based vs Prototype-Based OOP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wenzhi Lin

Wenzhi Lin

A climber who enjoys skiing and scuba diving, and writes iOS code during the day. Made in China, evolving in the USA.

More from Medium

SOLID in Software Designing

Solid Principles:

Practice makes perfect!

Best practice

Notes from uncle Bob (clean code)