[comp.lang.ada] Design/Development questions

dennis@tfsg.UUCP (Dennis Gibbs) (06/06/90)

<>

I have a couple of hypothetical questions regarding C and Ada:

1) If you have a software design, all things  being equal, if you implement
   the design in both Ada and C, which implementation will have the highest
   number of lines of code, the C implementation or the Ada implementation?
   How much percentage-wise(more or less) on  average, would the difference
   be?

2) I remember  seeing various  studies that  show the length of time spent
   developing software  systems from  the earliest design  stages to final
   delivery.  Again, in a perfect world, would  it take more  or less time
   to  design and develop in  Ada vs. C?  I am  excluding the maintenance/
   enhancement phase in  this question.  If I recall I believe I have seen
   studies somewhere that  show that  it takes  the same  amount  of  time
   overall to design and develop in Ada vs. other languages, but that more
   time is spent in design and less spent in coding for Ada.  Can  someone
   direct me to any studies that investigate this issue?

I do not wish to start  more C vs. Ada flame wars again, my purpose is  to
start an informative, educational discussion on this subject....

Dennis Gibbs
...uunet!tfsg!dennis
(703) 802-1961

jamesth@microsoft.UUCP (James THIELE) (06/07/90)

In article <677@tfsg.UUCP> dennis@tfsg.UUCP (Dennis Gibbs) writes:
>I have a couple of hypothetical questions regarding C and Ada:

[High-level questions asking for value judgements on C and Ada deleted]

>I do not wish to start  more C vs. Ada flame wars again, my purpose is  to
>start an informative, educational discussion on this subject....

Given the recent history of this group, expect flame wars...

>Dennis Gibbs
>...uunet!tfsg!dennis
>(703) 802-1961

James Thiele -- microsoft!jamesth

RCAPENER@cc.utah.edu (06/07/90)

In article <677@tfsg.UUCP>, dennis@tfsg.UUCP (Dennis Gibbs) writes:
> <>
> 
> I have a couple of hypothetical questions regarding C and Ada:
> 
> 1) If you have a software design, all things  being equal, if you implement
>    the design in both Ada and C, which implementation will have the highest
>    number of lines of code, the C implementation or the Ada implementation?
>    How much percentage-wise(more or less) on  average, would the difference
>    be?

Well, you said it, all things probably are equal, including the lines
of code.  Some C programmers put the '{' at the end of the line, and
the others put it underneath the 'if', 'else', 'switch', et al.  It
SEEMS like they are about equal to me.

> 2) I remember  seeing various  studies that  show the length of time spent
>    developing software  systems from  the earliest design  stages to final
>    delivery.  Again, in a perfect world, would  it take more  or less time
>    to  design and develop in  Ada vs. C?  I am  excluding the maintenance/
>    enhancement phase in  this question.  If I recall I believe I have seen
>    studies somewhere that  show that  it takes  the same  amount  of  time
>    overall to design and develop in Ada vs. other languages, but that more
>    time is spent in design and less spent in coding for Ada.  Can  someone
>    direct me to any studies that investigate this issue?
> 

This is a real thorny question, since Ada can provide far more protection
to the programmer than C does.  But on the other hand, many programmers
who code in C don't want to code in Ada, and vice-versa.  There are some
absolutely brilliant programmers coding in C because they prefer more
freedom to create (or hang themselves).  It seems the time spent is in
direct proportion to how modular (or better, object oriented) a language
is.  The more modular it is, the more reusable the code is, and the less
you have to totally rewrite anything.

> I do not wish to start  more C vs. Ada flame wars again, my purpose is  to
> start an informative, educational discussion on this subject....
> 

Awww, why not?  Do you really want a dry, dull, drab world?

Now that I have added my two bits on the above, all of which is totally
and purely subjective, I have a question to ask people on the net.
In VAX-Ada, the GET and the GET_LINE procedures have the very
disconcerting behavior that when you get a string, you must enter
the EXACT number of characters the string is declared for.  Is this
behavior part of the LRM?  Does anyone in NetLand have the equivalent
of C's fgets for strings in Ada?  Any input (pun intended) on solving
this problem will be appreciated.

kassover@minerva.crd.ge.com (David Kassover) (06/09/90)

In article <67999@cc.utah.edu> RCAPENER@cc.utah.edu writes:

...
>Now that I have added my two bits on the above, all of which is totally
>and purely subjective, I have a question to ask people on the net.
>In VAX-Ada, the GET and the GET_LINE procedures have the very
>disconcerting behavior that when you get a string, you must enter
>the EXACT number of characters the string is declared for.  Is this
>behavior part of the LRM?  Does anyone in NetLand have the equivalent
>of C's fgets for strings in Ada?  Any input (pun intended) on solving
>this problem will be appreciated.

We use, generally, the following interface to get_line, from
package text_io, as shown in
sys$sysroot:[syslib.adalib]text_io_.adc


           procedure GET_LINE(FILE : in FILE_TYPE; ITEM : out STRING;
			      LAST : out NATURAL);

LAST tells me how long the string actually is, We use this to load
the string into the composite data structures we have built to
actually manipulate strings

Item must, of course, be long enough to handle any anticipated
string, otherwise, presumably, we'd get a CONSTRAINT_ERROR or
some such at run time.  (Which means something has corrupted our
files, or we really do need to make our strings bigger)

This is probably not iron_clad.  We have not yet had to deal with
string lengths outside the range 0..256

I'm not near the manuals, so I can't tell if DEC considers this
standard or an allowable interpretation.

As far as dealing with C strings, we have routines that convert a
C string to our Vstring, and vice versa.  These routines are
applied to the appropriate strings at the point where we call the
C routines.
--
David Kassover             "Proper technique helps protect you against
kassover@ra.crd.ge.com	    sharp weapons and dull judges."
kassover@crd.ge.com			F. Collins

bhanafee@ADS.COM (Brian Hanafee) (06/09/90)

In article <67999@cc.utah.edu> RCAPENER@cc.utah.edu writes:
[stuff on a different topic deleted]

>In VAX-Ada, the GET and the GET_LINE procedures have the very
>disconcerting behavior that when you get a string, you must enter
>the EXACT number of characters the string is declared for.  Is this
>behavior part of the LRM?  Does anyone in NetLand have the equivalent
>of C's fgets for strings in Ada?  Any input (pun intended) on solving
>this problem will be appreciated.

As I (not a lawyer) interpret this, the behavior is correct for Get,
but incorrect for Get_Line.  The sections of the LRM I'm looking at
are 14.3.6/9 and 14.3.6/13. (If you're talking about some other
version of Get, then ignore this; this is the version to Get strings
from files).
14.3.6/9 states (for Get):
	"Determines the length of the given string and attempts that
	number of GET operations for successive characters of the
	string (in particular, no operation is performed if the string
	is null)."

14.3.6/13 states (for Get_Line):
	"...Reading stops if the end of the line is met...reading also
	stops if the end of the string is met.  Characters not
	replaced are left undefined."

Brian

kim@wacsvax.cs.uwa.OZ.AU (Kim Shearer) (06/09/90)

In <677@tfsg.UUCP> dennis@tfsg.UUCP (Dennis Gibbs) writes:


><>

>I have a couple of hypothetical questions regarding C and Ada:

>1) If you have a software design, all things  being equal, if you implement
>   the design in both Ada and C, which implementation will have the highest
>   number of lines of code, the C implementation or the Ada implementation?
>   How much percentage-wise(more or less) on  average, would the difference
>   be?

>2) I remember  seeing various  studies that  show the length of time spent
>   developing software  systems from  the earliest design  stages to final
>   delivery.  Again, in a perfect world, would  it take more  or less time
>   to  design and develop in  Ada vs. C?  I am  excluding the maintenance/
>   enhancement phase in  this question.  If I recall I believe I have seen
>   studies somewhere that  show that  it takes  the same  amount  of  time
>   overall to design and develop in Ada vs. other languages, but that more
>   time is spent in design and less spent in coding for Ada.  Can  someone
>   direct me to any studies that investigate this issue?

>I do not wish to start  more C vs. Ada flame wars again, my purpose is  to
>start an informative, educational discussion on this subject....

>Dennis Gibbs
>...uunet!tfsg!dennis
>(703) 802-1961

 Question 1 is a little bit curly. If you are trying to do something
 low level or involving pointer manipulation .. then C will produce
 shorter code for sure. C will generally have less lines of code
 anyway. However there are times when Ada will produce less lines
 of code. The main point to note here is that Ada is generally 
 easier to read. Here I am talking about large ongoing projects
 where the same person does not always work on the same code.

 Question 2 is a godd one. Personally I work in C, as the code I
 write is for my consumption at a University. If I was doing
 a large scale commercial projects I would use Ada. I believe that 
 Ada gives you solid code, that will stand the test of time and
 generally waste less time on silly or obscure bugs. Ada is
 simple to read and write and provides a level of abstraction
 suited to most applications in the real world.

+--------------------------------+--------------------------------------------+
Kim Shearer                      |     ARPA: kim%wacsvax.uwa.oz@uunet.uu.net
Dept. of Computer Science        |     UUCP: ..!uunet!munnari!wacsvax!kim
University of Western Australia  |     ACSnet: kim@wacsvax.uwa.oz       
CRAWLEY, Australia 6009          |     PHONE:  +61 9 380 3452 
+--------------------------------+--------------------------------------------+