What's your Coding style?


What is Clean Code?
Clean code is a reader-focused development style that produces software that's easy to write, read and maintain. Developers are often tempted to consider their work complete when the application operates as expected. But we're not merely writing code for computer consumption.

‘There's no problem so simple that a bad developer can't make it complicated.’
Steve Bohlen

Clean code is code that is easy to understand and easy to change.

‘Programming is the art of telling another human what one wants the computer to do.’


Clean Code Principle

  • Can be easily extended by any other developer

  • It should have minimal dependencies

  • Smaller is better

    • A code should be minimal. Both classes and methods should be short, preferably just a few lines of code. It should be well divided (also within one class). The better you divide your code the easier it becomes to read it.
  • For the code to be easy to change:
    • Classes and methods are small and only have a single responsibility. Read more about single Responsibility Rule
    • Classes have clear and concise public APIs
    • Classes and methods are predictable and work as expected
    • The code is easily testable and has unit tests (or it is easy to write the tests)
    • Tests are easy to understand and easy to change

If you write clean code, then you are helping your future self and your co-workers. You are reducing the cost of maintenance of the application you are writing. You are making it easier to estimate the time needed for new features. You are making it easier to fix bugs. You are making it more enjoyable to work on the code for many years to come. Essentially you are making the life easier for everyone involved in the project.
"Code is like humor. When you *have* to explain it, it’s bad"
Learn more about Clean Code, buy Clean Code by Robert C Martin



Comments