Clean code and architecture reference
See my post annoucing the launch of this repo: Clean Code and Architecture
Pull requests welcome!
- Spread awareness and promote clean code and archiecture and other best practices
- Document my own journey and observations on the discipline
- Create a repository of examples which can be used as a reference
Bad:
A house where, in order to replace a lightbulb, you have to rip out the ceiling, replace the bulb, and then reconstruct the ceiling
Good:
A house where, in order to replace a lightbulb, you simply unscrew the bulb from the socket and screw in a new one
Note: Don't forget to update your lightbulb's firmware!
Bad:
me and you, we may
well ouhgt To go outside---that is, not inside ,but out where their is lite of day and ANIMOS--and buyy
a grilled beef patty served w Cheese on bread.wE reaaaaally may want to
Good:
Maybe we should go out and buy a cheeseburger
-
...letting junior engineers code without senior engineers to review their work and guide them is equivalent to stashing time bombs all over the codebase (Source)
-
You can call it beautiful code when the code also makes it look like the language was made for the problem (Source: Clean Code by Robert C. Martin)
Don't: Use experimental formatting or whitespace
public int calculateScore(int base
, int dailyBonus
, int weeklyBonus) {
...
...
}
Do: Follow your chosen style guide's recommendations on formatting and whitespace
public int calculateScore(int base, int dailyBonus, int weeklyBonus) {
...
...
}