Learning OOP Design
Posted
by waiwai933
on Stack Overflow
See other posts from Stack Overflow
or by waiwai933
Published on 2010-03-21T22:58:08Z
Indexed on
2010/03/21
23:01 UTC
Read the original article
Hit count: 398
oop
|object-oriented-design
I've read Head First Java, and I understand how OOP works. Here's my problem: I'm a PHP programmer, and while I've used OOP in PHP, I'm having trouble figuring out what should be an object and what methods to give it.
For example, let's say I have a app that allows people to log in and edit a document. Why should the document be an object if there will ever only be one instance? Should I give the deleteDocument()
method to the document object or the admin object? The document is the one being deleted, but the admin is the one performing the action.
So my real question is, coming from a procedural background, how do I figure out what should be objects and what should have what methods?
© Stack Overflow or respective owner