Another Coding rules!

During some learning I came across 10 rules here with corresponding How-To

  • #10 Avoid regions :: Refactor into smaller methods
  • #9  Use Exceptions For Errors :: Only for errors not for execution branching
  • #8  Avoid Boolean Parameters :: Create local Properties instead or using 2 different methods one for true and one for false.
  • #7  Avoid Too Many Parameters :: Refactor to Create a class and pass its object instead
  • #6  Warnings are errors :: It has to be periodical change
  • #5  Encapsulate Complex Expressions :: Solve a problem once (100%) then forget it, Just remember class & Method name.
  • #4  Try To Avoid Multiple Exits :: Create return object and set various values, Return it at the end of the method.
  • #3  Try To Avoid Comments :: Instead, Refactor code to express the motive & use better primitives
  • #2  Keep Methods Short :: Thumb rule. should be readable on a screen space with easily readable font size.
  • #1  Keep Classes Small :: Single responsibility

Happy Coding!

Advertisement

Leave a comment

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Connecting to %s

%d bloggers like this: