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

  • Home
  • SEARCH
  • 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 9121601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:53:58+00:00 2026-06-17T05:53:58+00:00

I have a class that stores some temporary data. This class has deleteOld method

  • 0

I have a class that stores some temporary data. This class has “deleteOld” method for clearing expired data.

Is it a good idea to pass parameter to that function to set expiration period? I mean something like deleteOld(expiredDays).
Or this function should encapsulate expiredDays parameter?

deleteOld()
{
  // get expiredDays from config
}

‘expiredDays’ is constant that set in config.

First variant looks more flexible. But second one looks more OOP, beacuse class clients doesn’t need to know anything about expiredDays. Second way doesn’t reveal details of class realization.

It is PHP, but I guess it is doesn’t matter

What do you think? Thanks.

  • 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-06-17T05:53:59+00:00Added an answer on June 17, 2026 at 5:53 am

    It always depends, mostly on business logic. If a value controls some aspect of the business logic, it can be given as a parameter. That is what parameters are for.

    In your case I think that expiredDays is a business matter for managing the stored data, so revealing this is no problem. Except your business logic requires that nobody from outside shall change it. As I said, it depends.

    What you won’t to be revealed is probably the way, how the data gets stored (filesystem, DB, …).

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

Sidebar

Related Questions

This is C# 4.0. I have a class that stores WeakReference s on some
I have a controller with a method that handles incoming GET data, stores some
I have a Python class that stores some fields and has some properties, like
I have a class that stores data in asp.net c# application that never changes.
I have a mother class that stores the pointers to some objects in a
I have a java application that stores some GPS data in a strange format:
I have a utility class that stores methods that are useful for some unit
I have a C++ class Finder that stores a location in containers plus some
I have a class that keeps data stores/access data by using words.separated.by.dots keys and
I have a class method that returns a pointer to an inner data structure

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.