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 5954573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:59:25+00:00 2026-05-22T17:59:25+00:00

So I have a large class that I’m refactoring to be more flexible. well

  • 0

So I have a large class that I’m refactoring to be more flexible.

well over 100 configurable properties (variables) in a INI file. Some are dev settings and others are production settings.

Currently I use a environment flag to pull the INI settings I need (either dev or prod).

All the INI fields are mandatory and must be set. (currently using setters for this).

So what makes more sense?

  • A: to keep the current setup
  • B: Move to another type of configuration setup (like xml or something)
  • C: Move all settings into the script itself and remove the INI parsing and validation code (setters)
  • D: suggestions?

Bonus question:

I was reading this over the weekend: http://berryllium.nl/2011/02/getters-and-setters-evil-or-necessary-evil/ and wanted to know how I could follow more of this type of development style but confused as how to not use getter/setter functionality with setting mandatory fields? I understand the need to getters/setters and wanted to know if I’m implementing them correctly?

I use the INI for stuff like DB settings, validation limits (think spending limit of $100 but could change), large array (static values like the 50 US States but with the ability to add US territories as well)

  • 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-22T17:59:25+00:00Added an answer on May 22, 2026 at 5:59 pm
    • If you want to keep settings
      readable, keep the current setup or
      move settings into PHP script (but do
      not hardcode them into classes).
    • If
      you want to increase performance –
      use JSON format or PHP script –
      json_decode works faster, PHP script
      works faster and can be easily cached
      by APC.
    • As variant, you can parse
      the settings file once and put all
      settings in cache (APC or memcache).

    Also. I think nobody cares, but I have my opinion about getters and setters 🙂
    Getters and Setters aren’t evil. Idea of Encapsulation is not just hide fields, but hide, how class works. Getters and setters can be declared in interface, so you can replace one object by another – and it is what for encapsulation was invented!

    Let’s take example from article of Berry Langerak – withdraw and deposit it’s setters. All this code can be successfully done in setBalance method, almost nothing will be changed. All these checks, comparison – it’s usual work of setters.

    Why public fields are evil? Because object can’t control their changing and because they can’t be declared in interfaces. Getters and setters can do it, so it’s perfect tool of OOP.

    Accessors can be written silly, of course, but it doesn’t mean that they are evil. Any method in the class can be written silly.

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

Sidebar

Related Questions

I have a large activity that contains 100 or more buttons. But it's working
If you have a large class that executes after output(headers/text) is already sent, will
I have a class that parses very large file (that can't fit in memory)
I have a large class ClassA that I defined in a Code::Blocks Project ProjectA.
I have a very large, spread out class that is essentially a very contrived
I have a class that uses the __set magic method. One of the properties
I have a large class that contains about 30 methods. Is it possible to
I have a structure (class) that keeps very large number of numbers (either float,
I have extended a class that is part of a large library. I instantiate
Quick question: If I have a very large function/sub in a class that is

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.