![]() |
|
Welcome to the Monastery | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
The differences between procedural programming and OO (or functional or logical) programming are all about who is responsible for what. In procedural programming, The Programmer is responsible for everything. It is He who determines when everything happens, what data structures are used, what algorithms, etc. If there is a bit-shifting or memory allocation, He has made it so.
The other styles are about sharing this rather awesome responsibility. It's a lot easier to see in logical programming - makefiles, for example. When you program a makefile, you're saying "X transforms to Y in this fashion" a whole bunch of times. You then say "I need to get this to Z" and the program figures the rest out. It figures out where you are, where you want to go, and how to get there. All the programmer has done is to provide the rules for getting from X to Y. It's kinda like have a butler in charge of your servants. In OO, it's kinda the same thing, except that you don't have a butler - you are the butler. Each of the objects is a servant. "Hey you! Please get this done." Now, you really couldn't care less how the maid cleans the living room, just so long as the living room is clean when you get back. You don't care if one person did it or if that maid hired a cleaning service to come in and do it. All you care about is that you have a person who is responsible for cleaning the room. If the room isn't clean, you know who to get mad at. :-) Functional is a little weird - you have a butler that will create the servants it needs on-demand, based on a set of templates. It doesn't really work with this analogy. *grins* Being right, does not endow the right to be rude; politeness costs nothing. In reply to Re^3: Perl 6, Object Orientation and Melting Brains
by dragonchild
|
|