From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: STM32F4 Discovery, communication and libraries Date: Wed, 10 Sep 2014 20:37:30 +0200 Organization: cbb software GmbH Message-ID: <1vjicwspej0wp.18yi5ex9b9ld6.dlg@40tude.net> References: <60a42dc6-d8d0-4432-ae5a-86de18b82840@googlegroups.com> <5kkrv9hejn2qhdckkeo8lidkbh3bkme1gn@4ax.com> <5b91313c-acf9-4a6e-b157-6ba7c8021567@googlegroups.com> <0513ad07-6fbe-463a-be6f-097cd5113f52@googlegroups.com> <4f1ec65a-d66a-40bf-a0d6-278fde206e70@googlegroups.com> <1cjwzr30b24xy.11kpydntxhfo5$.dlg@40tude.net> <929e9226-e4aa-474e-843c-68ed800eefad@googlegroups.com> <5b5583ca-c7b2-40be-9090-6253f0514db5@googlegroups.com> <7feccd2d-dcfd-405e-ae5d-e27d6662daa9@googlegroups.com> <854mwfwonu.fsf@stephe-leake.org> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: ZB2Fb2q1fa4xpMpNKFqV6Q.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:188955 Date: 2014-09-10T20:37:30+02:00 List-Id: On Wed, 10 Sep 2014 10:46:49 -0700, Jeffrey Carter wrote: > On 09/10/2014 07:11 AM, Stephen Leake wrote: >> Way overkill. Global variables is all you need. > > While a publish/subscribe mechanism is probably overkill, global variables > should never be used. Global variables are a guaranteed way to make your S/W > hard to understand and modify. Not really overkill. Much depends on the protocol role the application must play. If the application is a master it could control slaves from the main control loop, forcing them to send or accept data. But if it is a slave, many protocols require slaves or are time triggered or are not client-server at all, then it has no say when data arrive or go. A publisher/subscriber service resolves this. The global variables pool does this too, but it has issues with data consistency, e.g. logically coherent variables, one updated, one not. Even bigger problems arise with non-physical valued variables, when you must handle each variable update. All commands are like that. With global variables it quickly ends up with toggle bits and other mess. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de