Re: class
- From: "Bill Reid" <hormelfree@xxxxxxxxxxxxxxxx>
- Date: Fri, 29 Dec 2006 20:54:00 GMT
Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote in message
news:aaCdnUgqRtIzCeDYnZ2dnUVZ8qCqnZ2d@xxxxxxxxx
Bill Reid said:newsgroup,
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
inand
you might want to ask in alt.comp.lang.learn.c-c++ instead. If you are
keyword.fact learning C, then you need to know it doesn't have a "class"
It does, however, have a "struct" keyword which does basically the samejob
- 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 postedif
in comp.lang.c, and so I gave a C-based reply (*after* first saying that
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 wouldhave
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 theWell, this is true, myfirstprogram.c is always "Hello World!", innit?
programmer to produce visible results quite quickly, and that can be very
encouraging to a neophyte.
But if you can't get beyond that, it might as well be your last...
---
William Ernest Reid
.
- Follow-Ups:
- Re: class
- From: Richard Heathfield
- Re: class
- References:
- Prev by Date: Re: selecting and working with appropriate data type
- Next by Date: Re: Cleanup patterns
- Previous by thread: Re: class
- Next by thread: Re: class
- Index(es):
Relevant Pages
|