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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:54:54+00:00 2026-05-15T09:54:54+00:00

I am working through Aaron Hillegass’ Cocoa Programming for Mac OS X and am

  • 0

I am working through Aaron Hillegass’ Cocoa Programming for Mac OS X and am doing the challenge for Chapter 18. Basically, the challenge is to write an app that can draw ovals using your mouse, and then additionally, add saving/loading and undo support. I’m trying to think of a good class design for this app that follows MVC. Here’s what I had in mind:

Have a NSView-subclass that represents an oval (say JBOval) that I can use to easily draw an oval.
Have a main view (JBDrawingView) that holds JBOvals and draws them.

The thing is that I wasn’t sure how to add archiving. Should I archive each JBOval? I think this would work, but archiving an NSView doesn’t seem very efficient. Any ideas on a better class design?

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-15T09:54:55+00:00Added an answer on May 15, 2026 at 9:54 am

    Have a NSView-subclass that represents an oval (say JBOval) that I can use to easily draw an oval.

    That doesn’t sound very MVC. “JBOval” sounds like a model class to me.

    Have a main view (JBDrawingView) that holds JBOvals and draws them.

    I do like this part.

    My suggestion is to have each model object (JBOval, etc.) able to create a Bézier path representing itself. The JBDrawingView (and you should come up with a better name for that, as all views draw by definition) should ask each model object for its Bézier path, fill settings, and stroke settings, and draw the object accordingly.

    This keeps the knowledge of how to draw (the path, line width, colors, etc.) in the various shape classes where they belong, while also keeping the actual drawing code in the view layer where it belongs.

    The answer to where to put archiving code should be intuitively obvious from this point.

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

Sidebar

Related Questions

I'm learning objective-c, working through Aaron Hillegass' book Cocoa Programming for Mac OS X
I am currently working through the famous Cocoa Programming for OSX by Aaron Hillegaas.
I'm working through Aaron Hillegass' book, specifically the lottery example. I had a question
Working through a sample in Chapter 3 of Programming in Scala, the following code
Still working through Programming Collective Intelligence and using Clojure to write the code. I've
I am working through K&R and I've attempted to write a program that prints
I'm working through the book Real-World Functional Programming , and I tried to come
Working through Pro ASP.NET MVC book and I got the following code snippet that
Working through several layers of an MVC architecture designed program, I find that I
I am working through a programming book and I want to branch off of

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.