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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:29:46+00:00 2026-06-01T20:29:46+00:00

I am making an app for manipulating matrices and I’d like to know how

  • 0

I am making an app for manipulating matrices and I’d like to know how to set up a good MVC system for it.

Basically, I’ve got that I’ll need 3 main things:

  1. MatrixRow (holds the entries of each row and can manipulate the rows by multiplication)
  2. Matrix (holds a bunch of matrix rows, and can add new rows, subtract rows, change rows)
  3. ProblemViewController (shows the matrix and allows user to interact with the matrix to solve it)

But I’m confused mainly with when to use a View, or a ViewController. Views seem easier for MatrixRow and Matrix because they’ll just ultimately be subviews added to the ProblemViewController, but is it acceptable to throw in logic into a view?

In terms of models, do I make a Matrix model which has an array that holds all the entries? And a MatrixRow model which holds all the logic to multiply rows? Or is logic not supposed to be in a model.

  • 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-01T20:29:47+00:00Added an answer on June 1, 2026 at 8:29 pm

    But I’m confused mainly with when to use a View, or a ViewController.
    Views seem easier for MatrixRow and Matrix because they’ll just
    ultimately be subviews added to the ProblemViewController, but is it
    acceptable to throw in logic into a view?

    The whole point of the MVC architecture is to separate data and business logic (model) from presentation (view). You might have view classes that know how to display matrix rows, or entire matrices, but the objects that actually store and manipulate the data should be separate from those.

    A model for your matrix could look something like this:

    @interface Matrix : NSObject
    {
        int rowCount;
        int columnCount;
        double *entries;
    }
    
    - (id)initWithRows:(int)rows columns:(int)columns data:(double*)data
    
    - (double)entryAtRow:(int)row column:(int)column;
    
    - (void)setEntry:(double) forRow:(int)row column:(int)column;
    
    - (Matrix*)matrixByMultiplying:(Matrix*)m;
    
    - (Matrix*)inverse;
    
    - (Matrix*)transpose;
    @end
    

    So the Matrix class stores the data, and it provides operations that make sense for a matrix. It doesn’t know how to display the data on screen, or where the data comes from, or how a given matrix might be used in your application.

    In terms of models, do I make a Matrix model which has an array that
    holds all the entries? And a MatrixRow model which holds all the logic
    to multiply rows? Or is logic not supposed to be in a model.

    Exactly how you set up your program is partly a matter of personal preference — some people seem to like very bare models that do nothing but store data. Personally, I’d put everything in the model that’s relevant for a matrix in general and leave out everything that’s specific to how you plan to present matrices within your app.

    Imagine that you’ve just finished your app, and your next task is to convert it to provide a completely different kind of user interface, like a command line interface or a web interface. If you were to do that, would you expect to have to rewrite your matrix multiplication code? Would the definition of the matrix inverse change? “No” on both counts — those things belong in the model. Your entire Matrix class should be reusable in a program that does the same thing but provides a different UI.

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

Sidebar

Related Questions

I'm making an app which uses push notifications, and I know that I need
I am currently making an app that will have multiple timers, which are basically
I am making an app that should implement a slider menu like the one
I am making an app that allows the user to set an alarm based
I'm making an app that is kinda like iBooks. There is some stuff on
I am making app that takes a screenshot of a URL requested by the
I am making app about google documents. but I don't know How to save
Im making an 'app like' web page. The actual page is wider than the
I'm making another app's window topmost to ensure that a click in my app
I am making an app that scrolls information on the desktop. The window is

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.