I made a project for a hotel system in c++ and i am wondering if someone is willing to let me know if the code can run on their machine.
https://github.com/vladuzzul/Hotel-Management-System
This is the link to the github repo and the downloading instructions are in the readme
#Let me know if the code works on your machine
16 messages · Page 1 of 1 (latest)
Im so confused by this repo?
- Why is build/ in there
- Why does Camera.h not just contain declarations (in fact all header files)
- Why is the executable file in the repo
- Using the namespace std in a header is HUGE codesmell
- The repo structure is not optimal
it's one of my first repos, I'm at the begging, I don't really know how it should be 😅
i am wondering if someone is willing to let me know if the code can run on their machine.
Why do you even want that? Doesn't it run on your machine?
It does, but I want to show other people my repo if they ask me if i made a project and wanna make sure it's good on other devices
From the previous repos, there’s a huge difference too
Granted the last repo is 4 months ago
Yeah, well I tried to structure the whole repo, making it better, but I am having trouble at the installation steps, because I don't really know why, but the executable is still there, and when I tried to compile the code on another machine, the brew gave me an error and i don't really can solve this by my own, that's why I asked if it runs on other machines by following the steps that i included in the readme
I updated the project to be much better, changed the whole code and structure, can you tell me if i did good?
- Why do you have a
src/Camera.hand ainclude/Camera.hthat both do entirely different things? - NEVER put an executable together with the source code. If you want to upload precompiled stuff, then make it a GitHub release.
- I would suggest you use
#pragma onceas an include guard. Yes, it isn't standard C++, but I don't know of any compiler that doesn't support it. - It's good that you use CMake, but you use it incorrectly. You want to have one
CMakeLists.txtfile per folder, and in the outerCMakeLists.txtyou doadd_subdirectory("<name_of_inner_folder>"), so that eachCMakeLists.txtis only responsible for it's own folder. - In your README you don't need to explain how to clone a project, especially since most people probably prefer to clone via SSH.
- Your
addRoomanddeleteRoominsrc/RoomManager.cppare very inefficient as you need to perform a linear search each time. Possibly consider using astd::unordered_mapor astd::map - Some functions like
include/Reservation.h/modifyReservationare way too complicated. If I just look at how nested it is, then at the most nested point we have, in this order:for-if-for-if-for-if-if. That's seven indentations. That's WAY too much. Try to aim to never have more than 3 indentations. gotohas its valid uses, how you use it ininclude/Reservation.h/addReservationis not one of them. You can simply replace thisgotowith a loop.- You write like a C programmer. You don't really use classes. Like, for example the fact that you need to ALWAYS pass
[const] std::vector<Camera>[&]to ALL functions ininclude/Camera.hjust screams at me that there should be some sort of wrapper class.
The few times that you "use" classes, you abuse them as just arrangements of data, like it's the case in C. - You have WAAAY too many string literals in your code. I would definetly extract stuff like
\033[1;90mor\033[0m - I just saw your
mainfunction. WTF?! A main function should be like 1-3 lines.
I fel like i need to apologies 😭😭
It’s my first project that I really worked on, I don’t have that much time to dedicate myself to programming cuz I got exams going on rn and my time is limited, but I try to get my way around
Thank you for the explaining, appreciate it :))
no need to apologize lol
constructive criticism 👌
No need to. I made some hot ass when I was first learning. This is how you learn so keep it up