comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: About good practice: Should protected objects be small?
Date: Fri, 20 Oct 2017 21:27:38 +0300
Date: 2017-10-20T21:27:38+03:00	[thread overview]
Message-ID: <f4utgrF6jsmU1@mid.individual.net> (raw)
In-Reply-To: <5b65b9f0-25d9-449a-b7eb-d1fc112f293f@googlegroups.com>

On 17-10-20 17:50 , reinert wrote:
> I am testing out using protected objects.
>
> Is it reasonable good practice to keep protected objects small?
> It seems like for me (?) and stubs ("is separate") is not allowed there.

Protected operations limit concurrency, which (in some cases) can limit 
the performance of multi-tasking programs.

I aim to keep the worst-case execution time (WCET) of protected 
subprograms as small as possible. However, what is "small enough" is 
application-specific.

In some cases, the data structures and subprograms that need protection 
(i.e. need mutually exclusive access) are naturally largish, and 
reducing the WCET of the subprograms would be possible only by 
significant complication of the data structures and calling sequences. 
If the natural structures are fast enough, the extra complication is not 
worth it.

If your concern is the size of a protected object in terms of the number 
of source lines of code, do remember that you can call out from a 
protected subprogram to ordinary subprograms, which can be separate. Of 
course you must then pass the protected private data as parameters to 
those subprograms. (Sometimes unit-testing tools force this kind of 
structure anyway, becase the private parts of a PO may not be visible to 
the tool.)

For me, the source-code size of a protected object is not a special 
worry, no more than the size of a package or a subprogram -- ordinary 
principles of readability, modularity, etc. apply.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

  reply	other threads:[~2017-10-20 18:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 14:50 About good practice: Should protected objects be small? reinert
2017-10-20 18:27 ` Niklas Holsti [this message]
2017-10-20 19:21   ` Dmitry A. Kazakov
2017-10-21  4:12   ` reinert
2017-11-06  5:41 ` Robert Eachus
2017-11-06  8:27   ` Niklas Holsti
2017-11-12  4:16     ` Robert Eachus
replies disabled

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