On 11/04/2018 12:24 AM, Phil Smith III wrote:
arguments.
As a theological discussion, I find this interesting. Our case is like this
(and isn't Rexx, though it could be):
It may sound like dogma but It's a psychological theory known as Millers
law. Seven is a magic number for people’s comprehension. Psychological
research has found that people generally
cannot keep track of more than about seven chunks of information at once
(Miller 1956) [1]. It's been applied to computer science for decades.
[1]
https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two
rc = somefunction(tuplecount, elementcount,
thing1, data1, length1,
thing2, data2, length2,
thing3, data3, length3,
thingn, datan, lengthn)
The tuplecount is the number of these triplets, and the elementcount is the
number of things in each datan. You can have up to 100 of these tuples.
Does that offend your sensibilities? I'm honestly curious-I generally agree
100% with your statement, but this feels like a maybe-exception.
TBH, I don't like it. The interface is brittle and if there were 100
tuples it would be easy to make a mistake in the argument list.
My first instinct would be to use a container of tuples but if you're
handicapped by your language and it doesn't support containers I would
write an ADT
that keeps track of counts and maintains an internal array. I've been
coding in OO languages for the last 15 years so I instinctively think
along the lines of
encapsulation and well defined interfaces. If you needed to support
unlimited tuples you could change the array to a linked list and none of
the client
programs would need to change.
handle = tuples_create()
tuples_add(handle, tuple(thing, data, length))
tuples_process(handle)
tuples_destroy(handle)
If it helps, note that in this instance, each of the tuples are
different-that is, it's not like they could be combined, as they're pointing
to different data types of different lengths. And there is also an API that
handles essentially one item:
rc = somefunction(thing, data, length)
So if your tuples are different types then your programming language is
not strongly typed which to me is also a concern. I prefer the compiler
to catch my bugs :)
tuples_process(tuple(thing, data, length))
or if your language doesn't support generics use a generational naming
convention.
tuples_process2(tuple(thing, data, length))
Obviously the same idea as the first one with tuplecount and elementcount
both set to 1.
I've been doing this for almost 40 years, but am not a Computer Science
graduate by any means, so I'm always interested in the theology behind this
stuff, and where it does and doesn't apply.
Theology is the wrong word. Software engineering is not about religion
or art it's an engineering discipline. I've been in this game over 30
years and when I look at
the quality of code being produced now compared to the COBOL and PL/1
programs I used to work on in the 90s it's a completely different world.
A lot of that has to
do with game changing advances in programming languages and the paradigm
shift towards OO and functional programming.
Cheers,
.phsiii
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN