comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: What do you think about this?
Date: Wed, 24 Jun 2015 05:17:04 -0500
Date: 2015-06-24T05:17:04-05:00	[thread overview]
Message-ID: <86oak5qulb.fsf@stephe-leake.org> (raw)
In-Reply-To: dddbc06b-c30f-4923-85b6-f3a378982238@googlegroups.com

Laurent <lutgenl@icloud.com> writes:

> On Tuesday, 23 June 2015 16:21:17 UTC+2, Stephen Leake  wrote:
>> I did not download and compile it, but I did browse around it a bit.
>
> That's why I like git.

More precisely, the web front-end to git. Many other source code
management systems have similar web front-ends.

>>What is the whole thing supposed to do?
>
> It is supposed to generate something like this:
>

This should be included in a document in the git repository.

The first step in building a software system is having a clear
description of what it is supposed to do. These are formally called
"requirements"; it is a mantra at NASA that "an engineer does not have a
job until s/he has requirements".

> <snip packet>
> And then write it in a text file.

That's not what you state below.

>
>
> The hospital I work for has acquired a new software for epidemical
> surveillance. I work in the lab in the microbiology department and I
> have been asked to verify the transmission of the results from the
> analyzer to the software used by the nurses/docters.
>
> I have 3 possibilities to do that:
>
> 1) launch tests but that takes 24hrs and I have no influence on the result
> 2) use existing tests and rename them. Which means I have to tinker
> around with results of actual patients. Is bad because of the iso
> certification which requires everything to be traceable. No influence
> on the result
> 3) write a program which generates textfiles with random results which
> I can copy into the transfer folder on the analyzer.

If your requirement is to verify only the transmission of the data, not
the generation of the data from actual patients, then 3 is clearly the
correct choice.

But above you stated your requirement as "generate a text file with a
particular format". Perhaps you have divided up your task into subtasks,
and were talking about a subtask above.

How are you going to compare the test text file to the data recieved by
the "software used by the nurses/doctors"?

>>but it lacks comments
>
> Yup something I have to improve. In this case the program is only used
> by me and quite probable only once.

No program that is paid for will ever be used "only once". In your case,
the analyzer will be upgraded, and the nurse/doctor software will be
upgraded (or either will be replaced). That will require this test to be
done again.

Even if it turns out to be used "only once", writing good comments is
still a good idea. You might get run over by a bus, and someone else
will have to take over. You might be interrupted for a longish time, and
forget the design details.

Good comments are also an extension of the requirements documentation;
they help clarify the design of the software, so you understand it better.

At a minimum, there should be a reference to the analyzer document that
defines the text file format.

>>... it is better to return a String; then the caller can just use it
>> without conversion, or declare a >local variable to hold it.
>
> Well without the "+" conversion function I would agree because the
> To_Bound... thing is annoying.

Yes, but the use of "+" can hide inefficiencies.

> For the last part I don't understand what you mean. In the main file I
> have the function Make_File_Name where File_Name is local variable. If
> it is of type String or the custom V_String, where is the difference?
> Ok I have to convert it later in procedure Generate. Requires an
> additional "+". I find it is a quite good tradeoff for the flexibility
> it offers me.

I'm probably arguing for premature optimization. On the other hand, your
V_String package has an upper bound on string length, which you might
hit at some point.

Learning how to use plain Ada String properly is a useful tool; it helps
avoid many pitfalls.

> For the CMI I would have preferred to use enumerations but that
> doesn't seem to be possible:
>
> CMI_Type is ("<=1","0,004","3"); or CMI_Type is ("1","2","3");

This is not an enumeration; it is an aggregate of strings. In Ada you
can do this as:

type CMI_Type is array (Integer range <>) of access constant String;

CMI_1 : constant CMI_Type := (+"<=", +"0,004", +"3");

where "+" is:

function "+" (Item : in String) return (new String'Item);


> but that works CMI_Type is ('1','2','3'); ?

This defines a new character type.

An enumeration type would be:

type CMI_Type is (One, Two, Three);

There are probably better names for these. And you probably need
something other than CMI_Type'Image (foo) in the output text file. You
can define an array:

type CMI_Image_Type is array (CMI_Type) of access constant String;
CMI_1 : constant CMI_Image_Type := (+"<=", +"0,004", +"3");

or a function:

function Image (Item : in CMI_Type) return String is return
(case Item is
 when One => "<=1",
 when Two => "0,004",
 when Three => "3");


--
-- Stephe


  parent reply	other threads:[~2015-06-24 10:17 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21 18:38 Is there an easier way for this? Laurent
2015-06-21 19:15 ` Niklas Holsti
2015-06-21 19:41   ` Laurent
2015-06-21 19:25 ` Jeffrey R. Carter
2015-06-21 19:42   ` Laurent
2015-06-22 12:23   ` Laurent
2015-06-22 15:01     ` G.B.
2015-06-22 15:40       ` Laurent
2015-06-22 16:47     ` Jeffrey R. Carter
2015-06-22 16:41   ` Laurent
2015-06-22 16:47     ` Jeffrey R. Carter
2015-06-22 17:18       ` Laurent
2015-06-22 18:04         ` What do you think about this? Laurent
2015-06-23 14:21           ` Stephen Leake
2015-06-23 19:51             ` Laurent
2015-06-23 20:20               ` Anh Vo
2015-06-23 21:03                 ` Laurent
2015-06-23 22:17                   ` Shark8
2015-06-24  5:57                     ` Anh Vo
2015-06-24  7:58                       ` Laurent
2015-06-24 21:06                       ` Laurent
2015-06-24 21:45                         ` Anh Vo
2015-06-24 21:59                           ` Laurent
2015-06-24 22:35                           ` Simon Wright
2015-06-24 22:59                             ` Laurent
2015-06-25  2:56                               ` Anh Vo
2015-06-25  7:29                               ` Simon Wright
2015-06-25 16:55                                 ` Anh Vo
2015-06-25 17:27                                   ` Simon Wright
2015-06-25 18:13                                 ` Laurent
2015-06-25 18:36                                   ` Simon Wright
2015-06-24 23:10                             ` Anh Vo
2015-06-24 10:17               ` Stephen Leake [this message]
2015-06-24 17:20                 ` Jeffrey R. Carter
2015-06-24 20:50                   ` Laurent
2015-06-24 22:30                     ` Jeffrey R. Carter
2015-06-24 22:52                       ` Laurent
2015-06-27 17:12                       ` Laurent
2015-06-27 17:43                         ` Jeffrey R. Carter
2015-06-27 17:47                         ` J-P. Rosen
2015-06-27 18:54                         ` Simon Wright
2015-06-27 19:37                           ` Laurent
2015-06-27 19:47                             ` Jeffrey R. Carter
2015-06-27 20:39                             ` Simon Wright
2015-06-28  4:45                             ` J-P. Rosen
2015-06-28 14:08                         ` Stephen Leake
2015-06-28 16:10                           ` Laurent
2015-06-25 13:16                   ` Stephen Leake
2015-06-25 17:20                     ` Jeffrey R. Carter
2015-07-02 21:51                       ` Randy Brukardt
2015-07-03 12:31                         ` Stephen Leake
2015-07-03 17:11                           ` Laurent
2015-07-03 17:46                             ` Jeffrey R. Carter
2015-07-03 18:49                               ` Laurent
2015-07-04  3:26                                 ` Randy Brukardt
2015-07-03 19:17                             ` Simon Wright
2015-07-04  3:30                               ` Randy Brukardt
2015-07-04  4:19                                 ` Laurent
2015-07-04  7:43                                   ` Simon Wright
2015-07-04  9:07                                     ` Laurent
2015-07-04  7:42                                 ` Simon Wright
2015-07-05  0:56                                   ` Randy Brukardt
2015-07-03 17:35                           ` Randy Brukardt
2015-07-05 13:55                             ` Stephen Leake
2015-07-06 20:07                               ` Randy Brukardt
2015-06-24 20:21                 ` Laurent
2015-06-21 19:38 ` Is there an easier way for this? Pascal Obry
2015-06-21 19:54   ` Laurent
2015-06-21 20:39     ` Pascal Obry
2015-06-24  7:14 ` gautier_niouzes
2015-06-24 21:08   ` Laurent
replies disabled

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