› Forums › Personal Topics › Unbidden Thoughts › Patterns for IoC & Signals/Slots Working Together
This topic contains 9 replies, has 1 voice, and was last updated by
Josh July 4, 2022 at 6:47 pm.
-
AuthorPosts
-
June 12, 2022 at 8:19 pm #116176

joshIn general terms on this topic, we can make a few points.
How are specific values delivered to the computing/working regions of our code?
Function arguments are 1 way – they are brittle. In many PL forms, the function needs to be declared at compile/design type & echoed in various spots. The passing of the arguments can involve a lot of stack churning when there are many levels of function decomposition.
Setting object fields is another way – this can be even more brittle for the same sorts reasons.
Setting Open Ended “Global” Variables??? – that sounds smelly, but what if the namespaces could be very module/class specific where & only where that was desirable, & what if the access mechanisms could be completely controlled by whatever program guards we use anywhere for that, and what if there was little or no runtime cost until a certain feature got used in the code, and what if…
There are architectural ways to all of those things with inversion of control, and they can become potentially become more dynamic but also cleaner through the use of signals & slots – the excact logical conclusion that matters to a specific piece of code can be computed once & then updated if there are any updates, and then accessed through a function with no arguments call() where it is needed.
The exact patterns for best efficiency, safety, flexibilty, & dynamc adaptability are not yet set here. So it’s a good area for group focus.
-
June 12, 2022 at 9:19 pm #116180

joshIn general, all forms of programmatic guards are available for this paradigm & design is a matter of finding the best forms for the combinations that you want. The global form is motivated by publish/subscribe patterns with dynamic info rather than top down computation of a static mathematical function that might involve some deep parameter twiddling for optimization debugging.
So the slot might be a private static variable in a module. This sort of usage can lead to singleton patterns with dependencies. I don’t like to be affected by implementation choices in where singleton initialization gets called. IMO, good practice would include library mechanisms for declaring dependencies in the initialization of singletons & ways to kick off the global chain or specific dynamic chains at entry to a new program epoch. Efficiency of lazy loading might use signals slots for those implementations.
-
June 12, 2022 at 9:56 pm #116181

joshWhat I mean by “singleton” is something like In source code module “ReactToRegionalWeatherWarnings” there may be a single static root module protected variable “ListOfRegionsThatWeMonitorForWeatherEventWarnings” – it’s a singleton. In a language like C++, it’s not implemented on the call stack. In any language we need to initialize it in some fashion. For our program logic, we might want the initialization phase to hook up its slots to a publisher of weatherEventWarnings. We may or may not use inversion of control to let the specifics of that publisher location be configured at run time in some convenient way. Dynamically, we want to add new local regions that go on the lits & also connecto signals & slots, perhaps going through mechanisms internal to the “ListOfRegions…” that are module specifically implements (Is it all implemented here, or inherited from other code??? Usually the program system or operating system has built in functionality to make sure that an implementation we partially inherit from gets loaded before we use it & that is normally good enough for us, when it’s only a code & not a not-stack variable we access. But, if we wanted to be super stingy, there is some possible gain in making super sure we don’t load that implementation if we aren’t using it yet in this program run – that’s not my focus, but it’s a parallel example/cause. My cause is that I want to make super sure that my signal publishers are loaded & initialized before my slots subscribe to them, wherever that is relevant.
This is the sense of singleton -not a semantic issue about what the program describes in a model reality.
-
-
-
June 16, 2022 at 8:56 pm #116641

joshI notice many people excited about adding easy/clean support for heavy public subscribe applications. Financial transactions is of course 1 direction. But from a software engineering POV, the issue is whether the subscribe operation can hang & how long you can wait for it. In general, keeping things clean depends on the ability to know that objects are ready & initialized (constructed…). So my thought is that types should be utilized for the types of not ready/wait/retry & abort/exception/error patterns that are supported (where that sort of thing is a goal).
For non-networking, non-distributed apps, perhaps deferring a max of some integer number of tries is a basic & simple to implement form. Others might set a timer for retrying.
-
June 17, 2022 at 3:17 am #116666

joshQ: What about too many fans lined up, waiting for the concert doors to open, slowing everything else down?
A: All these sorts of things are known in studies of queues & scheduling. For instance, within a process, the intervals to next check can be exponentially (by a multiplicative factor) lengthened after repeat failure & a priority queue of waiters can be maintained according to time to next try.
-
-
July 3, 2022 at 7:06 pm #117604

JoshIn a web app development context, activities triggered by the browser client which fall under the general category of “paging” reverse the direction of signals & slots. Implementation patterns which support AJAX paging, for example, should support reveral of the client/server position of queues & filters supporting the paging type signals.
-
July 4, 2022 at 12:42 pm #117639

JoshSelf-teaching points to note:
From a MVC perspective, parts of The Model, The View, & The Controller components are all found on both the browser client & the server backend.
There are definite benefits to being able to share implementation code across major clients & servers as with Typescript/Node.js/browser implementation of javascript/game implementation of WASM, etc.
-
July 4, 2022 at 12:43 pm #117640

JoshAlso, I like the vision of metaprogramming everything & letting the implementation stages pick the language instantiation – but even there, it’s practically helpful if there is more rather than less sharing across widely used optimization paths.
-
-
July 4, 2022 at 6:47 pm #117663

JoshA configurable solution for html paging might offer the possibility of a decision rule that decides whether to first forward a low res version of the view data followed by slightly delayed higher res version in order to provide low latency feedback.
-
-
AuthorPosts
You must be logged in to reply to this topic.