Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 677819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:04:52+00:00 2026-05-14T01:04:52+00:00

I’ve read Head First Java, and I understand how OOP works. Here’s my problem:

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:04:53+00:00Added an answer on May 14, 2026 at 1:04 am

    Well in your example, I’m not sure why in your design there’s only one document, but it should still be an object in case at a later point you want more than one.

    As far as the delete function, there’s really no straightforward answer; you’re likely to find arguments on both sides. Myself, I would put the lower level delete functionality (things like deleting database entries) inside the document class, but any other functionality may go in the parent. If all documents are owned by an admin, the admin should have a DeleteDocument which calls delete on the document, and also removes all associations from the database.

    In general, coming from procedural, if you ever find yourself passing around a big array of state variables or declaring lots of globals, then turn that related functionality into a class. Try to keep the functionality that an object contains as closely related as possible, or you may find your classes bloating way out of control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 362k
  • Answers 362k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It is simply a variable. Remember that stored procedures can… May 14, 2026 at 3:03 pm
  • Editorial Team
    Editorial Team added an answer One possible SQL query would be: SELECT UserName ,Date ,sum(Price)… May 14, 2026 at 3:03 pm
  • Editorial Team
    Editorial Team added an answer Should be a good start: int main(int argc, char* argv[])… May 14, 2026 at 3:03 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.