Questions tagged [solid]

Solid: tools and conventions for decentralized social applications proposed by Tim Berners-Lee and MIT. Please do not use this tag for the SOLID OOP principles.

Solid (originally derived from "social linked data") is a set of conventions and tools for building decentralized social applications based on Linked Data principles, proposed by Tim Berners-Lee and MIT. (Not to be confused with the of object-oriented design.) Solid is modular and extensible and it relies as much as possible on existing W3C standards and protocols.

Code on github.

81 questions
1
vote
1 answer

Symfony: is it fine to instantiate an entity in the controller?

One of the SOLID principles is Dependency inversion. As I understand it means that I shouldn't instantiate other classes in my code and pass them to the constructor. Is it a violation of this principle when I write this? UserController extends…
Hevyweb
  • 402
  • 1
  • 5
  • 18
1
vote
1 answer

Static function encapsulation in Swift by passing Protocols.Type better than OO encapsulation and just as testable?

Given that I have a function that does not need to share and store state; should I use a static class/struct/enum to hold the function? I have read in many places that it is a bad design to use static functions to hold code, as static function do…
question_guy
  • 81
  • 1
  • 1
  • 5
1
vote
1 answer

else if not working in KeyCode events javascript

I am trying to make me character moving left and up and I think jump() and slideLeft() functions are working properly and the problem is in the controller(e) function (else if (e.KeyCode===37)) . The first function is avaible but it isn't able to…
fast539
  • 27
  • 6
1
vote
1 answer

Custom Entity UUID w/ embedded info

I follow clean arch / solid principles on my entire stack. I'm coming across a situation where I want to embed an UUID in some of my entity id fields in the domain logic, for example: Create OrganizationEntity id=abc123 Create a ItemEntity and…
Cory Robinson
  • 4,616
  • 4
  • 36
  • 53
1
vote
1 answer

Inject multiples interfaces is against SOLID?

I got the following class: public MealService( IFoodRepository foodRepository, IOrderRepository orderRepository, IDishListRepository dishListRepository) { _inputValidator = inputValidator; …
1
vote
1 answer

Clean Architecture - How to manipulate a List? In Presenter? Or UseCase?

I have in my domain layer one entity called Product. class Product{ String barcode; String name; String barcode; double price; int amount; } My UI has a Product list and when I touch the barcode scanner button, the camera read…
1
vote
2 answers

How do I have a method return one of almost the same classes case to case?

I am integrating a new payment way into our service project. I coded everything. Now I want it to be convenient to Solid principles. However, I am stuck how to overcome a case. Our service already have a method that called GetPaymentProfile and…
ilyas varol
  • 788
  • 3
  • 10
  • 25
1
vote
1 answer

Use of address function inside a contract constructor?

Wondering if anyone can explain this. I am following along in the "Solidity, Blockchain, and Smart Contract Course - Beginner to Expert Python Tutorial" by freeCodeCamp.org. In lesson two we create a contract factory in which we store an array of…
avcoates
  • 23
  • 4
1
vote
0 answers

DI principle in Console application

I am developing a small game in a console application in .NET Core where the the start of the application is StartPlay method of IGamePlay interface. I have a class GamePlay which implements this interface. interface IGamePlay { void…
VA1267
  • 311
  • 1
  • 8
1
vote
1 answer

Why does this class hierarchy violate LSP?

Below is code from an online tutorial (https://code-maze.com/liskov-substitution-principle/): // version 1 public class SumCalculator { protected readonly int[] _numbers; public SumCalculator(int[] numbers) { _numbers =…
user16276760
1
vote
1 answer

Is it wrong for a class to call another Error Class directly?

I'm new to the SOLID principles. I have this scenario: class ErrorClass { constructor(name: string, description: string) { // } } class Class1 { public someMethod() { try { // good scenario } catch…
viztastic
  • 1,815
  • 1
  • 17
  • 17
1
vote
1 answer

The role of Dependency inversion principle on frontend development

I was learning React and came across something called "SOLID" especially Dependency inversion principle. Then after having done some research, I found these articles https://medium.com/@vittorioguerriero/dependency-inversion-in-react-58f1545dc039…
qweeee
  • 63
  • 1
  • 2
  • 8
1
vote
0 answers

Follow the SOLID principle in Rest Api and Django

hi i have two model in django like Device and Data, the Data is related many-to-one to Device and my api returned a list of the Devices and orther api return a list of Data that related to Device. and the android developer say i have both of that…
Nova
  • 413
  • 4
  • 11
1
vote
0 answers

It's a good practice to have a parent class with private methods that are only used by their descendents?

I'm trying to follow the SOLID concepts and at same time be DRY (not to repeat myself). I have a parent class that is sharing a method between its subclasses, but this method is not used in the parent class itself: class ParentClass def locals …
Albert Català
  • 2,026
  • 2
  • 29
  • 35
1
vote
0 answers

Android WebView doesn't allow authentication with the @solid/react library due to a popup

I've been working in the development of a webapp that uses Solid to store information of the users such as the list of friends. In order to authenticate into the app, we are using the @solid/react library that generates a popup in which you can…
llomba
  • 11
  • 2