Best solution for storing data for a budget app

Hi,
1st a little background on me. I’m currently retired but I’ve been programming professionally since 1980. Since 2000 I’ve been writing the “model” side of the house (with some web experience) in Java using Oracle RDBMs and IBM MQSeries for a Fortune 10 health insurance company. I understand programming, just not the paradigm of mobile and iOS. Last year I took the Code With Chris series on programming apps and feel I’ve learned enough to write my own application.

I want to write my own personal budge app that would have budgets by the month with income and expense and spent data showing the amount of budget not spent or over spent. I’d store this data locally with an idea that it might be in the cloud later to sync across devices.

What I am unsure of at this point is what would be the best data store to use. In Code With Chris we looked at lightweight JSON, but I suspect there are other alternatives. I’m trying not to go “industrial” strength and over kill or complicate the coding, but don’t want to be sorry I went with something like JSON when there might be a better alternative. Any thoughts would be greatly appreciated.

Bob

Hi Bob. I think the point at which you become sorry you used JSON might be 1) when you start to notice loading times if you are sucking in a whole lot of JSON on startup, and 2) if you start to need to use relationships. Obviously that’s something you understand given your experience but whether it matters depends on how you want to manage and present the data.

In any financial app I can imagine there would be a Transaction object, and these would have necessary relationships perhaps to an Account object and maybe to a Type object (business expense, food, etc.). So if you do begin with a sensible managed object model you will make retrieving and accessing data a little easier - for example display a list of accounts for selection (fetch request for “Account” entity, no predicate), then once the account of interest is chosen use the “transactions” relationship to display all transactions, because you have them all by faulting the relationship.

Hello and thank you for your reply. I agree that the data model would be relational and I was having trouble designing a JSON structure to support that. I would ask you if you have thoughts on the relational data base support that is available on iOS. You can see that I’m still very new to this platform. I’ve been muddling around for over a year on this and I realize that academic study will only take me just so far. The way that I learn best is to just DO IT. So I’m going to start… I’ve seen references to SQLite. Do you know anything about that?

Thanks in advance,
Bob

I strongly recommend Core Data. I’ve had a lot of success with it in several projects and while I kind of understand why people complain about it (especially if they have used something they feel is better on other platforms) I also kind of don’t. It may be that it runs into trouble when data just gets too big but if you keep your model sensible and don’t try to make it too fancy it does the job well. Additionally it is what Apple expect you to use so there is a lot of support for feeding views with Core Data-backed information, like NSFetchedResultsController.

SQLite is what is underneath Core Data - and once you create your Core Data structure you can dig into the simulator or device’s file structure and find the sqlite, then browse or manipulate it with your favourite SQL editor. But - you don’t have to touch it if you don’t want to. Core Data is a layer on top of the underlying database and if you follow the path of least resistance you would never know it is there.

Hello, and thank you again for replying to me. I will certainly look into Core Data. I see that there are training materials available on the raywenderlich site. So I’ll pursue training in that. Today I did download and install SQLite on my MAC and I’ll probably play around with that too. I have a good background in SQL on Oracle in Java so we’ll see whether or which data store will work best. My data will certainly not be large and I expect either solution will work for my needs. Thanks again,
Bob

Is it this app? I tried this one out a few years ago on a project and found I liked it a lot.

Hello,
Actually I downloaded the SQLite source from the SQLite home page and compiled and installed it on my Mac. Once I had that figured out I wanted to get a GUI for it much like the tool I used on our AIX systems which was called “Toad”. Why that name I never knew :slight_smile: Anyway I found two free GUI tools that I downloaded and tried. SQLiteStudio and DB Browser for SQLite. Both of these will probably meet my current needs while I’m learning. I did download the app that you suggested and it looks good, but I’m going for free for now. :grinning: I did buy the Core Data book from this site and I’m now going to spend some weeks getting familiar with SQLite and Core Data before I continue my app building.

Thank you for taking the time to have a dialog with me. It’s been very helpful.

Bob