in reply to Procedural and Object Oriented Perl Code
Procedural Programming is based on putting together subs that work on data as parameters. The smarts is in the procedures, that may behave differently depending on what kind of data you pass them. Object Oriented Programming is based on linking together smart data, the objects, that know how to manipulate their own data themselves. So the smarts is in the objects.
You can do the same, programmingwise, in both. However, the organization of the code is inside out for one compared to the other.
For example, if you were to implement addition in procedural programming, you'd put the code for adding integers, floats, complex numbers, matrices... all together. And the codes for subtration would be put somewhere else, and yet another place for multiplication...
In object-oriented programming, you'd place all operators/routines for integers together, and all operators for floating point in another place, for matrices yet somewhere else... Inside out.
|
|---|