r/learnprogramming • u/Horror_Preference208 • 17d ago
Pseudocode and project planning help Working on my first project
The professor has assigned us a task that asks us to develop a basic information system for a hospital(departments, staff, patients, network-connected computers). Its for a first semester course so i am guessing it's pretty basic. It wants me to make a database and connect my program to it. I honestly don't know how to start on the C code. So far, my teacher has essentially been telling us what to do because she is teaching us the syntax and basics(we've only studied C in practical labs and not in any theoretical class). I don't want to get reliant on AI to think and i don't want to get stuck in tutorial hell like people warn about. I don't know how to start without these two things. We haven't even been taught how to connect a database to a program but the deadline is next week so i need to figure it out a little at least. Any tips on how to start without it taking up a huge chunk of time that i need for other assignments?
2
u/Rabbit_Brave 17d ago edited 17d ago
What database are you using? Something like sqlite?
Whatever it is, if you want to do it the traditional way, then you need to look up the documentation and the c api for it, e.g. https://www.sqlite.org/cintro.html and https://www.sqlite.org/quickstart.html for sqlite.
[edit]
I was just thinking, if this is an early programming course, then "database" may just mean reading and writing files in any format of your choice. In which case, I guess begin by defining structs for each type of entity in the hospital, and then write a function for each that encodes the data in a string, and another function that takes a string and fills in a struct.
2
u/knouqs 17d ago
Geez, that's a tall ask for someone with only beginning C skills. Do you know anything about databases? What other knowledge do you have that would make it easier for us to direct you to a solution?
1
u/as400rocks 17d ago
You have to be kidding? You are using C? Note Python or Java or even C++?
1
u/rsham004 17d ago
Use and embedded library to use sql commands to create tables. One is selected lite.
Just start and you will get there.
1
u/BusinessStrategist 17d ago
Google "software architecture."
You need to think at the "systems level" to figure out how best to achieve your software solution.
1
u/FreeLogicGate 17d ago
I am going to guess here that your teacher expect you to use a SQL database. The advantage of that is that defining tables can be done with SQL code, and your client code can assume the structure of the tables. Probably you want to use either sqlite or mysql/mariadb. There is a C library client for both databases. There are some C++ wrapper libraries that exist, but if this is a pure C class, I'm guessing the expectation is that you'll just use the client library. The code isn't all that difficult, but way you get access to those libraries depends on your workstation OS.
The main difference between the 2 is that sqlite is meant to be used as an embedded database, so it has no separate server. The sqlite files are all going to be local.
With MySql/Mariadb, you can easily run the database in an official docker container, and the client code then connects to the database using either the network or optionally using a socket.
I would suggest you clarify with the teacher, what she expects, because writing your own persistence layer sounds like it could be a lot of work, and doesn't even begin to address, the multi-user/ network user requirements, whatever is meant by that.
1
u/jacksonanna373 14d ago
Start with the database, not the whole hospital system: make the tables and a few sample rows, then get SELECT/JOIN working. After that, make one C program open SQLite and run one query. Ask what network-connected computers means before you build anything networked.