comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Derived private interface
Date: Wed, 10 Aug 2011 17:21:37 -0500
Date: 2011-08-10T17:21:37-05:00	[thread overview]
Message-ID: <j1v09k$gau$1@munin.nbi.dk> (raw)
In-Reply-To: b6049447-8479-46ca-82e8-b6031a4b4d1a@q15g2000yqk.googlegroups.com

"Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message 
news:b6049447-8479-46ca-82e8-b6031a4b4d1a@q15g2000yqk.googlegroups.com...
On Aug 9, 11:35 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:

>> I don't see any dependency inversion in the web server. (The web server
>> calls packages to evaluate particular commands or operations -- that's 
>> how
>> almost all programs work!)
>
>The dependency inversion is in the fact that the web server does not
>have to know the modules it is calling. It is enough if the modules
>know the web server (and its registry, to be exact) - thanks to this
>new modules can be added without touching the web server itself
>(that's the open/close principle at work now). What is needed for the
>dependency inversion to work is a spec of something common - in the
>case of OOP this is an interface.

But adding new modules without somehow modifying the web server is simply 
not allowed in the problem statement that I had (that is, all code that the 
server can execute is statically compiled into the web server). So there can 
be no "inversion" here -- some piece of the server needs to know about all 
of the code that it possibly can execute. (Ada requires with clauses at a 
minimum.)

>> This sounds more like a case of trying to make
>> everything look like a nail (to the OOP hammer).
>
>No, this is trying to reduce the effort to maintain a heavy component
>that is tested and verified only once.

I have no idea what you are talking about; no part of my web server (other 
than the case statement) is modified to add a new capability. [Note that 
something list the case statement has to exist in the OOP model anyway - ,at 
a minimum for with clauses and a series of registration calls (there is 
insufficient control over elaboration in Ada to use elaboration for that 
purpose in a real system).]

I can explain the mechanism in a bit more detail. The web server has a data 
list of (normalized) URLs that require special handling, along with a 
special handling key. When the web server sees any of these, it calls the 
special handling interface routine (passing the record containing the GET 
parameters and the output socket). Otherwise, it tries to serve a normal web 
page.

The special handling interface contains a case statement on the special 
handling keys, and calls the appropriate handler for each one. Since the 
original requirement was for all of the code to be statically compiled, that 
code is also part of the web server executable, and of course the special 
handling interface needs to be modified to add a new module. But it (and the 
data table) are the only things that need modification in this scenario.

An OOP design would have been identical (the data table was intended to be 
modified "on the fly", although we never needed that capability and thus 
never implemented it - the data is just an Ada aggregate currently), with 
the exception that the case statement would be replaced by a registration 
routine that gathered all of the units together. I fail to see how that 
would have improved anything about the design.

It would, however, have provided an easier way to make the design far more 
complex (and less maintainable, IMHO), by adding interfaces to support 
dubious capabilities (and thus changing the behavior of the core web 
server), rather than funneling everything through the interface.

                                   Randy.









  parent reply	other threads:[~2011-08-10 22:21 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05  3:14 Derived private interface Rego, P.
2011-07-05  5:10 ` AdaMagica
2011-07-06  2:24   ` Rego, P.
2011-07-06  4:34   ` AdaMagica
2011-07-06  7:55     ` Georg Bauhaus
2011-07-06  8:30       ` AdaMagica
2011-07-06 12:59         ` Georg Bauhaus
2011-07-06 13:23           ` AdaMagica
2011-07-06 19:06             ` Randy Brukardt
2011-07-06 13:28           ` Simon Wright
2011-07-06 19:45           ` Randy Brukardt
2011-07-06 22:05             ` Georg Bauhaus
2011-07-06 23:56               ` Adam Beneschan
2011-07-07 14:09                 ` Georg Bauhaus
2011-07-07 15:10                   ` Adam Beneschan
2011-07-08  4:29                     ` AdaMagica
2011-07-08 19:08                       ` Randy Brukardt
2011-07-08 19:12                     ` Randy Brukardt
2011-07-07 15:19                   ` Georg Bauhaus
2011-07-07 10:37         ` Stephen Leake
2011-07-07 13:18           ` Georg Bauhaus
2011-07-08 19:23             ` Randy Brukardt
2011-07-08 21:41               ` Jeffrey Carter
2011-07-09  6:14                 ` Dmitry A. Kazakov
2011-07-22 22:59                 ` Randy Brukardt
2011-07-23  7:30                   ` Jeffrey Carter
2011-07-23  9:29                     ` Maciej Sobczak
2011-07-23 10:07                     ` Dmitry A. Kazakov
2011-07-26 21:04                     ` Randy Brukardt
2011-07-26 23:43                       ` Jeffrey Carter
2011-07-27 23:56                         ` Randy Brukardt
2011-07-28  0:18                           ` Jeffrey Carter
2011-07-28 10:06                         ` Maciej Sobczak
2011-07-28 23:24                           ` Randy Brukardt
2011-07-29  6:45                             ` Simon Wright
2011-07-30  0:04                               ` Randy Brukardt
2011-07-30  6:32                                 ` Simon Wright
2011-08-01  9:30                                   ` Alex R. Mosteo
2011-08-01 10:12                                     ` Dmitry A. Kazakov
2011-08-01 21:56                                       ` Randy Brukardt
2011-08-02 10:03                                         ` Dmitry A. Kazakov
2011-08-02 21:16                                           ` Randy Brukardt
2011-08-03  9:01                                             ` Dmitry A. Kazakov
2011-08-03 20:16                                               ` Randy Brukardt
2011-08-04  8:15                                                 ` Dmitry A. Kazakov
2011-08-09 21:10                             ` Maciej Sobczak
2011-08-09 21:35                               ` Randy Brukardt
2011-08-10  9:11                                 ` Dmitry A. Kazakov
2011-08-10 21:56                                   ` Randy Brukardt
2011-08-11  8:07                                     ` Dmitry A. Kazakov
2011-08-12  4:52                                       ` Randy Brukardt
2011-08-12  8:54                                         ` Dmitry A. Kazakov
2011-08-10 10:07                                 ` Maciej Sobczak
2011-08-10 11:26                                   ` Georg Bauhaus
2011-08-10 22:27                                     ` Randy Brukardt
2011-08-10 22:21                                   ` Randy Brukardt [this message]
2011-08-11 13:50                                     ` Maciej Sobczak
2011-08-12  4:43                                       ` Randy Brukardt
2011-08-12  7:00                                         ` Maciej Sobczak
2011-08-12 21:59                                           ` Randy Brukardt
2011-07-06 15:06       ` Adam Beneschan
2011-07-06 16:36       ` Dmitry A. Kazakov
2011-07-06 19:20       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox