Hi, I am working on my next year's school project for my A levels, and I need a bit of help in deciding how to continue my program's design. Basically the project involves writing a stock managment software, for a fictional company.

Now at the core of this programm lies the database containing all the information regarding the stock. My question is, how should I design this database, should I use some RDBMS or should I just write some stucts or better yet classes that relate to each other through some methods and then write them to a binary file?

Mind you even after learning the whole Data Base unit of studies I have no clue whatsoever on how I should go about accessing the content of that database from my c++ programm, since the course material is all theory and no practice. However I am willing to learn if it is the correct way it should be done.

Thanks in advance for any help.

8 Years
Discussion Span
Last Post by Bruynz


Usually such project is based on OOA/OOD, therefore realising such a design with c++ well structured classes incorporated in convenient design pattern (mvc, facade etc) are a must.

How to realize persistently stored data is another question.

Stock management requires complex data model and consists of many entities which are related to each other so inserting, updating, or deleting entity data aren't simple tasks. Using binary files for that require enormous individual programming efforts and the result would be a rather imperfect propritary data management system for stock management.

So to keep your additional c++ costs low and to get instant access to all these great data management functions you would have else implemented in a sweat-inducing way you should make use of a relational database. Using a RDBMS within C++ is standardized and rather simple. There are lots of tutorials on the web, also on daniweb this topic has been covered more often. I myself prefer ODBC, plain C or class-oriented interfaces as well as. As for the database, I am usually fond in MS SQL Server and Sybase SQL Anywhere (if I have the option, I wouldn't harm myself with mys..).

If you decide for relational database, I immediately suggest you to design a complete entity relationship model (ERM) of your stock management first before starting to implement data models on your chosen database. I myself believe the ERM is the most important task to map real-world requirements successfully and effectively into a relational data model. Recently I swapped from some older tools to visual paradigm which is great for designing UML (OOA/OOD) and ERM too.

-- tesu

Edited by tesuji: typotypo


Well, I think tesuji answered pretty well, but if I may add something to answer your original question:

>>should I use some RDBMS or should I just write some stucts or better yet classes that relate to each other through some methods and then write them to a binary file?

Why not both? I mean using a RDBMS does not substitute for the OOD of the software. You don't want to have a software full of random spaghetti-like database calls everywhere. You should still make those fancy structs and classes to best represent and work with your data structures, then just implement them such that they store their information on the database (and you probably also want to buffer the data temporarily in the structs/classes to limit the data-traffic). That is the fundamental idea of encapsulation.


Yes, and yes.

My $0.02: A real stock management application would most likely need a proper server-based database system. For a class project, however, may I suggest SQLite? It runs as part of your application, so there's no overhead of installing, configuring, and maintaining a server, but it's still a fairly complete RDBMS, so you should be able to move to a server-based database without too much hassle if you ever need to.


Hi thanks for the answers.

gusano I infact came accross SQLite and decided I would use it for my project, especially since I need to do a class demonstartion on the school's computer which doesn't even give the lecturer permission to install a software and is at the moment lacking any DBMS whatsoever. Also it means, for now I can do without ODBC which was starting to give me headaches similar to those when I tried to dabble in win32.

Write now I am designing the UML Class Diagrams, and DFD for the project and later I should finish the JSP I started. Ultimatley untill school start I can only work on the framework for the application as I will have to discuss the particular scenario in which the application will be used with my lecturer.

Anyways thanks again for the replies.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.