Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active August 24, 2025 02:08
Show Gist options
  • Save mcsee/4fe4708741bc558dda3818181a7a04a7 to your computer and use it in GitHub Desktop.
Save mcsee/4fe4708741bc558dda3818181a7a04a7 to your computer and use it in GitHub Desktop.
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
class User {
public email;
private name;
// Step 1: Choose consistent indentation (2 spaces)
// Step 4: Public methods before private ones
constructor(name, email) {
this.name = name;
this.email = email;
}
public getName() {
return this.name;
}
// Step 3: Standardize spacing around operators
public setName(newName) {
this.name = newName;
}
// Step 2: Apply uniform brace placement
private validateEmail() {
return this.email.includes('@');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment