Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #78675

Re: Program to compute the amount of bottles of water...

From Steve Thompson <stevet810@gmail.com>
Newsgroups comp.lang.c
Subject Re: Program to compute the amount of bottles of water...
Date 2015-12-14 05:24 +0000
Organization Friends of the Galactic Collective
Message-ID <Hja520.XzJ.BBsgr@gmail.com> (permalink)
References (5 earlier) <n4k8m2$s45$1@dont-email.me> <209085bf-79df-4914-b393-8034eec2235a@googlegroups.com> <7dccf87d-baf7-46c3-8caa-a359d11f65f4@googlegroups.com> <c71efec2-e460-4342-9cf7-c360f9a716ec@googlegroups.com> <n4kh68$vrs$1@dont-email.me>

Show all headers | View raw


On Sun, Dec 13, 2015 at 07:35:57PM +0000, Richard Heathfield wrote:
> On 13/12/15 18:43, Alla _ wrote:
> 
> <snip>
> 
> >I also don't think that programmers create algorithms:
> 
> You are mistaken.
> 
> >if I am correct, mathematicians create certain sophisticated algorithms 
> >(like
> >the sorting ones), and programmers implement them in a given language.
> 
> The obvious counter-example is quicksort, which was invented by C A R 
> Hoare, whose academic background was in Classics and Philosophy.
> 
> It is perhaps in order to reflect on what an algorithm actually is.
> 
> Following Knuth, we can define an algorithm as follows:
> 
> An algorithm is a finite set of rules that gives a sequence of 
> operations for solving a specific type of problem, and having the 
> following characteristics:
> 
> 1) Finiteness - an algorithm must always terminate after a finite number 
> of steps.
> 2) Definiteness - each step of an algorithm must be precisely defined.
> 3) Input - an algorithm has zero or more inputs, quantities that are 
> given to it initially before the algorithm begins, or dynamically as the 
> algorithm runs.
> 4) Output - an algorithm has one or more outputs: quantities that have a 
> specified relation to the inputs.
> 5) Effectiveness - an algorithm is also generally expected to be 
> effective, in the sense that its operations must all be sufficiently 
> basic that they can in principle be done exactly and in a finite length 
> of time by someone using pencil and paper.
> 
> For example, if you asked me to solve the problem of printing the vowels 
> (and only the vowels) of an English word, I could develop an algorithm 
> as follows:
> 
> Algorithm A: copy the vowels of an English word w to location y
> 
> Step 1: set n to number of letters in w
> Step 2: set s to 0
> Step 3: set t to 0
> Step 3: if s = n proceed from Step 9
> Step 4: if w[s] is not in the set { a, e, i, o, u }
>         then proceed from Step 7.
> Step 5: set y[t] to w[s]
> Step 6: set t to t + 1
> Step 7: set s to s + 1
> Step 8: proceed from Step 3.
> Step 9: terminate. The result is in y.
> 
> And that's an algorithm, even though I'm not a mathematician.
> 
> Whenever you solve a problem in a well-defined, finite way, you are 
> creating an algorithm. One might reasonably say that the job of the 
> computer programmer is to devise algorithms (and then to implement them 
> in a programming language).

Alternately one may make a distinction between computer science and
software engineering.  The fields have considerable overlap, but it
should be obvious that the engineering constraints of a real-world
application are one thing while the constraints driving a computer
scientist with his algorithm may be something else entirely.

One of the things about learning C which has bothered me immensely is
the difference between the trivial learning example and what often
ends up being required for "real" programming.  The great gulf
separating the design constraints of the learning example and the
non-trivial application of an algorithm or programming technique is
not in any way a trifling matter.

It is possible I would not be quite so jaded and disillusioned had I
not ended up learning C from one half-assed book in my youth and later
from compiler diagnostics and a whole lot of barely readable code
programmers had released into the wild as "done".  To the last point
it seems to me that a considerable fraction of programmers are of a
mind to consider that needlessly obscure or complex code constructions
as a barrier to understanding are something of a right of passage into
the "mysteries" of computer programming, making the programming
avocation into something of a priesthood of the elite -- those who
have transcended the (quasi-invisible) barriers and attained a certain
Enlightenment.

Fortunately that attitude is not universal and there remain a subset
of computer programmers who strive for clarity in all things.  To that
end simplicity is the watchword, but as luck would have it simplicity
is not synonymous with easy, and may be quite difficult to attain in
practice.  I suggest it is the province of tooling to make simplicity
easier to attain without necessarily sacrificing capability or
correctness.



Regards,

Steve Thompson

-- 
"The civil war in Spain is being carried on with extreme brutality on
both sides, is being prolonged by the support of foreign States
professing a policy of non-intervention, and has led to a recru-
descence of piracy.  In Russia nad in Germany alike, whatever be the
differences in ideologies, we find regimes which rest ultimately on
force, which shrink from no kind of persecution, which, if the Howard
League is to be credited, are reintroducing torture into their
political machinery, and which seem to regard a blood bath as the only
satisfactory substitute for a general election." -- H.J. Paton, 1937

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 05:00 -0800
  Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-09 05:13 -0800
  Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 05:17 -0800
  Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-09 13:29 +0000
    Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 06:54 -0800
      Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-09 15:45 +0000
        Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 08:39 -0800
      Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-09 08:38 -0800
        Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-09 19:09 +0000
    Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 07:07 -0800
      Re: Program to compute the amount of bottles of water... "Osmium" <r124c4u102@comcast.net> - 2015-12-09 09:40 -0600
        Re: Program to compute the amount of bottles of water... Udyant Wig <udyantw@gmail.com> - 2015-12-10 18:12 +0530
          Re: Program to compute the amount of bottles of water... "Osmium" <r124c4u102@comcast.net> - 2015-12-10 07:47 -0600
      Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-09 08:29 -0800
    Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-14 08:23 -0800
      Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-14 16:55 +0000
        Re: Program to compute the amount of bottles of water... Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-12-14 12:17 -0500
          Re: Program to compute the amount of bottles of water... Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-12-14 13:26 -0500
            Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-14 19:20 +0000
              Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-14 12:54 -0800
                Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-14 21:01 +0000
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-14 21:36 +0000
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-14 21:26 +0000
                Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-14 21:40 +0000
                Re: Program to compute the amount of bottles of water... Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-12-14 16:42 -0500
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-14 21:49 +0000
                Re: Program to compute the amount of bottles of water... Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-12-14 17:25 -0500
                Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-14 16:18 -0800
                Re: Program to compute the amount of bottles of water... Jerry Stuckle <jstucklex@attglobal.net> - 2015-12-14 20:24 -0500
                Re: Program to compute the amount of bottles of water... "Osmium" <r124c4u102@comcast.net> - 2015-12-14 16:04 -0600
      Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-14 11:07 -0800
      Re: Program to compute the amount of bottles of water... G G <gdotone@gmail.com> - 2015-12-15 09:51 -0800
  Re: Program to compute the amount of bottles of water... "Osmium" <r124c4u102@comcast.net> - 2015-12-09 08:26 -0600
    Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 06:57 -0800
  Re: Program to compute the amount of bottles of water... G G <gdotone@gmail.com> - 2015-12-09 08:06 -0800
    Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-09 08:30 -0800
  Re: Program to compute the amount of bottles of water... G G <gdotone@gmail.com> - 2015-12-09 09:45 -0800
  Re: Program to compute the amount of bottles of water... Vécu BOSSEUR <vecu.bosseur@gmail.com> - 2015-12-10 12:44 +0100
    Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-10 08:38 -0800
    Re: Program to compute the amount of bottles of water... Vécu BOSSEUR <vecu.bosseur@gmail.com> - 2015-12-11 22:02 +0100
      Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-11 15:23 -0800
        Re: Program to compute the amount of bottles of water... Vécu BOSSEUR <vecu.bosseur@gmail.com> - 2015-12-12 12:05 +0100
          Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-12 07:00 -0800
          Re: Program to compute the amount of bottles of water... James Kuyper <jameskuyper@verizon.net> - 2015-12-12 10:40 -0500
      Re: Program to compute the amount of bottles of water... BartC <bc@freeuk.com> - 2015-12-12 11:34 +0000
  Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-11 00:43 -0800
    Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-11 09:51 +0000
      Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-11 03:14 -0800
        Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-11 11:55 +0000
          Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-11 10:15 -0800
          Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-13 05:20 -0800
            Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-13 05:59 -0800
              Re: Program to compute the amount of bottles of water... Jerry Stuckle <jstucklex@attglobal.net> - 2015-12-13 11:24 -0500
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-13 19:29 +0000
                Re: Program to compute the amount of bottles of water... Jerry Stuckle <jstucklex@attglobal.net> - 2015-12-13 17:47 -0500
              Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-13 20:43 +0000
            Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-13 17:10 +0000
              Re: Program to compute the amount of bottles of water... James Kuyper <jameskuyper@verizon.net> - 2015-12-13 13:00 -0500
                Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-13 18:25 +0000
              Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-13 10:04 -0800
                Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-13 10:29 -0800
                Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-13 10:43 -0800
                Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-13 19:35 +0000
                Re: Program to compute the amount of bottles of water... Udyant Wig <udyantw@gmail.com> - 2015-12-14 11:49 +0530
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-14 12:34 +0000
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-14 14:38 +0000
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-14 15:09 +0000
                Re: Program to compute the amount of bottles of water... Steve Thompson <stevet810@gmail.com> - 2015-12-14 05:24 +0000
                Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-14 13:07 -0800
              Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-13 13:42 -0800
                Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-13 22:14 +0000
        Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-11 09:51 -0800
          Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-11 10:15 -0800
            Re: Program to compute the amount of bottles of water... Steve Thompson <stevet810@gmail.com> - 2015-12-12 20:42 +0000
              Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-12 18:10 -0800
                Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-13 11:16 +0000
                Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-13 03:41 -0800
                Re: Program to compute the amount of bottles of water... Steve Thompson <stevet810@gmail.com> - 2015-12-14 01:43 +0000
                Re: Program to compute the amount of bottles of water... Steve Thompson <stevet810@gmail.com> - 2015-12-14 01:41 +0000
          Re: Program to compute the amount of bottles of water... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-11 18:45 +0000
          Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-11 12:34 -0800
            Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-11 13:18 -0800
              Re: Program to compute the amount of bottles of water... raltbos@xs4all.nl (Richard Bos) - 2015-12-15 17:48 +0000
                Re: Program to compute the amount of bottles of water... Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-12-15 10:58 -0800
                Re: Program to compute the amount of bottles of water... raltbos@xs4all.nl (Richard Bos) - 2015-12-17 00:14 +0000
        Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-11 09:53 -0800
          Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-11 10:20 -0800
          Re: Program to compute the amount of bottles of water... Keith Thompson <kst-u@mib.org> - 2015-12-11 12:40 -0800
    Re: Program to compute the amount of bottles of water... Barry Schwarz <schwarzb@dqel.com> - 2015-12-11 02:01 -0800
      Re: Program to compute the amount of bottles of water... Richard Heathfield <rjh@cpax.org.uk> - 2015-12-11 10:18 +0000
      Re: Program to compute the amount of bottles of water... Alla _ <modelling.data@gmail.com> - 2015-12-11 03:02 -0800
    Re: Program to compute the amount of bottles of water... "Osmium" <r124c4u102@comcast.net> - 2015-12-11 08:13 -0600
  Re: Program to compute the amount of bottles of water... "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-12-11 11:09 +0100

csiph-web