DEV Community

Inversion of Inversion of Control

3Shain on July 24, 2021

Inversion of Control is a common phenomenon that you come across when extending frameworks. Indeed it's often seen as a defining characteristic of...
Collapse
 
dz4k profile image
Deniz Akşimşek

I contribute to an experimental programming language called _hyperscript, which has what we call async transparency and event driven control flow. Check out the draggable window example, it seems closely related to what you are describing.

Collapse
 
redbar0n profile image
Magne

That’s very interesting!

The context for this article was our twitter discussion here:

twitter.com/magnemg/status/1418523...

twitter.com/san3shain/status/14189...

On programming languages, you might find my article interesting, which started the discussion in the first place:

Features of a Dream Programming Language

Collapse
 
jwp profile image
John Peters • Edited

The first Foo method is not in control of when the fetch returns, is not blocking during the fetch, but does not progress to next step until the system performs the await. I'm thinking it is IoC because the system does indeed resume control on to original stack in same way as a event would. I never think of this pattern as IoC rather I call it the async/await pattern.

For me, IoC is using Dependency Injection, Interfaces, and even functions, the idea being the caller is able to drive the behaviors.

Collapse
 
3shain profile image
3Shain

……I don't know if you did get my idea…The "control" I'm talking about has nothing to do with thread/blocking/stack, but a mental interpretion of logic flows.

Collapse
 
jwp profile image
John Peters

No I understand just don't think it's a good article on IoC, too many problems.

Thread Thread
 
3shain profile image
3Shain • Edited

Yeah someday I will find out what's not so correct. I do have some similar experiences for several times, due to have different (levels of) perspectives to a problem.

Issues so far: poor English; ill-demostrated example;

Thread Thread
 
jwp profile image
John Peters

But the good news is this post may be improved. The topic is good for sure.

Collapse
 
jwp profile image
John Peters • Edited

Also allowing a Ping Pong scheme at the application layer demonstrates a misunderstanding of
the TCP/IP layer. Why? because that's what a time out exception is for.

Collapse
 
3shain profile image
3Shain

That's for demonstration purpose……to strictly speak, I will not design a protocol like this (but I did have once integrated a service like this…)

Collapse
 
jwp profile image
John Peters • Edited

Yes I brought this up because many times network people will tell developers to implement a Ping Pong scheme because "nothing is wrong with the hallowed network". When the real answer is always "the network is unstable, please keep working to fix it"

The most common root cause of this type issue is, a router or switch resets due to signal failures.

Thread Thread
 
3shain profile image
3Shain • Edited

Off-topic though. Ping-pong isn't necessarily used for checking network status. E.g. measure the delay, "let me know you are not dead", etc. Maybe it's my fault to use the name ping-pong but not "echo" so someone can nitpick.

Thread Thread
 
jwp profile image
John Peters

The socket send receive cycle is enough to determine latency. However the protocol should be ICMP for best results because the Tcp/Ip retry logic gets in the way. Ping runs at ICMP layer.

Collapse
 
jwp profile image
John Peters

What does this mean?
"The key part is 'framework' call you rather you call 'framework'. ".

Collapse
 
3shain profile image
3Shain

You need the context from the first link I've provided.

Collapse
 
jwp profile image
John Peters • Edited

No it's just poor English. It should say:
The key part is the 'framework' calls you rather than you calling the 'framework'

Thread Thread
 
3shain profile image
3Shain

I see. Thanks. I do speak poor English 😅 and I'll keep practicing.

Thread Thread
 
jwp profile image
John Peters • Edited

When I first read it, I seriously didn't understand it; but was eventually able to correct it mentally after thinking about it.