[Esug-list] Concurrency Best Practices + Tests

Maarten Mostert maarten.mostert at stakepoint.com
Thu Sep 5 04:56:40 EDT 2019


Hello,

Supposing you are working on a desktop app and you need to keep your main image responsive and want to offload things to a worker image on a separate processor you can hook it to the keyboard processor once finished.

If you are basically making a clone of your image it is easy to make a switch (dev/runtime) to do all the development and debugging in the same image.

This is at least my scenario. The main application works on a read-write sqlite file. The worker makes a read only copy , slowly synchronises everything with Postgres on compose.io <http://compose.io/>, when finished puts itself on the keyboard queue and when it his turn writes the differences to the local sqlite work file and signals an UI update.

The keyboard hook makes it possible for the worker to come back on the main thread as a normal user interaction.

Hope this helps,

Maarten,


> Le 5 sept. 2019 à 10:27, Karsten Kusche <karsten at heeg.de> a écrit :
> 
> Precisely my thinking! try to avoid concurrency as much as possible and if you _really_ have to use it, try a queue approach. 
> 
> Georg Heeg eK
> Wallstraße 22
> 06366 Köthen
> 
> Tel.: 03496/214328
> FAX: 03496/214712
> Amtsgericht Dortmund HRA 12812
> 
> Am 5. September 2019 um 09:34:25, Tim Mackinnon (tim at testit.works <mailto:tim at testit.works>) schrieb:
> 
>> 
>> Not to sound flippant - but do everything you can to limit where you use concurrency (and if possible, not at all). It adds lots of complication that often isn’t necessary.
>> 
>> Where you do need it, queue results or commands and then have workers to process those - workers, queues and commands put you back into easily testable territory.
>> 
>> Then you are left with the concurrent bit - hopefully now quite tiny and specific, which you you can normally blast and test if you have concurrency hole - but in the realms of can it queue things up in an orderly fashion and dequeue them as well. Deep code inspection on this is also helpful (albeit manual).
>> 
>> Tim
>> 
>> Sent from my iPhone
>> 
>> On 4 Sep 2019, at 14:55, John M McIntosh <johnmci at smalltalkconsulting.com <mailto:johnmci at smalltalkconsulting.com>> wrote:
>> 
>>> This was useful in doing our single threaded JavaScript to Multi-threaded Swift IOS platform code http://reactivex.io <http://reactivex.io/>
>>> 
>>> 
>>> 
>>> 
>>> ....
>>> John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk <https://www.linkedin.com/in/smalltalk>
>>> 
>>> 
>>> Sent from ProtonMail Mobile
>>> 
>>> 
>>> On Wed, Sep 4, 2019 at 15:32, N. Bouraqadi <bouraqadi at gmail.com <mailto:bouraqadi at gmail.com>> wrote:
>>>> 
>>>> Hi everyone,
>>>> 
>>>> Can I get your input on the following questions :
>>>> 
>>>> - What are your best practices and recommendations for developing and testing concurrent software?
>>>> 
>>>> - How to discover need for synchronization/critical sections/ when doing TDD?
>>>> 
>>>> - How to write code to avoid dead-locks?
>>>> 
>>>> Thanks for your help,
>>>> Noury
>>>> _______________________________________________
>>>> Esug-list mailing list
>>>> Esug-list at lists.esug.org <mailto:Esug-list at lists.esug.org>
>>>> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org>
>>> 
>>> 
>>> _______________________________________________
>>> Esug-list mailing list
>>> Esug-list at lists.esug.org <mailto:Esug-list at lists.esug.org>
>>> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org>
>> _______________________________________________ 
>> Esug-list mailing list 
>> Esug-list at lists.esug.org <mailto:Esug-list at lists.esug.org> 
>> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org> 
> _______________________________________________
> Esug-list mailing list
> Esug-list at lists.esug.org <mailto:Esug-list at lists.esug.org>
> http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org <http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.esug.org/pipermail/esug-list_lists.esug.org/attachments/20190905/22e6e2a8/attachment-0001.html>


More information about the Esug-list mailing list