[Tutor] programming definitions for a newbie.

Alan Gauld alan.gauld@blueyonder.co.uk
Wed Jun 18 16:26:03 2003


> Just to make sure that I've got this correct, object oriented
proramming
> allows a programmer to merge the data with the methods acting upon
them,

Yes.

> rinstance if I do an assignment such as:
> x = "Ruben"
> len(x)
> but I cant do that in procedural programming.

Sorry, no. You CAN do that procedurally, and in fact you just did!
len() is a function not a method of an object(although len is a
special kind of function, just to complicate things even more!
Lets not go there yet!)

> What is the advantage of object oriented programming as opposed to
> procedural programming? Does is shorten the amount of code you need
to
> write?

For small programs it usually means slightly longer code but
in long projects yes, it generally reduces the amount of code.
However the real advantage is that it helps keep things
organised by grouping all the related fubnctions with the data
that they work on, so it's easier to see what changes affect
what other bits. (This is sometimes called "dependency management"
by the academics)

Try reading the OOP section of my tutor to see if it helps.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld