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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:11:57+00:00 2026-06-03T21:11:57+00:00

my boss insisting on the following rule: all variables passed into constructor should be

  • 0

my boss insisting on the following rule: all variables passed into constructor should be available through a read-only property.

I don’t see a real reason why this should be true, because class should do that it’s supposed to do and not to provide theirs structure to others. I understand that sometime it’s useful, but it isn’t general rule.

Are my thoughts correct? Am I missing something? Anyone can add more arguments or oppose to that?

Example of rule:

 public class MyClass
 {
      public MyClass(ISomeProvider someProvider)
      {
          SomeProvider = someProvider;
      }
      public ISomeProvider SomeProvider { get; private set; }
      public void DoSomeWork()
      {
          ...
      }
 }

Thank you.

  • 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-03T21:11:59+00:00Added an answer on June 3, 2026 at 9:11 pm

    Personally I would say no… I never believe there is one rule that fits all. If the parameters are used internally to the class then there is no need to expose them.

    If you passed a ‘raw’ string password into an encryption class you wouldn’t expect the raw string to be accessible throughout the lifetime of the object, in fact doing so may present a security risk.

    On the flip side though, sometimes you have to follow the standards set out by the team/manager. If you think the principle is wrong discuss this detailing the arguments for/against the idea.

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

Sidebar

Related Questions

My boss is asking me to code a report that has the following components:
My boss just asked me to integrate his bosses old Fortran code into a
My boss said I should use null == obj , because it's better than
My boss wants the following: Requirements: Stream m4v videos from our Web-server to clients
My boss asks me to write only ANSI SQL to make it database independent.
My boss announced yesterday a new commit policies for checkins into the repository. This
My boss asked me to do a research on available CMSes on market because
My boss wants me to encrypt some information used during data transfer. The individual
My boss believes that wizards make things simple for the user. I think they
My boss is running a laptop which has a setting which is resizing font

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.