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


Groups > comp.lang.c > #100081

Re: Piece of code to read and process data from a file, separating chars and ints

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Piece of code to read and process data from a file, separating chars and ints
Date 2016-12-23 16:29 +0000
Organization A noiseless patient Spider
Message-ID <878tr6bodk.fsf@bsb.me.uk> (permalink)
References <0fb61ff9-91e4-4001-b99d-6cc1ce28dc6f@googlegroups.com> <o3jc6p$cpr$1@dont-email.me> <2c4ff7ed-d261-4a24-a274-3f374abd7e84@googlegroups.com>

Show all headers | View raw


Alla _ <modelling.data@gmail.com> writes:
<snip>
> ... The only 
> extra feature I use is dynamic memory allocation. But it is an important
> one for my program.

Why?  All the examples show relatively small input files and the rows
appear to particular accounting items not general data.  The columns are
years (so the number of them is logically unbounded), but how many will
you actually need?

An important skill in design is making it good enough.  Would, say, a
couple of centuries years of accounting data be enough?  And are you
likely to have more than a few hundred accounting items?  I would do a
bounded data version first and add dynamic allocation later if I wanted
to learn about it.

> I have chosen a fairly easy program for my project,

That depends how much you decide to do.  CSV files can have arbitrarily
long lines, fields can span lines, numbers can contain commas to mean
more than one thing, text can have an arbitrary character encoding and
so on.  So you decide to simplify -- ignore long lines, multi-line
fields and assume the data are all in some simple format.  You keep
simplifying until you have written some version of the program.  You
don't yet have a version of the program, so you have not yet simplified
enough!

All programmers do this when they are able to.  When they are prevented
from doing this because of some rigid set of requirements laid down
before hand, the effect is often a disaster.  At the very least, the
result will be expensive.

As you know, I am not against some forms of "rushing ahead".  By all
means work on five programs at once, or develop a web app along side this
C program.  That's all good.  But for any one task you need to simplify
until it's manageable and then add features one by one.  Here I mean
logically one by one -- you can be working on adding three features at
once, but that mist be in separate versions of the program that get
merged when all three are working.

<snip>
-- 
Ben.

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


Thread

Piece of code to read and process data from a file, separating chars and ints Alla _ <modelling.data@gmail.com> - 2016-12-23 05:02 -0800
  Re: Piece of code to read and process data from a file, separating chars and ints Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 14:28 +0000
    Re: Piece of code to read and process data from a file, separating chars and ints Alla _ <modelling.data@gmail.com> - 2016-12-23 06:39 -0800
      Re: Piece of code to read and process data from a file, separating chars and ints Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 16:29 +0000
        Re: Piece of code to read and process data from a file, separating chars and ints Alla _ <modelling.data@gmail.com> - 2016-12-23 08:44 -0800
          Re: Piece of code to read and process data from a file, separating chars and ints Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 20:31 +0000
            Re: Piece of code to read and process data from a file, separating chars and ints Alla _ <modelling.data@gmail.com> - 2016-12-23 20:52 -0800
      Re: Piece of code to read and process data from a file, separating chars and ints Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 19:34 +0000
        Re: Piece of code to read and process data from a file, separating chars and ints Alla _ <modelling.data@gmail.com> - 2016-12-23 21:31 -0800
  Re: Piece of code to read and process data from a file, separating chars and ints Keith Thompson <kst-u@mib.org> - 2016-12-23 14:10 -0800
    Re: Piece of code to read and process data from a file, separating chars and ints Alla _ <modelling.data@gmail.com> - 2016-12-23 21:09 -0800
  Re: Piece of code to read and process data from a file, separating chars and ints "A. Bolmarcich" <aggedor@earl-grey.cloud9.net> - 2016-12-24 14:49 +0000

csiph-web