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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:44:01+00:00 2026-05-24T23:44:01+00:00

According to the Document-Based Applications Guide , there should be a DocumentController, a Document,

  • 0

According to the Document-Based Applications Guide, there should be a DocumentController, a Document, and a WindowController. What I am having trouble with is learning to judge where a given responsibility ought to fall.

My Document represents a todo list. A given todo list is read into memory by my Document, and it is displayed by the WindowController. The number of todos that can fit in the window at any time is determined by the size of the window, so when I need to display todos my WindowController asks my Document for enough todos to fill the visible list.

If I want to I can search through my todos using regular expressions (I know, fancy right) and the matches are returned as the top results. In this case I’m less clear on where the responsibilities lie. The Document deals with saving and loading a todo list, but above I have asked it to also deal with returning small parts of the list to the WindowController. Should the matching logic go in the Document then? Or should this stay in the WindowController since it has nothing to do with saving and loading data (the order of todos after a search is never saved to disk)? These are the sorts of questions I find myself asking (myself). When I look back on a project like this one, I notice places where my judgement calls seem at odds with each other. Sometimes I’ll spend an hour just moving one bit of logic around between the two… trying to imagine which design makes more sense.

Clearly I need help.

My example is of a very particular situation, but I am not interested in the particular solution. I am interested in knowing in more general terms what the responsibilities of these three classes ought to be. I read the guide and I’ve googled around a bit, but I still can’t seem to get a handle on it.

This question was helpful, but I am still confused.

Thanks!

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

    My instinct in this case would be to put the logic in the window controller. The search functionality is not affecting the actual model, and I think of NSDocument as more of a “model-controller”.

    NSWindowController is a better fit for managing the details of the UI (a “UI-controller”), and essentially you are just controlling the view of the model with your search bar.

    Yes, I know that we have NSViewController as well but sometimes that’s just additional complexity for the sake of it. Much of the time, NSWindowController is just fine.

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

Sidebar

Related Questions

According to mysql document Encoding with a 128-bit key length is used, but you
According to the 'Microsoft Office Word™ 2003 Visual Basic Reference', it seems the Document
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
We've got a file-based program we want to convert to use a document database,
I have a function that grabs an XML document and transforms it according to
According to Wikipedia NoSQL article , there are a lot of NoSQL implementations. What's
I am going back though a web-based document numbering system from few weeks ago.
According to this Oracle document , it seems that for Windows Server 2008 R2,
Im having some trouble getting on with my first codeigniter project, and i have
I have document based application. It worked fine until I decided to change data

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.