|
Posted by Scott Auge on 07/19/05 20:45
In article <1121786906.757926.111780@g43g2000cwa.googlegroups.com>,
"DJ Craig" <spit@djtricities.com> wrote:
> In a language like PHP, I don't see any advantage to OOP even in
> complex web applications. The only time I could see an advantage is if
> the application is being created by a large team of programmers, as
> would be the case with Google or SalesForce. In client-side languages,
> OOP is most useful for defining UI objects. PHP doesn't create the UI
> of a web application; HTML, CSS, Javascript, etc, create the UI.
A lot of people put OOP into the box of UI.
I use OOP for business logic and IMHO that is where it really starts to
shine. Basically make a method for every "event" that happens in a
business process for a given "thing."
Lets say our business process is:
Take Order -> Credit Check -> Inventory Check -> Ship
Well, what can you do with an order? You can _create_ one, _look up
one_, _change_ one, or _delete_ one. On an order you can _add item_,
_delete item_ or _update item_.
So it would seem that the object representing an order would have:
Order::New
Order::DeleteByRecID
Order::DeleteByOrderNum
Order::Update
Order::AddItem
Order::ChangeItem
Order::DeleteItem
to handle the Take Order step...
Order::CheckCredit
to handle the Credit Check step...
Next the Inventory step comes up - do we have stock? Do we need a
purchase order? Do we need a factory order? This will probably be
answered in a background process or the like that allocates inventory to
a shipment, creates a factory order, and/or creates a purchase order.
Of course, there will be a Shipment, FactoryOrder, and PurchaseOrder
object with the various business events that change into invocations of
the various methods for a given object.
All this stuff can be done on a web page or PHP background process.
Since the object is abstracted out, I can use them in a PHP background
process or a WWW front end without modification to the object.
>
> What is Note_Add(), Note_Delete(), and Note_Update()? I looked up
> these functions on the PHP function index and they weren't on there.
> Couldn't find anything on Google either.
Answered by another...
Navigation:
[Reply to this message]
|