Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIFFERENCE BETWEEN OBJECT AND SUBROUTINE 1

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
Hailing from an IBM Mainframe environment running against a hierachical database, I have not yet had the pleasure of getting my head around OOP.

From all the reading I've done it seems to me that the ActiveX implementation of OOP by Microsoft is suspiciously like a bunch of subroutines that would be called from a 3GL language like Cobol.
i.e some reusable code that you feed parameters to perform a set of tasks.

So what is the real difference between an object and a subroutine.
 
I think you might want to find a more suitable forum for that kind of a question ;)
 
In traditional programming we observe two distinct groups: data and subroutines (procedures/functions).

The subroutine performs some action with the data to get some result. Example you have a matrix (data) and feed it to a procedure or function to obtain an output (inverse matrix or whatever).

In object oriented programming you have the data "object properties" and procedures "methods" defined within one structure.

Talking about Matrix or Vectors, the properties defined could be for (vectors) length, direction etc. An embedded method in the object (vector) could calculate the inverse or perform some mathematic calculation together with other vectors without calling an external subroutine.

There are some other issues like inheritance etc, that creates the possibility to create a descendent structure that inherits the properties and methods of the ancestor object, and of course has more capabilities. Examine the chain:
point --> 2d vector --> 3d vector --> nxm vector --> etc.

In windows programming a lot of things are done with objects, example: a program is made of screens/forms/windows that can resize themself, hide close etc.
In this environment the programmer doesn't have to lose much time in elaborating the user interface, just create an descendent of the desired type of window/form/screen etc. can concentrate more on the "meat" functional part of his application.

I hope that this explained some.

Steven van Els
SAvanEls@cq-link.sr
 
Thanks Steven for the time.

I think I now have a clearer understanding from a generic viewpoint of the diference. Like anything else, full understanding lies in the detail and I will just have to set about coding some objects to fully understand them.
 
Shaunk,

Grenage's response was that THIS forum concerns the future of IT over the next 5 years, and your question was/is therefore inappropriate. They merely, lightheartedly, suggested that you might like to find the right forum.
 
Apologies to Grenage and others I have offended in this forum.
I will take the advice of W.G.P in the future:
"Use your two ears and one mouth in that proportion"
 
I think that there is a forum called OOP and code reusability (more conceptual etc). For detailed/practical examples dive in the Delphi, Visual C, Borland C, Java? forum. Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top