The difference between liskov substitution principle and interface segregation principle

LSP: The subtype must honor the contracts it promises. ISP: The caller shouldn’t depend on more of the base type’s interface than it needs. Where they fit: If you apply the ISP, you use only a slice of the receiver’s full interface. But according to LSP, the receiver must still honor that slice. If you … Read more

Dependency Inversion in Python

The principle Robert C. Martin’s definition of the Dependency Inversion Principle consists of two parts: High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions. Just to clarify… a module could be a function, a class, a file… a piece of … Read more

Configuring Automapper in Bootstrapper violates Open-Closed Principle?

I would argue that you are violating two principles: the single responsibility principle (SRP) and the open/closed principle (OCP). You are violating the SRP because the bootstrapping class have more than one reason to change: if you alter model binding or the auto mapper configuration. You would be violating the OCP if you were to … Read more

How do you define a Single Responsibility?

The Single Responsibility Principle There are many obvious cases, e.g. CoffeeAndSoupFactory. Coffee and soup in the same appliance can lead to quite distasteful results. In this example, the appliance might be broken into a HotWaterGenerator and some kind of Stirrer. Then a new CoffeeFactory and SoupFactory can be built from those components and any accidental … Read more

Difference between OOP basics vs SOLID? [closed]

the answer is simple: languages or concepts which don’t support Encapsulation, Abstraction, Inheritance and Poly are not object oriented. If you do something object oriented you can always apply these OO basics, because they are available. One doesn’t call such things principles. SOLID in return is optional. When developing an OO design you should strive … Read more

Can anyone provide an example of the Liskov Substitution Principle (LSP) using Vehicles?

For me, this 1996 Quote from Uncle Bob (Robert C Martin) summarises the LSP best: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it. In recent times, as an alternative to inheritance abstractions based on sub-classing from a (usually abstract) base/super class, we … Read more

Liskov substitution principle – no overriding/virtual methods?

Subclasses overriding methods in the base class are totally allowed by the Liskov Substituion Principle. This might be simplifying it too much, but I remember it as “a subclass should require nothing more and promise nothing less” If a client is using a superclass ABC with a method something(int i), then the client should be … Read more

Liskov substitution principle – no overriding/virtual methods?

Subclasses overriding methods in the base class are totally allowed by the Liskov Substituion Principle. This might be simplifying it too much, but I remember it as “a subclass should require nothing more and promise nothing less” If a client is using a superclass ABC with a method something(int i), then the client should be … Read more

What is an example of the Single Responsibility Principle? [closed]

The most effective way to break applications is to create GOD classes. Those are classes that keep track of a lot of information and have several responsibilities. One code change will most likely affect other parts of the class and therefore indirectly all other classes that use it. That in turn leads to an even … Read more

SOLID for functional programming

As far as I know (I’m no expert), SOLID principles do not tell anything about state. They should be applicable as well in a functional programming languages. They’re more advice about how to achieve modularity. Some of them are rather obvious or at least well-known. Single-responsibility is the UNIX principle “do one thing and do … Read more

techhipbettruvabetnorabahisbahis forumueduedusedueduseduedueduedusedusedus