software-design|July 02, 2019|1 min read

Principles of Software Designing

TL;DR

Favor composition over inheritance, program to interfaces not implementations, and keep classes loosely coupled. These principles underpin every major design pattern.

Principles of Software Designing

It is very easy to build a software or app. But, it is trickier to have a good design that gives you good maintainability over long period of time, and that serves the purpose.

Listing down few design principles that can help greatly in designing applications or softwares:

Move the code what varies and encapsulate it so that it wont affect rest of the code

In simpler terms: Identify the aspects of your application that vary and separate them from what stays the same. It will result in more flexibility in your code. And, this is very powerful concept, as it is being used in many design patterns.

Program to an interface, not an implementation

It gives you a lot of flexibility in changing the actual implementation at any time, without the need to change the code. Or, change in smaller portion of the code. Otherwise, you are bound to some implementation, and for every new implementation change, you need a massive code change.

Favor composition over inheritance

Inheritance is good but in practical, this can become overhead. Many beginner consider it as re-usability. But, Composition provides reusablity. It provides several benefits like: - You can encapsulate the implementation or algorithms - You can change the behavior at runtime - You can have list of that object instead of inheritance

Related Posts

Singleton Pattern with Thread-safe and Reflection-safe

Singleton Pattern with Thread-safe and Reflection-safe

What is a Singleton Pattern Following constraints are applied: Where we can…

Deep Dive on Redis: Architecture, Data Structures, and Production Usage

Deep Dive on Redis: Architecture, Data Structures, and Production Usage

“Redis is not just a cache. It’s a data structure server that happens to be…

Deep Dive on Apache Kafka: A System Design Interview Perspective

Deep Dive on Apache Kafka: A System Design Interview Perspective

“Kafka is not a message queue. It’s a distributed commit log that happens to be…

Deep Dive on API Gateway: A System Design Interview Perspective

Deep Dive on API Gateway: A System Design Interview Perspective

“An API Gateway is the front door to your microservices. Every request walks…

Deep Dive on Elasticsearch: A System Design Interview Perspective

Deep Dive on Elasticsearch: A System Design Interview Perspective

“If you’re searching, filtering, or aggregating over large volumes of semi…

REST API Design: Pagination, Versioning, and Best Practices

REST API Design: Pagination, Versioning, and Best Practices

Every time two systems need to talk, someone has to design the contract between…

Latest Posts

Claude Code Skills — Build a Better Engineering Workflow with AI-Powered Code Reviews, Security Scans, and More

Claude Code Skills — Build a Better Engineering Workflow with AI-Powered Code Reviews, Security Scans, and More

Most developers use Claude Code like a search engine — ask a question, get an…

Building an AI Voicebot for Visitor Check-In — A Practical Guide to Handling the Messy Parts

Building an AI Voicebot for Visitor Check-In — A Practical Guide to Handling the Messy Parts

Every office lobby has the same problem: a visitor walks in, nobody’s at the…

Server Security Best Practices — Complete Hardening Guide for Production Systems

Server Security Best Practices — Complete Hardening Guide for Production Systems

Every breach post-mortem tells the same story: an unpatched service, a…

Staff Engineer Study Plan for MAANG Interviews — The Complete 12-Week Roadmap

Staff Engineer Study Plan for MAANG Interviews — The Complete 12-Week Roadmap

If you’re a Senior Engineer (L5) preparing for Staff (L6+) roles at MAANG…

XSS and CSRF Explained — The Complete Guide with Real Attack Examples and Defenses

XSS and CSRF Explained — The Complete Guide with Real Attack Examples and Defenses

XSS and CSRF have been in the OWASP Top 10 for over a decade. They’re among the…

OWASP Top 10 (2021) — Every Vulnerability Explained with Code

OWASP Top 10 (2021) — Every Vulnerability Explained with Code

The OWASP Top 10 is the industry standard for web application security risks. If…