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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:04:46+00:00 2026-05-23T22:04:46+00:00

I am creating a text editor. My text-box control is a subclass of TextBox

  • 0

I am creating a text editor. My text-box control is a subclass of TextBox called Editor. My main form, MainForm, has an instance of Editor.

When MainForm wants to, say, load a text document, it calls Editor.LoadDocument(string path). Editor.LoadDocument calls Document.Load(string path).

The same kind of thing happens with save: MainForm --> Editor.SaveDocument --> Document.Save.

It seems that Editor is acting as a middleman unnecessarily here, so I’m thinking of just letting MainForm access Document directly: editor.Document.Load(path). Editor would still create and maintain Document; it would just provide direct access to it.

Note that this would create a bidirectional association: Editor would have a Document and Document would have an Editor (Document uses Editor.Text and subscribes to Editor.TextChanged).

I have two questions:

  1. Is this good design?

  2. Do bidirectional associations create any slowdown pertaining to garbage collection when the app exits?

  • 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-23T22:04:46+00:00Added an answer on May 23, 2026 at 10:04 pm

    You need to read about patterns such as Model-View-Controller.

    Generally, the UI should activate operations directly on the model (Document in your case), and then the view (Editor) should be subscribed to events and act as an observer.

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

Sidebar

Related Questions

I am currently creating a basic text editor that has basic functions such as
I'm creating some text boxes on my form programmatically which I need to reference
I've been looking into creating a Rich Text editor, and at first I was
I need to swap out the out-of-the-box rich text editor with the Telerik editor
I'm creating a rich text editor. Basically I have an iframe with design mode
I'am doing a simple text editor that I need to handle creating paragraphs. Paragraphs
I understand that creating a WYSIWYG/Rich Text Editor is an absurd thing to do
I'm creating a text editor and I want users to be able to select
I am creating a plugin for TinyMCE, which is basically a form that has
When creating a cross-browser rich text editor. Which would you use and why? Keep

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.