software-design1 Min Read

Principles of Software Designing

Gorav Singal

July 02, 2019

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

Share

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 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…

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…

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

AI Video Generation in 2025 — Models, Costs, and How to Build a Cost-Effective Pipeline

AI Video Generation in 2025 — Models, Costs, and How to Build a Cost-Effective Pipeline

AI video generation went from “cool demo” to “usable in production” in 2024-202…

AI Models in 2025 — Cost, Capabilities, and Which One to Use

AI Models in 2025 — Cost, Capabilities, and Which One to Use

Choosing the right AI model is one of the most impactful decisions you’ll make…

AI Image Generation in 2025 — Models, Costs, and How to Optimize Spend

AI Image Generation in 2025 — Models, Costs, and How to Optimize Spend

Generating one image with AI costs between $0.002 and $0.12. That might sound…

AI Coding Assistants in 2025 — Every Tool Compared, and Which One to Actually Use

AI Coding Assistants in 2025 — Every Tool Compared, and Which One to Actually Use

Two years ago, AI coding meant one thing: GitHub Copilot autocompleting your…

AI Agents Demystified — It's Just Automation With a Better Brain

AI Agents Demystified — It's Just Automation With a Better Brain

Let’s cut through the noise. If you read Twitter or LinkedIn, you’d think “AI…

Supply Chain Security — Protecting Your Software Pipeline

Supply Chain Security — Protecting Your Software Pipeline

In 2024, a single malicious contributor nearly compromised every Linux system on…