How do *you* use arrays?

D

david epsom dot com dot au

hmmm - I know I had already written to much bumpf.

I'm using a string for a stack and tables for queuing.
I've found collections easier to use when I want to
index stuff that is not 'natively indexed numerically',
I count 'triangular tables' as 'multi-dimensioned', and
I haven't seen a business use for a heap that wasn't
better handled by a table. I still think that most
use of arrays will fall into one of the categories
listed, and I still count those as minority situations.
After all, how many compiler designs, slot machine
simulations, and wave propagation calculations do we
do after we leave school?

I'm not sure about the sorting though. I sort using SQL,
but my data is either in a table or from a table or going
to a table, which I took as characteristic of most business
use. However, it could just indicate my blindness to other
forms of business data.

(david)
 
M

Marshall Barton

david said:
The computer world has taken a bit of a self-indulgent
diversion through C in the last 10 years,

I'm not sure I understand the semantics of that statement,
David, but I think I might disagree.

Dennis Ritchie and Ken Thompson invented C over 30 years ago
with the express intent of providing a language that was
very "close" to the machine for core OS development. It was
never supposed to be more than a small step up from assembly
language.

[Footnote: the name C came about because Ken's first
attempt at this type of language was named after his wife,
Bea, so C was the obvious name to use for a follow on
language.]

OTOH, C was general enough that a **lot** of non-OS
developers working on strictly procedural applications also
found it far superior to assembly, Fortran, etc. and it
gained wide acceptance.

When the OOP concept began to be diseminated in the late
70s, it was fairly natural for some early attempts at an OO
language to be based on C. Thus C+ was born.

After a few years and a lot of experience, the needs of a OO
Language became clearer and by the mid 80s Dennis, Ken and
others had formalized things into C++.

I just don't see how all that is self indulgent, unless you
mean that C and its derivitives have been used in ways they
were never intended for. If that's the case, blame it on
the schools that teach it and the students that thought the
one language they were taught would be the only one they
would ever need.
 
B

Bryan Reich [MSFT]

Am I the only professional developer cringing at the thought of leaving out
the fundamental concept of arrays in a GENERALIZED and BASIC programming
course? It is fairly accurate to say that arrays don't have to be used much
in a scripting environment like VBA, but the concept of an array is so
pervasive throughout programming, both in practice and in understanding the
underlying concepts of memory layout and such, that I would NEVER suggest
leaving it out of an introductory course. Besides, what if they have to turn
around and program in C# or *gasp* C or C++ and all of a sudden have to, at
the very least, deal with the command line argument array in main? If your
goal is to prepare these students for possible future programming in
undertermined languages in undetermined applications, I would strongly
advise not brushing off array concepts. I mean, look at strings! They are
really arrays and the string access symantics are often the same at least
conceptually if not actually, particularly when used in commercial
applications where performance becomes an issue.
Anyway, I'm sure I'm coming from a different world with the kind of coding I
do, but trust me that the code I wade through every day here at work uses
arrays in one form or another handily. :)
 
P

Paul Overway

No...I just wanted to work on Euchre strategies. <grin>

There are sorting routines, i.e., QuickSort, BubbleSort, etc. that also make
use of arrays. You should be able to google for examples and their
application.

FWIW...using an array for a virtual deck of cards is something I'm sure your
students would easily grasp, and they may even have fun doing homework!
 
T

Tim Ferguson

hmmm - I know I had already written to much bumpf.

Not really: I think I must have been having a bad day in work yesterday!
The original post indicated it was about general programming issues rather
than db specifically, and I don't know anyone who would set up a SQL
database in order to manage a bunch of petrol-pump prices as a table.

I think I must have been thinking of those nights creating dequeues and
stacks in Pascal, and saying to myself, "no, these _are_ basic programming
skills and _aren't_ useless!"

MS-Basic collections are only tarted-up arrays anyway, and I would argue
that anybody who can't handle proper arrays would be just dangerous messing
about with them. A lot of this is semantics anyway: I would always
implement a triangular array as a single-dimensioned one. I guess you would
too, especially if you stick it in a table, and in my view, if you didn't
know arrays you wouldn't be able to do it. Hockey league? Those puzzles
about people shaking hands at parties?

While we are on general programming, I challenge anyone here to implement a
sieve of eratosthenes using a Jet table without sleeping bags and mugs of
cocoa coming into it... :)

Matron's calling me, so I'd better go now.

All the best


Tim F
 
T

Tim Ferguson

Am I the only professional developer cringing at the thought of
leaving out the fundamental concept of arrays in a GENERALIZED and
BASIC programming course?

Not professional but I'm with you.

Tim F
 
D

david epsom dot com dot au

I am a professional developer, and I was a professional teacher
teaching electronics. Both as a teacher and as a developer I
try to be aware of different ways of handling ideas. I am also,
for my sins, deeply conservative, and was never very good at
those 'thinking outside the box' exercises. In compensation,
I've always been good at knowing more about the different ways
of handling the same problem: I think a good conservative knows
the solution domain and is not wedded to a small part of it.

I would ALWAYS consider leaving things out of an introductory
course, and I would ALWAYS consider alternatives to the
pervasive explanations and nomenclature, and I would ALWAYS
consider the use of both generalisations and specific examples.

I personally visualise memory as a picture, so linguistic
representations don't help me with the underlying concept
of memory layout. And if you've ever had a colleague who
thought in kinetic terms (eg dance) you will understand
that you have to offer a range of different representations
when teaching, and you shouldn't consider any representation
as 'fundamental' when you are designing a course of
instruction.

Designing a course of instruction is similar to designing a
program in this way: you can choose different fundamental
design elements, and after you have chosen them they force
the direction of the rest of the development, but the devil
is in the details, and sometimes it is a good idea to spend
some time considering what affect your fundamental design
choices are going to have on the ultimate outcome...


(david)

PS Regarding strings: in a von Neumann architecture, everything
is a string (including arrays), modern hardware implements
that on row/column memory, translated by the chipset to grouped
random access, virtualised by the operating system as linear
address, virtualised by the programming language as types,
virtualised by the program as representational objects. At
what level is the 'array' syntax and keyword fundamental?
 
D

david epsom dot com dot au

database in order to manage a bunch of petrol-pump prices as a table.

:~) No, actually it was a paradox database! Of course, it
also had the price and stock level for the store as well as
the petrol prices.

While we are on general programming, I challenge anyone here to
sieve of eratosthenes using a Jet table without sleeping bags
cocoa coming into it... :)

I've always been more interested in FFT, and I started wondering
if I could implement a Radix algorithm just using SQL? Sadly,
I think the answer is no. Maybe someone else could, but not me.

(david)
 
T

Tim Ferguson

:~) No, actually it was a paradox database! Of course, it
also had the price and stock level for the store as well as
the petrol prices.

Cheat: that makes it a database, not an array!

All the best


Tim f
 
B

Bryan Reich [MSFT]

I too am quite conservative David, but it seems my conservitism manifests
itself differently than yours. I want to know how something really works so
that I can appreciate the costs and benefits of the abstractions that are
provided for me so I can make the best decision for my solution from this
information. If a developer doesn't know the underlying details of the
system or abstraction he is using, he can't possibly make good decisions as
to what abstraction truly fits his needs.
The fact is, as you mentioned, all computing is based on arrays at some
level. So how can you be as effective a programmer not knowing about them as
opposed to knowing about them? I'm not arguing about teaching methodologies
here, I am all for using generalizations, specific examples, visual
learning, auditory learning, etc to get the point accross to all different
kinds of people. But what I simply can't embrace is the leaving out of the
material entirely.
--
Bryan

david epsom dot com dot au said:
I am a professional developer, and I was a professional teacher
teaching electronics. Both as a teacher and as a developer I
try to be aware of different ways of handling ideas. I am also,
for my sins, deeply conservative, and was never very good at
those 'thinking outside the box' exercises. In compensation,
I've always been good at knowing more about the different ways
of handling the same problem: I think a good conservative knows
the solution domain and is not wedded to a small part of it.

I would ALWAYS consider leaving things out of an introductory
course, and I would ALWAYS consider alternatives to the
pervasive explanations and nomenclature, and I would ALWAYS
consider the use of both generalisations and specific examples.

I personally visualise memory as a picture, so linguistic
representations don't help me with the underlying concept
of memory layout. And if you've ever had a colleague who
thought in kinetic terms (eg dance) you will understand
that you have to offer a range of different representations
when teaching, and you shouldn't consider any representation
as 'fundamental' when you are designing a course of
instruction.

Designing a course of instruction is similar to designing a
program in this way: you can choose different fundamental
design elements, and after you have chosen them they force
the direction of the rest of the development, but the devil
is in the details, and sometimes it is a good idea to spend
some time considering what affect your fundamental design
choices are going to have on the ultimate outcome...


(david)

PS Regarding strings: in a von Neumann architecture, everything
is a string (including arrays), modern hardware implements
that on row/column memory, translated by the chipset to grouped
random access, virtualised by the operating system as linear
address, virtualised by the programming language as types,
virtualised by the program as representational objects. At
what level is the 'array' syntax and keyword fundamental?


Bryan Reich said:
Am I the only professional developer cringing at the thought of leaving out
the fundamental concept of arrays in a GENERALIZED and BASIC programming
course? It is fairly accurate to say that arrays don't have to be used much
in a scripting environment like VBA, but the concept of an array is so
pervasive throughout programming, both in practice and in understanding the
underlying concepts of memory layout and such, that I would NEVER suggest
leaving it out of an introductory course. Besides, what if they have to turn
around and program in C# or *gasp* C or C++ and all of a sudden have to, at
the very least, deal with the command line argument array in main? If your
goal is to prepare these students for possible future programming in
undertermined languages in undetermined applications, I would strongly
advise not brushing off array concepts. I mean, look at strings! They are
really arrays and the string access symantics are often the same at least
conceptually if not actually, particularly when used in commercial
applications where performance becomes an issue.
Anyway, I'm sure I'm coming from a different world with the kind of
coding
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top