I’m a structural engineer and have written some in-house structural calculation applications for use on our macs. I have been really impressed with Apple’s Core Data framework and how easy it is to make a graphical object model, link to custom classes and have the built in frameworks handle all of my open and save functionality. Now I am looking to write the same kind of application for Windows using Visual Basic 2010 express.
I am fairly comfortable with VB and am well versed with Object Oriented programming. So onto my question:
My application will need to store the properties for some custom objects I wish to perform calculations on. For example a beam or column object I wish to check the strength of. I need to store things like the length, material, loading…etc. Mainly numbers, boolean, and text data. Some of these elements are linked together so I need to store a reference to another object or array of objects.
Should I write a bunch of custom classes to model my data and then Serialize them to a custom file type, or it is recommended to use some sort of database to store this data? I don’t have any experience with database programming. Am I able in VB2010 to have a database with a custom file extension that I can open, save, saveas, just like a regular file? It seams that every database example I have seen involves hooking up to a pre-existing database. In my case, each new job would require a new file / database to store all of my project objects / data / calculations.
What do you recommend?
There are essentially two questions here:
As far as data within the application, you are on the right track with custom classes for each object.
For storage, this depends on your needs. If you feel that you will have a ton of data and you need to do any kind of sorting or querying on those records, then a database is the way to go. If not, you can certainly consider using your own custom file type where the instances of your classes are serialized.