my $obj = Orderconfirmer->new; $obj->fetchdata(type => all); $obj->fetchdata(name => 'foo'); $obj->createinvoice(type => 'msword', name => 'foo);
What youre doing is creating an interface for anothoer prgy to use. The advantage is that you have "abstraction". You create all the business logic in one script, encapsulate your data fetching/processing in another script, so when your backend changes, you re-write your OO module (being careful to preserve the interface you've defined) and dont have to touch your business logic.
Of course in the above example you can abstract further, having one module fetch all the data from a database, and the other module build your word/pdf/whatever invoices.
So an object has methods, the methods do *something*, they can do whatever you program them to do. An object also has attributes, these attributes are things like "name". A method can use an attribute to to its processing, using the above example, the fetchdata method uses the attribute of name to define what to search for...
In reply to Re: OO or just OOps ?
by Ryszard
in thread OO or just OOps ?
by guha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |