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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:37:11+00:00 2026-06-13T09:37:11+00:00

In my project there is a document management system. There is a base Document

  • 0

In my project there is a document management system. There is a base Document class and some derived classes. There is also a DocumentManager class which manages the open/close/activate operations of documents.

The Document and its derived classes may want to do something upon being loaded, closed, etc, but the state change is controlled by the manager class, so currently there are (virtual) methods like OnLoaded(), OnClosed() on the Document class called by the DocumentManager class. It works fine except exposing these methods to public seems unnecessary.

An alternative design is to make DocumentManager class firing events and each Document instance subscribe to these events. IMHO it doesn’t make a big difference yet introduces the risk of memory leak.

I have a gut feeling that none of these is “the solution” and there is a best practice right for the problem. Can someone enlighten me please?

  • 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-13T09:37:12+00:00Added an answer on June 13, 2026 at 9:37 am

    My gut feeling, though it’s difficult to be sure without knowing the specific requirements of your project, is that you’ve got logic in your DocumentManager class which should probably be in the sub-classes of your Document class.

    I would imagine a (potentially abstract) Document base class with public load, close and whatever methods. Each sub-class would implement those methods according to its specific requirements allowing you to easily create any number of Document sub-classes, without the logic in the DocumentManager needing to change (see polymorphism). If those operations are asynchronous, your Document classes would dispatch events to inform the DocumentManager that they had completed.

    This would leave the DocumentManager with the single responsibility of managing (I’m assuming) its collection of Document instances.

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

Sidebar

Related Questions

I've got a document management system which I programmed in Rails 2.3.8 a while
In my project there is a listview which contains textview and checkbox..Here is my
In my project there are large no. of FIXME / TODO which are to
In my project there are some 'Prototype' factories that create instances by cloning a
Is there a project (open source) that takes the widgets and plugins for jQuery
I'm trying to do some customization of a Trac project management website and have
In my project there are certain directories and certain php files which are very
Are there any document databases and/or key-value stores (something like Project Voldemort, MongoDB, etc.)
There is a key chord to highlight the current document in the project drawer
which project management solutions do you know, which fullfill the following contraints: Report customer

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.