You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • It is usually better to keep independent 'things' independent - in their own 'threads' (timeout or event driven) - and only manage the coop of dependent 'things'.

    Nice part about Javascript's single-threaded-ness and the available immense computing power makes 'logical multithreaded' things quite simple. Last but not least - even if you have a multi-core - most software is executed single-threaded anyway... nothing conceptional really new for over 50+ years... just more efficient and more transparent for the application developer, more 'plumbing' moves into the platform/containers. So fare I was not much in gaming but more in efficiently rendering large pages where many resources have to be retrieved from different places and the user experience should still be smooth...

    Because MC/IoT/Espruino has even more challenges - almost all communication with any peripheral is callback oriented - I built for myself something like a global controller that allows sequencing of tasks of callback driven components. The challenging part is that 'you have to wait, but you do not know how long'. Of course you can define 'frames' (to show the similarity of the challenges) of 5 minutes or longer for completion of, for example, creating a connection, and after that one to get data across that connection, etc. But what do you do if after waiting overly long things still didn't complete, or worse, failed right away, but only now action can be taken...

    Espruino's E.on("init",function(){...}) is kind of an approach to have independent components 'get going'. But as said: independent, and therefore is only of very limited use. Most of the time, the components have very little independent function, but have to line up - in sequence - with one another. So how do you manage that and still have componentized, reusable software... Promises is the solution, but it get's pretty heavy... t0 heavy or MCs, and what I missed the most, is more detailed error/exception handling and retry options. One of my implementations put special focus on retry.

    All is still a work in progress... and to have a a single universal component that provides platform with all functions is a challenge.

About

Avatar for allObjects @allObjects started