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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:29:23+00:00 2026-05-15T06:29:23+00:00

So I started reading this book: http://www.amazon.com/Cocoa-Design-Patterns-Erik-Buck/dp/0321535022 On chapter 2 it explains about the

  • 0

So I started reading this book:
http://www.amazon.com/Cocoa-Design-Patterns-Erik-Buck/dp/0321535022

On chapter 2 it explains about the MVC design pattern and gives and example which I need some clarification to.

The simple example shows a view with the following fields:
hourlyRate, WorkHours, Standarthours , salary.

The example is devided into 3 parts :
View – contains some text fiels and a table (the table contains a list of employees’ data).

Controller – comprised of NSArrayController class (contains an array of MyEmployee)

Model – MyEmployee class which describes an employee.
MyEmployee class has one method which return the salary according to the calculation logic,
and attributes in accordance with the view UI controls.
MyEmployee inherits from NSManagedObject.

Few things i’m not sure of :
1. Inside the MyEmplpyee class implemenation file, the calculation method gets the class attributes using sentence like
” [[self valueForKey:@”hourlyRate”] floatValue];” Howevern, inside the header there is no data member named hourlyRate or any of the view fields.

I’m not quite sure how does it work, and how it gets the value from the right view field. (does it have to be the same name as the field name in the view).
maybe the conncetion is made somehow using the Interface builder and was not shown in the book ?

and more important:
2. how does it seperate the view from the model ? let’s say ,as the book implies might happen, I decide one day to remove one of the fields in the view.
as far as I understand, that means changing the way the salary method works in MyEmplpyee (cause we have one field less) , and removing one attribute from the same calss.
So how is that separate the View from the Model if changing one reflect on the other ?

I guess I get something wrong… Any comments ?
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-15T06:29:24+00:00Added an answer on May 15, 2026 at 6:29 am
    1. The valueForKey: method implementation is discussed here. Note that valueForKey: can actually access the ivars directly without calling any methods.

    2. If you remove a column from your NSTableView you don’t have to remove it from your model object class. It’s still there, it just doesn’t get displayed.

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

Sidebar

Related Questions

I just started reading this book Eloquent Ruby and I have reached the chapter
I have just started reading Modern C++ Design Generic programming and Design Patterns Applied
I recently started reading Evans' Domain-Driven design book and started a small sample project
I started reading Holub's pattern book and not sure if this is a mistake
Forgive if this question is silly. I just started reading the SugarCRM developer documentation
I've started reading the Enterprise Java Beans 3.0 book by Bill Burke and Richard
I've just now started reading an Algorithms book that defined Graphs as follows: Graphs
I'm just getting started with REST and I've been reading this post and the
I'm new to D programming language, just started reading The D Programming Language book.
I've recently wanted to give Scala a try and I started by reading book

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.