Click on image to see full size. Read the comments for description.

10 Good Coding Principles to improve code quality. The HD pdf download link can be found at the end.

Software development requires good system designs and coding standards. We list 10 good coding principles in the diagram below.

1. Follow Code Specifications
When we write code, it is important to follow the industry’s well-established norms, like “PEP 8”, “Google Java Style”, adhering to a set of agreed-upon code specifications ensures that the quality of the code is consistent and readable.

2. Documentation and Comments
Good code should be clearly documented and commented to explain complex logic and decisions, and comments should explain why a certain approach was taken (“Why”) rather than what exactly is being done (“What”). Documentation and comments should be clear, concise, and continuously updated.

3. Robustness
Good code should be able to handle a variety of unexpected situations and inputs without crashing or producing unpredictable results. Most common approach is to catch and handle exceptions.

4. Follow the SOLID principle
“Single Responsibility”, “Open/Closed”, “Liskov Substitution”, “Interface Segregation”, and “Dependency Inversion” – these five principles (SOLID for short) are the cornerstones of writing code that scales and is easy to maintain.

5. Make Testing Easy
Testability of software is particularly important. Good code should be easy to test, both by trying to reduce the complexity of each component, and by supporting automated testing to ensure that it behaves as expected.

6. Abstraction
Abstraction requires us to extract the core logic and hide the complexity, thus making the code more flexible and generic. Good code should have a moderate level of abstraction, neither over-designed nor neglecting long-term expandability and maintainability.

7. Utilize Design Patterns, but don’t over-design
Design patterns can help us solve some common problems. However, every pattern has its applicable scenarios. Overusing or misusing design patterns may make your code more complex and difficult to understand.

8. Reduce Global Dependencies
We can get bogged down in dependencies and confusing state management if we use global variables and instances. Good code should rely on localized state and parameter passing. Functions should be side-effect free.

9. Continuous Refactoring
Good code is maintainable and extensible. Continuous refactoring reduces technical debt by identifying and fixing problems as early as possible.

10. Security is a Top Priority
Good code should avoid common security vulnerabilities.


Click on image to see full size.

C Lang, Gorshenin, 2015

View Fullscreen

Reference cards (cheat sheets) collection.

Main algorithms to use.

Basic algorithms :

  • Sorting – Merge Sort, Insertion Sort, Quick Sort, Number of inversions
  • Matrix Multiplication (just know the algo if not implement it)
  • Prime Sieving
  • Modular Math including multiplication and division
  • Euclidean Algorithm for GCD, Modular Inverse, Fast Exponentiation
  • Fibonacci number with matrix multiplication
  • Probability distribution and expected value
  • Stats – Mean, Median, Variance, Bayes theorem

Linear data structures and algorithms:

  • Arrays
  • Linked List
  • Stack
  • Queues

Algorithmic techniques:

  • Divide and Conquer – Binary Search, Maximum Subarray
  • Greedy Algorithms – Activity Selection, Huffman encoding
  • Dynamic Programming – Matrix Chain Multiplication, Knapsack,
  • Linear Programming – Variable Maximisation, Linear time sorting
  • String Algorithms – Manacher, LCS, Edit Distance

Typical non-linear data structures:

  • Trees – Binary Tree, General Tree, Lowest Common Ancestor
  • Binary Search Tree – Inorder Traversal, Level order traversal, finding kth largest element, diameter, depth, number of nodes, etc.
  • Heaps – Array Implementation, Heapify, Heap Sort
  • Union Find
  • Hash Table – Linear Probing, Open addressing, Collision avoidance


  • Adjacency List, Adjacency Matrix, Weighted Edge Graphs
  • Basic Traversal algos – Breadth First Search, Depth First Search, etc
  • Shortest Path Finding Algorithm – Dijkstra, Floyd Warshal, Bellman Ford
  • Minimum Spanning Tree – Kruskal’s Algo, Prim’s Algo

Advance Tree and Graph :

  • Balanced Trees – AVL, Red-Black
  • Heavy Light Decomposition, B+ Trees, Quad Tree
  • Advance Graph – Min Cut, Max Flow
  • Maximum Matching – Hall’s Marriage
  • Hamiltonian Cycle
  • Edge Graphs / Line Graphs
  • Strongly Connected Components
  • Dominant Sub-Graph, Vertex Cover, Travelling Salesman – Approx algos

Advance String Algorithms :

  • Knuth Morris Pratt Algorithm
  • Rabin Karp Algorithm
  • Tries and Compressed Tries
  • Prefix Trees, Suffix Trees, Suffix Automation – Ukkonen Algorithm

Advance Math:

  • Fast Fourier Tranformation
  • Primality Testing
  • Computational Geometry – Closest point pair, Voronoi diagram, Convex Hull

General Advance topics :

  • Iterating through all combination / permutation
  • Bit manipulation