On Github jeremyalan / KCDC-2015-WrapUp
You know you are working on clean code when each routine you read turns out to be pretty much what you expected. - Ward Cunningham (WikiWikiWeb)
public class Customer {};
public void AddAccount();
public class Factory {};
public void AddToJobQueue();
public class CustomerFactory {}
public void AddAccountToJobQueue();
// Good - noun or noun phrase public class Customer // Bad - fuzzy names public class EntityProcessor
// Good - verb or verb phrase public void AddCustomer() // Bad - fuzzy names public void Process()
// Short range variables
for (int i = 0; i < 10; i++) {}
// Short method variable names
var balance = GetAccountBalance();
// Longer field variable names
private int _totalAccountBalance;
// Longer global variable names
public int totalBalanceInAllBankAccounts;
// Short public method names public void GetCustomers(); public void Save(); // Longer private method names private string ParseHtmlFromFile() private int GetIdFromAccountHolder()
// Short public class name public class Account // Longer private class name private class AccountNumberGenerator // Longer derived class name public abstract class Account public class SavingsAccount : Account
IDictionary<string, object>
Func<IDictionary<string, object>, Task>
public static void Main()
{
OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
while (true)
{
led.Write(true);
Thread.sleep(500);
led.Write(false);
Thread.sleep(500);
}
}