Fwd: Here's how to remove 'time' from a processing problem

Dimitre Novatchev <[email protected]> Wed, 21 Dec 2022 12:25:10 -0800
Newsgroups gmane.text.xml.devel
Message-ID <CAK4KnZcctZcCyW_3NCjBSO+Jk7y688PeM9RCAdUywetsZuhomA@mail.gmail.com>
---------- Forwarded message ---------
From: Dimitre Novatchev <[email protected]>
Date: Wed, Dec 21, 2022 at 8:30 AM
Subject: Re: [xml-dev] Here's how to remove 'time' from a processing problem
To: Roger L Costello <[email protected]>


Just run the simple transformation periodically with a Runner, that is not
an XSLT program. Like using Windows Task Scheduler.

From a software engineering standpoint this is probably an optimal design:

   -   There is almost no (0) coupling between the Transformer application
and the Runner. The Transformer just does a simple thing once and doesn't
even know that it is invoked periodically by a Runner - doesn't know
anything about anything called a "Runner".

   -  The Runner doesn't know anything specific about what the Transformer
is and what it is actually doing. For the Runner the Transformer is just
one of many regular tasks (maybe defined in a database table) to invoke
regularly within a specified period and with specified parameters.

This achieves simplicity, loose coupling and low complexity. As the parts
are small and simple, there is a lesser probability that something could go
wrong within each of the parts, thus we also achieve greater reliability.

A more complex design would be to implement an IObservable (the thing that
confirms the threat)   and an IObserver that is subscribed for the
occurrence of a particular event (an occurrence of a threat). See
https://en.wikipedia.org/wiki/Observer_pattern

AFAIK the XPath and XSLT languages at present do not allow for an easy and
elegant way of implementing this design pattern.

Thanks,
Dimitre

On Wed, Dec 21, 2022 at 8:02 AM Roger L Costello <[email protected]> wrote:

> Hi Peter,
>
> You don't like my fictitious Car.xml/PoliceReport.xml example? Bummer.
>
> Okay, then here's an actual, real-world example. It is an exact analog of
> the Car.xml/Police.xml example, albeit a bit more complex.
>
> A radar scans the sky and detects an object. The radar saves the
> information about the object to an XML file and stores the file in a folder
> (along with other files that it has stored for other objects):
>
> <Object id="XYZ">
>     <Location>
>         <Latitude>10</Latitude>
>         <Longitude>20</Longitude>
>         <Elevation>100</Elevation>
>     </Location>
>     <DateTime>...</DateTime>
>     -- other info --
> </Object>
>
> At some point a program reads in that XML document and begins processing
> it. The objective of processing is to output an alert if the object
> represents an enemy aircraft and "" (benign object) otherwise. However, the
> program determines that the document does not contain sufficient
> information to make a decision. The information to make the decision
> arrives some time later, in another document (the radar has subsequently
> collected additional information about the object):
>
> <UpdatedInfo>
>     <Object id="XYZ">
>         <FlightProfile>......<FlightProfile>
>     </Object>
> </PoliceReport>
>
> So the desired processing behavior is this:
>
> Read the next XML document.
> If the XML document contains data about an object and there is
> insufficient information to process it then
>     Wait until more info about the object arrives ....
>     .......... time elapses ........... the updated
>     info arrives: analyze the new info and
>     if it indicates the object is an enemy aircraft then
>     output an alert message else output ""
>
> That algorithm involves dealing with time.
>
> Here's how to eliminate time from the equation.
>
> -- As I described earlier --
>
> /Roger
>




-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.