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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:00:52+00:00 2026-05-30T23:00:52+00:00

In my project, I want to use object pool for different types of objects

  • 0

In my project, I want to use object pool for different types of objects — with similar behavior, but different pool sizes.

Should I create generic class for a pool and interface to apply to created objects, or should I create abstract pool class with common logic and then create specific sub-classes for all the different classes that I want to use it with?

  • 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-30T23:00:54+00:00Added an answer on May 30, 2026 at 11:00 pm

    Well you can have both things i.e create an abstract generic class. I would prefer a generic interface implemented by a generic class and instantiated for a specific type behind a factory method/class. Abstract class will force creating derived classes making it more tedious. The example usage that I have in mind are something like

    IPool<MyClass> = PoolFactory.Get<MyClass>(5);  // 5 being pool size
    IPool<IFoo> = PoolFactory.Get<FooImpl>(5);
    IPool<IBar> = PoolFactory.Get(5, () => new BarImpl("some argument")); // instance creation with factory method
    

    Note that it can still leave me a scope for specialization by inheriting from the generic class – typical need would be a complicated instance creation (of course can be modeled by supplying the pool implementation with factory interface or factory delegate)

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

Sidebar

Related Questions

I work on a project and want to use an ORM. What should I
I want to use cookie in my project. But now i m using session.
I want to use the RapidShare API in my project,but I don't know how
I am developing an ASP.NET MVC project and want to use strongly-typed session objects.
I'm rewriting a JavaScript project, and I want to be able to use object
I want to use Application_Error with my MVC project, but i can't get it
I am using django 1.1 beta release. In my project I want to use
I'm working on a new project where I want to use Phil Haack Areas
I want to use MAF in my project because I need a robust add-in
I want to use Lucene in my project. When I simply copy the .jar

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.