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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: About good practice: Should protected objects be small? Date: Fri, 20 Oct 2017 21:27:38 +0300 Organization: Tidorum Ltd Message-ID: References: <5b65b9f0-25d9-449a-b7eb-d1fc112f293f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net BSQZ1T8xQuJ84bS3D567uQm+HQSrkkhw32lUhslj0oYOWMUQTW Cancel-Lock: sha1:A4q0TLg4yrGyW8VkPBvYLwXo8CE= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <5b65b9f0-25d9-449a-b7eb-d1fc112f293f@googlegroups.com> Xref: news.eternal-september.org comp.lang.ada:48533 Date: 2017-10-20T21:27:38+03:00 List-Id: 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 . @ .