Apologies in advance guys, but this is a long winded one - to do with the
application of OO COBOL, but some of it certainly applies to the other
languages.
YOU'VE BEEN WARNED - SO QUIT HERE IF NOT INTERESTED !:-
--------------------------------------------------------------------------------
Peter E.C. Dashwood said:
Jimmy,
your post raised a few questions.
Perhaps you could elucidate...?
How can a queue (FIFO) and a stack (LIFO) be implemented with an ORDERED or
SORTED Collection?
By definition, these collections have to be UNORDERED or UNSORTED.
I certainly hope J4 are not going to overturn the accepted concepts of queue
and stack in order to implement these collection types. But then, nothing
they did would surprise me...
Trying to trip me up with superior knowledge <G>. Mentioning Sorted Collections
was definitely a slip of the pen ! They would be a non sequitur - either
elements are added according to the default Sort or you sub-class to get your
own customized sort !
However Ordered Collections - Yes. Recall I once suggested Sequential
Collections - but you didn't like that definition. To clarify from my on-line
help :-
--------------------------------------------
Orderedcollection
An OrderedCollection manages the storage of elements in the order in which they
were added to the collection. One of the main advantages of OrderedCollections
over Arrays is that they can grow dynamically as more elements are added. You
can use OrderedCollections to implement stacks and queues.
----------------------------------------------------------
Probably the most common use being to read in data and the latest record is
added as the last element (the COBOL file sequential approach). However, there
is nothing to stop you inserting at an index position of your choice - when you
are aware of 'positioning'. The sequential approach implies "add" (at the
bottom) with no reference to an index. Naturally with callbacks you can iterate
against all the elements in the collection, plus when a condition fails you can
get out of the callback with "quitIteration".
My example was an attempt to show retrieval in its simplest form by index.
Supporting the Ordered Collection is the PRIVATE class Sequenced Collection. Be
assured there are methods to achieve the points you made, remove one (element)
or block (of elements), replace one or block etc., even "reverse" the order of
the collection. You may not be thrilled with J4, but they aren't a bunch of
dummies - and I'm sure they will cover all points. As to FIFO/LIFO - difficult
to see that I would have a use unless I ever got into Simulation.
Is he "REALLY using OO COBOL"...?
And you so often accuse me of mis-reading you ! How the hell did you arrive at
the above crummy statement. The two volume tome 'Core Java' is quite candid that
Java had an initial set of lists - subsequently they had to back-track and add
on features which had been missed. Not my words, but 'Core Java' published by
Sun !
Using the free or cheapest tools you can get to do a job is quite distinct
from using the best tools available to do the job.
If you can't afford to use the "right" tools for the job I don't see any
dishonesty in saying so.
Eiter way, it doesn't alter the fact that using the right tools for the job
(rather than making whatever tools you have fit the job) is a preferred
strategy.
Agreed. when originally writing I was thinking of including the words 'best
tool', but let them slip by. However that is a very subjective thing, 'best'.
For the most part I would suggest that most language users in this thread would
*prefer* to facilitate features in their 'parent' language - the one they are
most comfortable with. If all else fails, then they look at other languages,
particularly if they can find a pre canned routine/function. And it is not a
question of making 'your tools fit the job'. That is ridiculous - first call
does your language handle it, (may require a bit of research for methods
available), if not, then go the 'outside' route.
As you don't quote the OCX site, we can't judge for ourselves whether the
suggested component was appropriate or not.
Without back-tracking to look up the site - be assured it DOES have rich
features, (but from the marketing blurbs, possibly some overloading - see
below). BUT without getting into OCX the point was it was easily achievable in
COBOL - and I might add, by RE-USING a large chunk of classes which I had
already written.
Trapping a Windows or keyboard event is feasible in any language that deals
with GUI development. What makes COBOL (even OO COBOL) MORE "right" for this
than VB, C, C++, or Java?
Again your misinterpretation of what I wrote. If your preference is COBOL then
COBOL is MORE 'right' if it lets you do something easily. If your 'parent' is VB
why would you go looking at C/Java for the solution - if it is easily attainable
in VB ?
People who used the recommended OCX component wouldn't care what language
they embedded it in, and they have the same re-use advantages that you
realised by doing it in COBOL.
The point here is that components transcend languages.
(That is one reason why I personally consider them a better solution...)
As stated above, I think the general tendency will probably be language of
preference. (Don't really see too many of them invoking COBOL - do you ?). If
however, and to quote your phrase, "It's only programming', and you believe
something is more viable in another language, then go for a potpourri - the
latter approach implying you carry around more baggage with your application
because you are now adding libraries for both languages.
I suggested baggage, accompanying components could be a problem - you summarily
dismissed that as irrelevant. It can come to haunt you.. Recall Jerry's problem
with that very large file - and the attendant problem of getting extracts over
to user sites. He concluded he would drop the project and take up pig farming;
as an alternative he suggested another solution - along with the data give each
user site a free disk <G>. Difficult we know with an existing and functioning
database - but the true answer goes back to design - that file design should
probably be seriously revamped. Baggage or volumes are not something that can
be dismissed lightly. The frugality on storage when this game started some 40-45
years ago, is just as valid today, providing it doesn't impede performance.
This is a total non sequitur. What has my support of components got to do
with anything you posted? The implication seems to be that by opting for a
component based approach, I am not "REALLY" using OO COBOL.
That is unfair and uncalled for.
I don't really mind whether you think I do so or not, and it is just one of
the tools I use, but I have been using it long enough that I was able to
post an analysis and explanation of it to an ASP based Web site, at a time
when you were assuring the COBOL community that "nobody understands OO
COBOL".
A deliberate misquote on your part. Certainly I had initial difficulties getting
a handle on OO and a certain gentleman PECD is on record as saying the same
thing ! I am now a reasonably happy camper - but in view of a quote below
coming from you - ????????
(Here's the link, in case you've forgotten...:
http://www.aspalliance.com/aldotnet/examples/coboldotnet.aspx)
The same link also contains the advice regarding "best tools for the job"
which you were so dismissive of above...)
This is the first time I read it, but I do recall a COBOLer jumping into clc and
asking about this MS .NET example. He was somewhat pissed off when I declined,
along the lines from any neighbour you might have up the road, "Hey you program
all day long. Why can't you tell me why my disk doesn't work or my screen
doesn't come on ? To describe it with some detail, I think, required knowledge
of the interplay between MS and Fujitsu NET COBOL - I was not prepared to trip
over my feet !
Not our Pete, this was a challenge not to be refused. Sorry but your quotes in
RED are not much more helpful than a Dick and Jane classic ! Spot didn't even
get a look in. To be absolutely blunt - why did you even bother ?
Let's educate the masses here who may not be familiar with COBOL :-
COBOL has four Divisions :-
-------------------------------------
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
------------------------------------
OK guys get cracking and start coding in COBOL. You want more ? You want jam on
it ?.
Now your understanding has advanced to the point where you know how to
handle some Windows events in it...
Keep going...eventually you may learn how to build components with it...
If that happens, maybe we can talk.
Typically snotty wind up from you - although this time you haven't attempted to
wrap your venom with a "<G>", which of course is a caveat which translates to "
Hey ! I was only kidding", if the recipient feels offended.. (That comment on
your style was initially observed by somebody else, not me !).
Maybe we can talk ? Not likely - unless you are considerably more forthcoming in
the future. While I accept that Components ARE viable, (in certain areas), - I
don't buy into your approach. Forgive me, but it appears that you've arrived at
a set of conclusions, have cast your thoughts in concrete and then made the
problems fit the solution.. In a recent message Robert used the phrase "Your
approach was myopic". I'm afraid I agree. I said a while back he is no dummy,
but his diplomatic skills definitely need a brush-up <G> Any criticism of your
perceived and 'correct' approach results in a snarl - as in your recent snotty
reply to Donald about components.
I'll mention it seeing as you've plugged your 38 years in IT. As of this June
I've been 40 years in the game, starting in my beloved Zummerzett (Somerset). I
still prefer to call it EDP. The first 12 years spent in design - that's the
stage before wee programmers started doing chicken scratches on coding pads.
Without question you can probably lose me in programming techniques - but don't
even try when it comes to design, bearing in mind I was using random access from
day one. Get the design wrong and you are on a hiding to nothing, no matter how
much clever coding you put into it..
I've certainly been bewildered over the years by your view of OO COBOL.
Clarification has only recently surfaced. Let's take some points in progression
:
1. You used an early version of Fujitsu OO COBOL which DIDN'T include
collections. You could get those coupled with a fast Sort package for about
another $1,000 (?). Surprise, surprise. I wonder how many didn't buy that
extension - so they programmed ignoring collections(lists). I assume at the time
you fitted into that category. Since then collections may be a part of later
versions of F/J OO - but I've never seen you make reference to them.
You may have your viewpoint - but it's my firm belief that lists/collections are
an inherently important feature in the OO family, and working without them is
like having one arm held behind your back. Lists have always been a part of
design, even using procedural COBOL - I recall mention of Robert designing
chained lists. Similarly, I think Michael did the same with his good ole
favourite - BASIC.
2. Some 5 or 7 of us started chatting privately about OO COBOL. Out of the blue
you came on like the converted. You had discovered Java, but found the language
'underwhelming'. You evangelized how good Java was and started distributing Java
articles to us. Huh ? Not just me, others must have felt the same - 'We are here
to discuss OO COBOL, what has Java got to do with it ?".
3. Then the Java mode went silent. Quietly you had back-tracked to Fujitsu to do
your components - sure I know you will dispute that, but the first indications
you ever gave were that you were using Fujitsu, plus the follow-up, that Fujitsu
generates your intermediate code, so you really don't have to worry too much
about OO.
4. In the C.L.C News Group I have from time to time posted sample code, on one
occasion explaining for Warren about instantiation. This particular message was
followed up by a snide remark from you about the irrelevance. "What gives ?", I
thought, "Where's his hang up ?".
5. Then I made the mistake of saying that before you even start coding you first
have to design your class hiearchies.(I bet you missed it - Roedy Green (Java)
made the same point in one of his first messages in this thread). Back you came
- No! You don't have to do it that way. "Huh ?", I'm saying again to myself.
6. Within clc we got into some friendly discussion on Components and you
attempted to spell out your String2Num - but it was never specific code and your
quotes were, "You could do it this way or this way.....". I countered by
suggesting that using a generic dialog, and creating instances of it I could
achieve the same for a series of dialogs. I posted the code specific to an
entryfield. Your response, "It may work for you, but it appears to contain too
much maintenance". I could arrive at two conclusions from that, (1) You didn't
have a bloody clue what I was describing, or (2) Having settled on Components as
your religion of choice - no deviations allowed, no prisoners taken ! My guess -
# 2,with a slight element of #1 - because you probably didn't even read it !
Note I am NOT claiming to have found the answer, just an alternative approach,
which at the moment works - as I've said before - down the road I might fall
flat on my face. In your case that couldn't possibly happen could it ?
7. I'm sorry but your mindset is often illustrated in two of your pet phrases,
"I am not convinced.....", or "I am not persuaded....". See - I do read what you
write, and although I don't go in for copious cross-reference of messages, I do
have a bloody good memory. I'll be SOL if Alzheimer's ever kicks in !
8.. Having run through the above, which conveys my bewilderment as to your
thinking, for me we now arrive at the real kicker :-
8th August
"OO for me is only important insofar as it provides the key to component
building.
There are too many disadvantages in pure OO...lack of cross platform
Classes, difficulty in calling one set of classes from a language based on a
different Foundation, and so on. Simply by wrapping the objects as
anywhere. My fervour is for components, not OO, although I also believe that
OO is a superior model for programming than procedural.".
The first sentence implies OO is a non-starter - it doesn't fit your thinking.
Your list of disadvantages - "lack of cross platform classes" - I assume here
you are referring to portability - the tug-o-war our C and Java friends are not
winning (or as Howard said, 'Neither are they convincing anybody'). Certainly of
great significance if you are MARKETING components. But check those component
sites - so many modules have been written to address specific languages -
excluding COBOL ! Get into a master and servant relationship, the boss legally
owns the components you design and you aren't going to sell them anywhere - not
unless the boss wants to market them.
"Difficulty in calling one set of classes from a language based on a
different Foundation". Not in my book. I can happily invoke Java from my COBOL
compiler, coupled with COBOL classes written to specifically invoke Java. Same
goes for C with specific data types to handle inter language operability - a
point stressed in the Standard COBOL 2002. (Don't go asking for samples - I
don't use either feature. Disbelieve me if you wish - or go take a peep at
microfocus.com home page and see entries for Java, plus examples).
Note carefully, I am not rejecting components, but the argument that they are
the panacea or cure-all for the future of IT. And in the process your
conclusions have led you to dismiss major OO features. We now have OO-COBOL and
a sub-product called Dashwood-OO COBOL - just leave out the bits you think don't
matter.
You referred us to the following article :-
http://www.aboutlegacycoding.com/
I thought I'd check, as I didn't recall it had any source code. Correction it
does :-
------------------------------------------
Environment Division.
…
Repository.
Class OLE AS "*OLE".
…
Working-Storage Section.
01 S2Nobj-Name pic x(128) value "STRING2NUM.String2Num.1".
01 S2Nobj OBJECT REFERENCE OLE.
…
Procedure Division.
…
invoke OLE "CREATE-OBJECT"
using S2Nobj-Name
returning S2Nojb.
Now I can get the component to display its Properties by:
Invoke S2Nobj "ShowStuff" using strInput
Cf. the JavaScript above.
S2N.ShowStuff(strInput)
It isn't SO different, is it? (And you thought this OO stuff was hard <G>)
-------------------------------------------------------------------------------
Again something you probably missed from Roedy - he also commented that OO
developers needed to attain a skill set.
I didn't write the following - I think I got it from clc :-
-------------------------------------------------------------------------------
$set ooctrl(+P)
class-control.
word is class "$OLE$word.application".
working-storage section.
01 theWord object reference.
procedure division.
invoke word "new" returning theWord
invoke theWord "setVisible" using by value 1
invoke theWord "Quit"
invoke theWord "finalize" returning theWord
stop run.
-------------------------------------------------------
We *know* they both work, because you are going to tell me the first one
definitely works. And I'm going to tell you the second works because I compiled
and ran it.
BUT - to describe a concept - they are both as useful as teats on a bull !
Yours was an enjoyable article - But the above - ZOWEE ! That really gives me a
lot of information if I want to get into Components. Sorry, but I'm the Doubting
Thomas from the Twelve. Until I can see and touch the source - I ain't buying. I
want to see a concept liberally supported by source before I make my *own*
judgement, before I go down a different path. (If I want to follow through on
Components, what better than the Aussie academic, Brian Henderson-Sellers -
oodles of articles and diagrams, plus I can buy an armful of books from him, (he
is the author of course), on Component generalizations - but no source !).
Now here's the real problem I have with Components, because although you have
supplied the weapon you haven't illustrated the ammunition.
Let's talk something basic like dates. Please produce me a component. Well
certainly in COBOL we are already well armed with at least some eight Date
intrinsic functions which can be CALLED in traditional fashion from a COBOL
program. I don't use them all, but if I did would put them in a super class
"Dates" as individual methods. Coupled with those, there are generalized
methods, (mainly PRIVATE), required for date validation, format checking etc.
(Real bread and butter stuff).
Then we move on - return of validity checks and formatting output to return to
the invoker. Do you want ccyy/mm/dd, mm/dd/ccyy, dd/mm/ccyy, and all the other
possible permutations, or spelled out with names of months and days of week,
(both full and abbreviated). Throw in you also want spacing or hyphens or
obliques. So I live in Canada - better give me English and French. I live in the
US better give me those two plus Spanish and Portuguese. I don't need to expand
- go into the possibilities in Europe. Somewhere down the road our Asian friends
get into the act.
Do I really want a component that does all the above, even providing me with
Hindi and Urdu !
It doesn't require much visualizing to realize that this component is a MONSTER.
In response to queries from Howard Brazlee, you were adamant you don't maintain
components; you write a new one. Really ? How quickly do we arrive at Date
Component Version 1005 ?
The only sensible solution is the one that Roedy alluded to - we have to design
classes and in this case a whole hierarchy just for Dates, super doing the true
polymorphic functions, and sub-classed to handle formatting and spoken
languages .
It is conceivable that such a hierarchy may well embrace something like 200 or
more classes, (albeit some of them may be tables (arrays - for you other folks)
of literals - possibly spanning only a page of source). That still leaves us at
the monster level. But, with the right tools, sub-classes can be pulled to
create selective DLLs - and for the version I want I can be assured that it is
not carrying the baggage associated with Hindi and Urdu, or perhaps, the Slavic
group of languages.
None of the above occurs as a result of starting to code, although proto-typing
can begin. The first step is the overall hierachial design.
Would you seriously attempt to cover the whole gambit above in one of your
component structures ? Possibly you could, but to achieve it you need
sub-classing - and I'm not getting the message that is what you are doing. I
have no intention of going into detail here to spell it out, but it is clearly
obvious to me, and many others into "true" OO, all the above can be achieved via
hierarchies and sub-classing - so where does a Component have the edge ?
Without clear concise code as to the route you would take - how can I even guess
what your approach would be to the above problem - which is an absolute natural
for conventional use of OO with classes, sub-classes, plus throw in $10 words
like polymorphism and encapsulation..
I have been extremely blunt. I feel very angry at what I perceive to be
deception - possibly not your intent. Plus I am really alarmed that you are
sending the younger folks off ecstatically into space, and are they truly aware
of what the implicatins are with your 'shortcut' approach to OO ? The anger is
in the same vein as I'm bloody angry with George Dubya and his clan over the
mythical WMDs - seeing as I was one of the two Canucks who thought the U.S.
should go in - but would have preferred if Daddy Bush had done it 10 years ago.
I've stayed out of clc - largely because of your ramblings - and your dismissal
of the conventional concept of OO really pissed me off. I do not intend to go
into a tit for tat, trying to score points with a clever wordsmith. (I would
caution you however, Oscar Wilde was a clever wordsmith - and he finished up in
jail !).
If you make some valid counter-argument then I may respond - otherwsie silence.
In all my ramblings above I do NOT make claim to being an expert in OO. Mentally
I'm still back there in the UK with the big red letter "L" attached to my car -
"Learner - beware". Being down in the Antipodes I'm hardly likely to knock you
over anyway. However, if I did it in the UK and you told the judge "I was
walking along the pavement and he knocked me down", the judge would award you a
handsome sum of crisp pound notes. You'd be SOL in N. America - "Your honour, I
was walking along the pavement and he knocked me down". Judge responds, "Case
dismissed. You should have been walking on the sidewalk, not the pavement !".
As the cartoons used to say, 'THAT'S ALL FOLKS !".
Jimmy, Calgary AB