Advice on data model for new app

Discussion in 'Mac Programming' started by mkmDesign, Oct 7, 2012.

  1. mkmDesign macrumors newbie

    Joined:
    Feb 21, 2010
    Location:
    Scotland
    #1
    Hi everyone,

    I'm planning on developing a pretty basic note taking app for students that would allow them to add a number of Subjects and then create notes against each subject. This is my first time developing with Objective-C and Cocoa so needless to say I have a few questions.

    I'm at the stage where I'm trying to develop the data model for the app. The plan is to have an NSOutlineView on the left hand side that will display all the Subjects for the user and allow them to add/delete them. When a Subject is clicked on, I would like all the related Notes will appear on the right hand side within an NSTableView (along the lines of how iPhoto & iTunes work). At the moment I've created a data source for my NSOutlineView that is an array of Subject Objects. Each Subject object has a title and an array called notesForSubject. This array will store instances of my Notes Object, which at the moment just contains a title and a date. So far I've created a basic app that contains an NSOutlineView and has a button that allows me to create new instances of my Subject class and add them to the data source array:

    [​IMG]

    I'm happy enough with this but I'm stuck on how to get the contents of the notesForSubject array to display when a Subject is selected. I'm just wondering if the way I've gone about setting up my data in terms of classes etc is the best way to do this. I also plan on using core data but I've not got round to learning that yet.

    Just wondering what you guys think? Any thoughts/advice you may have would be much appreciated.

    Thanks
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    I think the model is fine. You'll have a one-to-many Subject to Note relationship. My thought is: what are some ways you might want to extend this? Is "Subject" synonymous with course? If not, does that mean if a student is in an American History course AND World History they have all those notes under one Subject bucket under History? What about next semester? A course may be the exact same subject but a higher numbered course, etc.

    Don't get bogged down with details, but try to assume you'll be extending this and try to pick a design that lends itself to extension. Think about the types of relationships. One course is generally only associated with one semester, but the semester may have multiple courses. One course may fall under multiple categories (Writing and History, Business and Math, etc.), and a Subject will generally have multiple courses, so this may be many to many. Think about which of these is nullable/empty. Can a course be on-going and is not tied to a semester? Can a note be miscellaneous and belong to no subject, course, semester, etc.?

    Is this forever a single user system? If not, do you need to store a user identifier, or is your backing store single-tenet, do each user has their own database?

    I know this all seems over-blown when you've only mentioned two entities you care about, but our humble plans rarely end up being the final product.

    -Lee
     
  3. mkmDesign thread starter macrumors newbie

    Joined:
    Feb 21, 2010
    Location:
    Scotland
    #3
    Funny you should ask those questions Lee, I asked myself the same ones when I started this project. Ideally I would like it setup so that the user would create a new 'Academic year' which would consist of three semesters, say. Then for each semester they would add the subjects they are studying. But that's a bit beyond me at the moment given my limited cocoa/objective-c skills. I'm doing this for a project at university and only have 12 weeks to complete it.

    Thanks for your input.
     
  4. lee1210, Oct 7, 2012
    Last edited: Oct 7, 2012

    lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #4
    What are your requirements for the project? If you only have subjects and notes underneath is this sufficient for full credit? If so, tackle this first. Make this as bullet-proof as you can. Once you have put this completely through its paces, tag this in source control and be ready to turn this in. Then start adding features. Don't bite off more than you can chew at the beginning and never finish. Iterate making it better in phases. This is why you should have an idea of what you might do, and try to set up your designs with this in mind.

    -Lee

    Edit: Also, be as flexible as you can. Let the user start a note with no subject and categorize it later. Allow users to change the subject of a note later, including uncategorized (Your uncategorized could just mean a default miscellaneous category). Let the user search for a note. You are the user, what would you want? Do you need to add diagrams? Use special notation?
     

Share This Page