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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:29:15+00:00 2026-05-10T23:29:15+00:00

I am running into a design disagreement with a co-worker and would like people’s

  • 0

I am running into a design disagreement with a co-worker and would like people’s opinion on object constructor design. In brief, which object construction method would you prefer and why?

    public class myClass     {         Application m_App;          public myClass(ApplicationObject app)          {               m_App = app;         }           public method DoSomething         {           m_App.Method1();          m_App.Object.Method();        }     } 

Or

    public class myClass     {         Object m_someObject;         Object2 m_someOtherObject;          public myClass(Object instance, Object2 instance2)          {               m_someObject = instance;               m_someOtherObject = instance2;         }           public method DoSomething         {           m_someObject.Method();          m_someOtherObject.Method();        }     } 

The back story is that I ran into what appears to be a fundamentally different view on constructing objects today. Currently, objects are constructed using an Application class which contains all of the current settings for the application (Event log destination, database strings, etc…) So the constructor for every object looks like:

public Object(Application) 

Many classes hold the reference to this Application class individually. Inside each class, the values of the application are referenced as needed. E.g.

Application.ConfigurationStrings.String1 or Application.ConfigSettings.EventLog.Destination 

Initially I thought you could use both methods. The problem is that in the bottom of the call stack you call the parameterized constructor then, higher up the stack, when the new object expects a reference to the application object to be there, we ran into a lot of null reference errors and saw the design flaw.

My feeling on using an application object to set every class is that it breaks encapsulation of each object and allows the Application class to become a god class which holds information for everything. I run into problems when thinking of the downsides to this method.

I wanted to change the objects constructor to accept only the arguments it needs so that public object(Application) would change to public object(classmember1, classmember2 etc...). I feel currently that this makes it more testable, isolates change, and doesn’t obfuscate the necessary parameters to pass.

Currently, another programmer does not see the difference and I am having trouble finding examples or good reasons to change the design, and saying it’s my instinct and just goes against the OO principles I know is not a compelling argument. Am I off base in my design thoughts? Does anyone have any points to add in favor of one or the other?

  • 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. 2026-05-10T23:29:16+00:00Added an answer on May 10, 2026 at 11:29 pm

    Hell, why not just make one giant class called ‘Do’ and one method on it called ‘It’ and pass the whole universe into the It method?

    Do.It(universe) 

    Keep things as small as possible. Discrete means easier to debug when things inevitably break.

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

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • 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
  • added an answer Hmm, something like FlexBox? May 11, 2026 at 11:23 am
  • added an answer It's really quite easy to 'running a domain' (a website,… May 11, 2026 at 11:23 am
  • added an answer A few thoughts: There is JSUnit, a unit test framework… May 11, 2026 at 11:23 am

Related Questions

I am running into a design disagreement with a co-worker and would like people's
I am running into a randomly occuring issue, and it looks like either there
I am creating a little testing component and am running into a problem Basically
I am currently running into a problem where an element is coming back from
I am running into quite an annoying issue while trying to deserialise a specific
I am trying out moq and I'm running into a problem with the following
I am using NHibernate on a new ASP.NET project, and am running into what
I am trying to get some XML data with LINQ, but running into a
I've recently changed to Mate as a framework for flex. However am running into
I've compiled a java project into a Jar file, and am having issues running

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.