Questions tagged [solid-principles]

SOLID is an acronym for five principles of object-oriented design introduced or documented by Robert C. Martin. Use this tag on questions regarding any of the individual principles, or their relationships to other OOD concepts. Also use the five individual tags, when applicable.

The SOLID principles are language-agnostic principles of object-oriented design. (Not to be confused with tools and conventions for decentralized social applications proposed by Tim Berners-Lee and MIT.) In a series of articles in 1996, Robert C. Martin documented the existing Open-Closed and Liskov Substitution principles, and introduced the other three. Michael Feathers invented the acronym afterwards.

The acronym stands for:

References:

1149 questions
-2
votes
1 answer

Implementing SOLID Design in Go application

What's the best way to model a model (user) and a database without running into circular dependencies? I have a Go application that I'm trying to set up. The structure of imports is confusing because it doesn't cleanly appear to divide along…
user3162553
  • 2,699
  • 3
  • 37
  • 61
-2
votes
1 answer

Does using virtual methods violates LSP( L part of SOLID principles) or there are some exceptions?

Does using virtual methods violates LSP( L part of SOLID principles) or there are some exceptions? Thanks in advance, Saghar Ayyaz
-2
votes
3 answers

Does anybody know any use case for using interface with just properties?

It pretty much makes sense to me of using interface with method signature/events and so on. But, I am not able to find what's the use case for using interfaces with just properties. ( I know properties are methods under the hood and they…
ANewGuyInTown
  • 5,957
  • 5
  • 33
  • 45
-3
votes
1 answer

What is the meaning of breaking code while implementing new features?

I was reading a text about SOLID principles and Open/Close principle and it said that : "The main idea of this principle is to keep existing code from breaking when you implement new features" what it means by breaking code?
-3
votes
1 answer

Variable Declared Outside of For Loop Vs Inside

//assume there is a java class call Node, and node is an array of Node for(Node i: node){ Node j = i; } Node j; for(Node i: node){ j = i; } Can someone please explain essentially what's the difference between this two?
Ray Zheng
  • 3
  • 2
-3
votes
2 answers

C# SOLID - Extend class and override/hide members without violating Open/Closed?

I need to extend a class where the child class will not use some members of the parent class. How should the unused members be handled and still respect the open/closed SOLID principle? I'm considering doing something like the code below, but…
Kevin S. Miller
  • 913
  • 1
  • 9
  • 21
-3
votes
2 answers

How to solve this design problem: Inheriting from class that is abstracted to a interface?

I'm having a hard time to grasp a solution for the following problem. I am decoupling the classes with their correspondent interface but I need to extend the class for a new change instead of changing the original implementation in order to be…
RollRoll
  • 8,133
  • 20
  • 76
  • 135
-4
votes
1 answer

Does this class violate SOLID's single responsibility principle?

Is a class that contains a connection method and methods that do select, insert, update, delete, a violation of the single responsibility principle? class Database: def create_connection(self, url): ... def select(self): ... …
Lucas Emanuel
  • 470
  • 2
  • 10
-4
votes
1 answer

Advanced JavaScript Inheritance in TypeScript

Advanced JavaScript Inheritance in TypeScript One of the wonderful aspects of JavaScript is the number of different ways objects can inherit encapsulation from others. However, TypeScript puts heavy constraints on the possibilities for writing a…
Cody
  • 9,785
  • 4
  • 61
  • 46
1 2 3
76
77