Posted on

The difference between good code and great code is the involvement of coding standards, patterns and principles. Let's go through the meaning of each one by one.

  1. Coding Standards: Standards give us rules to follow such as whitespacing, file structure, indentation, etc. This is very important in collabarative environment. Choose a standard, make code consistent!

  2. Coding Principles: These are philosophies of code. Examples are SOLID, KISS, If Ain't Broke Don't Fix It, keep it DRY, Separation of Concerns, etc. etc. I will cover important ones individually.

  3. Design Patterns: These are to best suit the architecture of our software There are basically three categories of Design Patterns: a. Creational Patterns: Help us to make and control new object instances. eg. Factory pattern

b. Structural Patterns: Deals with how we interact and manipulate our object instances. eg. Adapters, Bridges, etc.

c. Behavioral Patterns: Focuses on how code functions and communicates with other parts of code. Eg. Observer patterns.

I will be covering details of each in upcoming blogs!

Generic tips to write better code:

  1. Avoid encodings.
  2. Don't use acronyms for variable names.
  3. Use clear names, be descriptive.
  4. Use constants for hard-coding.