Object Oriented Methods

 BBS: Inland Empire Archive
Date: 06-08-92 (21:42)             Number: 163
From: PHILIP NELSON                Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Object Oriented Methods        Conf: (2) Quik_Bas
Well, this message won't be for the faint of heart...
However, if you've been getting bored with programming,
simply because there's no challenge left, or if you just
hate to get into complex applications because of the time
and details needed to write those programs, then maybe
Object oriented Programming techniques will change things a
bit.

Yes, Object Oriented Programming techniques can be done in good old
QuickBasic, without the need for any additional libraries.
All you need, is to create a few modules with include
files, then compile them as libraries and presto, OOPs for
QB.

Now, I've had some arguements with a few so-called OOPs
programmers, who claim to have used SmallTalk, and
currently program in C++, where they state that there is no
way to write OOPs in Quickbasic, that you MUST have an OOP
language.  Well... This certainly shows that no matter how
much you prove things, some people are simply brainwashed
into thinking one way and can't open their eyes if their
lives depended on it.

In any case, in order to have an Object BASED system, you
need to create sub procedures/functions which include their
own Data, and will only work on their own local data.
This is the first step towards creating OOPs using QuickBasic.

In order to create local variables, which won't disappear
once the procedure terminates, all you need is a single
statement called: STATIC

The second requirement for OOPs, is to pass instructions to
the object, which will cause it to do something.  In
QuickBasic, the easiest way to accomplish this is by
passing STRING instructions to the procedure or function.

Another requirement for OOPs, Although this point can be
debated in some dark arena on another planet, is
Inheritance.
Now, this term may confuse many people out there, but the
concept is rather simple AND, can be done in QuickBasic
quite easilly.

What is inheritance?  Well, according to standard OOP
definitions, Inheritance, is a mechanism, in which objects
inherit code from a parent object (Known as a CLASS type
object).
In QuickBasic, a CLASS would be a master Sub
procedure/function, which is called by objects which share
the same code as the master procedure.

The Object (An Instance of it's Class), merely contains two things.
1-  The STATIC  statement, which creates it's local variable
2-  A Call to it's master procedure, called the CLASS from now on.

What is Object Oriented Programming Good for?  A great deal
of things.   Code re-usability is one good reason...
Create one library, and use it over and over again.
Another reason...  You can always BUILD on top of an existing library,
without having to dig up it's source code, add new code to
it, then re-compile as a library.
The next reason, is that you can make the library available
to anyone as a shareware library, and if they register the
library, you give them the additional instructions which is
understood by the library.

--- GEcho 1.00/beta
 * Origin: Brian's BBS [514-769-5023] Montreal : (1:167/149)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET