Some rules that an applications programmer shall follow for keeping his code clean


computer ip address checker

A clean code

  1. contains classes that
    • are named with noun
    • are minimal, expressive, simple
    • do one thing well i.e. should have one, and only one reason to change
      (SRP:Single Responsability Principle)
    • are simple and direct
    • can be read like well-written prose
    • are literate
    • always look like they were written by someone who cares
  2. contains names that
    • are meaninful, intension-revealing
    • avoid disinformation
    • make meaninful distinction
    • are pronounceable
    • are searchable
    • are not encoded
    • don’t mappe mental
  3. contains methods that
    • are named with verbs or verb phrases
    • are minimal
    • do one thing
    • have one level of abstraction
    • respect the stepdown rule
    • have descriptive names
    • have the minimal number of arguments (zero is ideal)
    • have no side effects i.e. do only one thing at a time
    • don’t repeat themselves i.e. avoid duplication
  4. contains comments that
    • are legal
    • are informative
    • explain intents
    • clarify
    • amplificate
    • are not redundant
    • are not mandated/delegated
    • are not like a journal

View original post 136 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s