Skip to content

helloworldless/clean-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Clean Code

Clean code and architecture reference

See my post annoucing the launch of this repo: Clean Code and Architecture

Pull requests welcome!

Motivation

  1. Spread awareness and promote clean code and archiecture and other best practices
  2. Document my own journey and observations on the discipline
  3. Create a repository of examples which can be used as a reference

Analogies

Physical Archeticture

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!

Writing

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

Direct Analogies and Other Descriptors

  • ...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)

Code Examples

Experimental Formatting/Whitespace

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) {
  ...
  ...
}

References

Books

Articles

About

Clean code and architecture guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published