HP3000-L Archives

February 2001, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ken Hirsch <[log in to unmask]>
Reply To:
Ken Hirsch <[log in to unmask]>
Date:
Thu, 15 Feb 2001 15:43:18 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (58 lines)
I've read a few messages over the past few days days which really puzzle me.
They seem to claim that anything that can be done in C++ can also be done in
COBOL and that object-oriented progamming is the same as using procedures.

Huh?

COBOL makes it extremely hard to write general-purpose subroutines.  COBOL
has essentially no concept of a user-defined type, for example.
With this code:
01 order-1.
  05 recv-date.
     10 yy pic 99.
     10 mm pic 99.
     10 dd pic 99.

  05 ship-date.
     10 mm pic 99.
     10 dd pic 99.
     10 ccyy pic 9999.

Not only does this code not generate an error:
  move ship-date  to recv-date

Neither does this code!!!!!
  move recv-date to shipping-address

COBOL has extremely limited capability for dealing with variable-length
arrays, variable-length strings, variable number of arguments to
subroutines, dynamically-allocated memory, etc.

To see if COBOL can do everything C++ can do, and to see if object-oriented
programming is nothing more that subroutine calls, try a few of these
problems:

Write a general-purpose priority-queue data structure.
Use a general-purpose priority-queue to hold a set of object with timers and
write a subroutine which calls their ontimer() method at the appropriate
time.   The queue will hold many different kinds of objects simultaneously
with different ontimer() methods--these will be defined later, not when you
write your routine.

Write a subroutine which takes a set of strings (unlimited number of strings
with an unlimited length) and produces another set of strings as output.
(For example, the strings might represent fragments of sequenced DNA that
are being matched up by comparing overlapping sequences.)


Create a subclass of a grid control so that when the user scrolls the data,
the value of the sorted field in the current record is displayed in a text
box in another window.  No, sorry, you don't have the source code to Windows
or the grid control.

Add a UDISPLAY subroutine to COBOL which acts just like DISPLAY but works
with Unicode characters..

If these are too easy, let me know, I can find harder ones.  You could try
writing Internet Explorer in COBOL, for example.

ATOM RSS1 RSS2