home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / clipper / oop / oopexm / read.me < prev    next >
Encoding:
Text File  |  1992-01-27  |  5.2 KB  |  125 lines

  1. 1/27/92
  2.  
  3. Paul Long
  4. 72607,1506
  5.  
  6. The other day, I wrote a simple DOS-file-to-.DBF data-conversion utility
  7. for a client in Clipper 5.01, using Funcky for the ASCII file I/O.  I
  8. then downloaded OCLIP 1.0a, the latest version of the FREEWARE
  9. object-oriented extension to Clipper 5.01, and rewrote the utility to be
  10. object-oriented just to evaluate OCLIP.  I produced three sets of source
  11. files that solve my problem using three slightly different methods.
  12. Then I measured the execution speed of each method.  Below, I outline my
  13. problem and solution, briefly describe each method, present the test
  14. results, and list the files.
  15.  
  16. The source files are made available to show what the object-oriented
  17. counterpart to a traditionally coded, real-world program looks like.
  18.  
  19. This is my first stab at OOP in Clipper; however, I have written large
  20. and small systems using OOP.  I've done OOP programming in C++ and C
  21. (yes, C), and I've played around with Smalltalk V/286.  I haven't
  22. agonized over the code, so it may be a little ragged.  Any comments are
  23. quite welcome.
  24.  
  25.  
  26. THE PROBLEM AND SOLUTON
  27.  
  28. The client is presently able to print medical-claim forms with their
  29. existing back-office medical system.  They are able to direct the output
  30. to a DOS file.  The product we sell wants the same information, but in a
  31. dBASE file.  An additional problem is that each one-page form can
  32. contain from 1 to 6 entries for services rendered, with each service
  33. resulting in a record being written to the dBASE output file--there is a
  34. one-to-many relationship between forms and dBASE records.
  35.  
  36. A custom utility that we write can convert the forms in the DOS file to
  37. a dBASE file.  Since we'll probably have to do this type of conversion
  38. for other clients in the future, it would nice to make the code easy to
  39. reuse.
  40.  
  41.  
  42. THE METHODS
  43.  
  44. The first is traditional, non-OOP.  All code is in one file.
  45.  
  46. The second is a hybrid.  Code is separated into files according to the
  47. "class" it serves.  This is not "object-oriented," "class-based," or
  48. "object-based," to use Dr. Peter Wegner's classifications.  It's just
  49. maybe a little better organization of the code; for that reason, it's
  50. not that interesting.
  51.  
  52. The third way uses the same code separation as the hybrid, but it is
  53. object-oriented.  Using OCLIP, four classes are defined: Boolean is for
  54. logical objects, DOSFile is for DOS ASCII files, Form is for
  55. medical-claim forms, and XYZForm is a specialization of Form.  The
  56. DOSFile and Form classes contain a Boolean object as an instance
  57. variable.  The Form class also contains a DOSFile object.
  58.  
  59. Boolean and DOSFile are foundation classes that any basic class library
  60. should contain.  These should be more robust than what I'm presenting
  61. here.  For example, there is no write-record method in DOSFile because
  62. my little program didn't need to write to DOS files.  The missing
  63. methods are easily added.  Boolean is probably overkill, but I
  64. thought... what the heck.  Form is an abstract class of which no object
  65. should be instantiated (created).  It is merely intended to be used as a
  66. superclass.  A "template" class, so to speak.  XYZForm is a subclass of
  67. Form.  It is a medical-claim form used by a particular "XYZ" health
  68. provider.
  69.  
  70. There should clearly be more classes in my program.  For example, .DBFs
  71. are not represented by a class.  Like DOSFile, this should be included
  72. in a basic class library.  As I said, this is an exercise in evaluating
  73. OCLIP and OOP in Clipper in general, not in building a robust class
  74. hierarchy.  I would hope to _buy_ my foundation classes.
  75.  
  76.  
  77. THE TEST RESULTS
  78.  
  79. The ASCII input file is 816K.  It contains 544 forms, with an average of
  80. 2 medical-services entries per form.  Each service results in a record
  81. being written so that 1089 records are written to the .DBF.  The output
  82. .DBF ends up being 94K.  The tests were run on a 20Mhz 386DX clone with
  83. all disk caching turned off.  The machine was warm-booted before each
  84. test.  .EXE load time has been subtracted from the numbers.  Time is in
  85. minutes.
  86.                                                   *
  87.          Method      Execution Time  % Degradation
  88.  
  89.          Object-oriented   2.66     -    -
  90.                                       \    \
  91.                                         28   \
  92.                                       /        \
  93.          Hybrid            2.08     =           34
  94.                                       \        /
  95.                                         5    /
  96.                                       /    /
  97.          Traditional       1.98     -    -
  98. *
  99.  Degradation occurred from traditional to hybrid to object-oriented.
  100. Just so you don't misread my chart.
  101.                                    
  102. I'm sure a lot of time was spent doing I/O, so an object-oriented
  103. CPU-intensive program would experience greater degradation over its
  104. traditional counterpart.  But who writes those kinds of programs in
  105. Clipper anyway?
  106.  
  107.  
  108. THE FILES
  109.  
  110. This is a list of the files that are zipped together:
  111.  
  112.    read.me        This file
  113.  
  114.    tformxyz.prg   Traditional
  115.  
  116.    hformxyz.prg   Hybrid
  117.    hform.prg
  118.    hdosfile.prg
  119.    hboolean.prg
  120.  
  121.    oformxyz.prg   Object-oriented
  122.    oform.prg
  123.    odosfile.prg
  124.    oboolean.prg
  125.