10
trekhleb
124d

I've played around a bit with illustrating the SOLID principles (Single Responsibility, Open/Closed, etc., you know).

You may check it out here: https://okso.app/showcase/solid

Let's see if it will be helpful or more confusing :D

Comments
  • 0
    Did not know about okso look similar to exclalidraw
  • 2
    @Kampouse yes it is similar to Excalidraw and Tldraw. However, one distinguishing feature is the ability to have nested drawings. The example in this rant illustrates it. You can click on S.O.L.I.D. letters and go deeper into other nested drwaings.
  • 0
    Good illustration!
  • 1
    It's pretty nice. I'm just not sure I agree with the Dependency inversion principle illustration. I don't feel like a socket is in any way comparable to a wire

    I feel like the high-level module "Plug" should depend on the abstraction of "wire" rather than the concretion of "copper wire" or "aluminium wire"

    It obviously also depends on the abstraction of "Socket" and not on the concrete "American Socket" or "European Socket". But it feels like those are completely unrelated in this case

    Am I reading this wrong? And if so, am I the only one or did anyone else disagree here?
  • 3
    Do powerlifters look healthy to you?
  • 0
    Looks neat! One question: what does "closed for modification" actually means? Modification of its state (values) or attributes (data model)?
  • 0
    Oh, I see you redid the controls, and the undo/redo functions are more accessible. Nice :D

    Also, I think there is a typo in the last sentence for the dependency inversion principle.
  • 0
    @trekhleb
    oh would you look at that: this appeared in my news feed just now 😄
  • 0
    @Hazarth as you've mentioned "I feel like the high-level module Plug should depend on the abstraction of wire" - that was exactly what I wanted to show by using the Socket as an abstraction of wires. The user doesn't care what wire types are there behind those two socket holes. But maybe semantically the word "Socket" was a bit misused. Those may be replaced with "Aluminium Wires", "Coper Wires", and just "Wires" (which is the "Socket" on the sketch)
  • 0
    @electrineer let doctors decide if that "Sportsman <-- Powerlifter " inheritance is valid :D
  • 0
    @hack I believe the internal implementation and the data model can't be changed, but the state can.

    With the example of a mixer and its attachments, we can say that the mixer "can rotate any attachment that you give to it". Different attachments may be treated as a state change, however, the "rotation engine" stays hidden and not changed.
  • 0
    @Lasoloz thanks for pointing that out! The typo should be fixed after the Showcase cache is reset.
  • 0
    Don't know if you are aware of it but you got some attention on hacker news.

    Data Structures Sketches - https://news.ycombinator.com/item/...
  • 1
    @jonas-w Ah! Cool!
Add Comment