Re: class




Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote in message
news:aaCdnUgqRtIzCeDYnZ2dnUVZ8qCqnZ2d@xxxxxxxxx
Bill Reid said:


Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote in message
news:N6qdnaM2LbREkuDYnZ2dnUVZ8tmhnZ2d@xxxxxxxxx

<snip>

If by "class" you mean a C++-style class, you're in the wrong
newsgroup,
and
you might want to ask in alt.comp.lang.learn.c-c++ instead. If you are
in
fact learning C, then you need to know it doesn't have a "class"
keyword.
It does, however, have a "struct" keyword which does basically the same
job
- aggregating elements together - in a less syntactic-sugary way.

Heh. OK, I'll play...but let's be clear, this DOES seem to be a
classic "object-oriented programming" educational exercise

...and your entire reply is based on that premise.

Well, not entirely, because being "object-oriented" is actually
a way of THINKING about creating a program that performs
a particular task.

Nevertheless, he posted
in comp.lang.c, and so I gave a C-based reply (*after* first saying that
if
he is using C++ he should check aclcc++, which in fact he has now done).

Even when programming strictly in "C", I tend to first just write or
type out all the variables I think I'll need off the top of my head, and
the function "declarations" needed to manipulate the data. This can
probably be thought of as "data-oriented" programming, and I'll
immediately notice that certain variables all fall into certain categories
that I'll be using for certain types of functions, and at that point
I know that I'll want to group all those variables into a structure
and pass them as a pointer to the functions.

So again, no matter what the language, I wind up writing a lot
of the "code" before I even need to turn on a computer. I do find
this is quicker than just starting writing code that produces "visible"
but simple results, because I typically find that then I have to go
back and re-write all that stuff anyway to actually solve the problem
in the first place...

You mocked my "top-down" approach, and that's your right, but it would
have
been perfectly suitable for this program.

Well, my actual response has been excised from this post, but I
did specifically relate it to real-world "object-oriented" classroom
exercise where it would have been unsuitable in the sense that it
would have received a failing grade. But who really knows what's
going on the mind of the teacher of HIS class; maybe "flashy lights"
alone WOULD pass.

Your "bottom-up" approach is fine

I'm also not sure why you refer to "object-orientation" as a "bottom-up"
process, since the process is actually one of conceptually moving from the
most general classification of the world to as specific as needed to
complete
the program. I think your actual conceptual framework is so completely
non-object-oriented, so rigidly linear in nature, that you equate "input"
and
"output" as the "top" and "bottom" of a program, hence you refer writing
a "menu" ("input") first as a "top-down" approach. My point was that
we already know conceptually what the "menu" is in the first place, so
if we write that first we are neither at the "top" or "bottom" but actually
have done NOTHING to solve the problem...

too, of course, but top-down has the great advantage that it allows the
programmer to produce visible results quite quickly, and that can be very
encouraging to a neophyte.

Well, this is true, myfirstprogram.c is always "Hello World!", innit?
But if you can't get beyond that, it might as well be your last...

---
William Ernest Reid



.



Relevant Pages

  • Re: Is my CS instructor nuts?
    ... Nilges, Build Your Own .Net Language and Compiler, ... I don't claim that Richard Heathfield moderates the group. ... means "doesn't know at least one programming language sufficiently well to ... And "lack of culture" doesn't really ...
    (comp.programming)
  • Re: When shorts are longer than longs !
    ... Richard Heathfield wrote: ... Portable Programming while leaving enough blunderous shit in your ... Both C90 and C99 implementations are supported. ... how to place your translator into conforming mode. ...
    (comp.lang.c)
  • Re: Algorithm Question
    ... Richard Heathfield wrote: ... especially people who overrated their programming ... Your notion of programming skill and professionalism is so obviously ... for the OP was exploring a way to use a formalism to find the string. ...
    (comp.programming)
  • Re: Algorithm Question
    ... Richard Heathfield wrote: ... especially people who overrated their programming ... Your notion of programming skill and professionalism is so obviously ... You could start with the thread where your programming skills were ...
    (comp.programming)
  • Re: Theres got to be a better way
    ... I work with annoyingly complex database tables whose structure ... Programming is all about reinventing the wheel. ... But we're still writing code must like we did 40 years ago. ...
    (comp.lang.php)