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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:50:59+00:00 2026-05-14T15:50:59+00:00

I have multiple business entities in VB.NET Windows Forms application. Right now they are

  • 0

I have multiple business entities in VB.NET Windows Forms application. Right now they are instanced on application startup and used when needed. They hold descriptions of business entities and methods for storing and retrieving data. To cut the long story short, they are somewhat heavy objects to construct (they have some internal dictionaries and references to other objects) created and held in one big global variable called “BLogic”.

Should I refactor this so that each object is created when needed and released when out of scope? Then every event on UI will probably create a few of this objects.

Should I strive to minimize creation of new objects or to minimize number of static and global objects? Generally I am trying to minimize the scope of every variable but should I treat this business logic objects specially?

  • 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-14T15:51:00+00:00Added an answer on May 14, 2026 at 3:51 pm

    Let’s look at the two options you’ve presented:

    Single Global Instances

    Pros:

    • Less performance cost in each method because the objects are already created
    • No need to figure out how to pass the data around

    Cons:

    • Chance that objects are created but never used. This is a waste of both memory and performance. This could be mitigated by using lazy initialization that will create the object the first time it is used but still keeping a single globally created instance.
    • Multithreading concerns such as ensuring data consistency (potential performance and development costs)

    Unique per function instances

    Pros:

    • Each function gets it’s own copy and does not have to worry about what other functions may be doing at the same time.
    • If the objects are not being constantly created and destroyed, you may have a lower total memory usage for your program.

    Cons:

    • Depending on how long it takes to create the object, you could have responsiveness issues in the UI.
    • Depending on how the object is created, you may have to wait for another function to finish creating the object before you can create your copy.

    This is not meant to be an exhaustive list, but it does point out the main tradeoffs as I can see them. Obviously, you know more about the situation and which tradeoffs are acceptable. A few judiciously chosen globals can be useful, but like most people I would lean away from having a lot of globals unless they represent something that there can only be one of, like a SerialPort, or something that the entire application should only have one of, like an ApplicationSettings class.

    Don’t undervalue your time (both now and later when you come back for maintenance) as a cost. Sometimes a “better” solution may actually be worse because it takes too long to implement. Often “good enough” turns out to be, well, good enough.

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

Sidebar

Related Questions

I have a Swing application in which I have multiple windows with different goals
I have multiple business objects in my application (C#, Winforms, WinXP). When the user
We have a business case that would be perfect for multiple BackgroundWorkers. As an
I have multiple forms for lots of products on my page and want to
I have a business model with many classes in, some logical entities within this
The Scenario Currently I have a c# silverlight business application. The application is hosted
I have multiple user account types, each with different information. For example, business contacts
i have multiple repositories in my project for different entities and each has it's
I have been given to develop a web application that can have multiple presentation
I have a tech demo application to write, with multiple clients: web client (ASP

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.