Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code structure #50

Open
pavan-pan opened this issue Feb 21, 2019 · 9 comments
Open

Code structure #50

pavan-pan opened this issue Feb 21, 2019 · 9 comments

Comments

@pavan-pan
Copy link
Contributor

Hello all,

Is there any special reason why the code is organised by including the .c files. According to my knowledge, implementation of a function in .c file and prototype in .h file creates loose coupling among modules. I guess there is a reason why the code in this project is structured this way. I just want to know your views.

Regards,
PP

@ritwik12
Copy link
Owner

@pavan-pan There's no specific reason as such. it's just that previously it was a single main.c file consisting of all the functionalities. Then later @igo4Jesus in #31 split it in different files for better code readability. If you think something else is better. Please suggest.

@ritwik12
Copy link
Owner

@riya-17 I would like your reviews here

@pavan-pan
Copy link
Contributor Author

My idea is to divide the entire program into modules consisting .c and .h files. So every module is loosely coupled. Instead of adding .c files, .h files are included instead. When the code grows bigger, its easier when everything is organized in modules.

@riya-17
Copy link
Collaborator

riya-17 commented Feb 21, 2019

@ritwik12 I find the idea of @pavan-pan better. It will increase the understanding of code as well. What do you think @ritwik12 ?

@ritwik12
Copy link
Owner

@pawan-pan sure, please go for it and send a PR

@virajmalia-zz
Copy link

I have been working on reorganizing the code and using a CMake system to build it. Once I have the system running, I will need to re-add some features that were added later (email support etc.). I will try to send a PR by next week.

@ritwik12
Copy link
Owner

@virajmalia That's great, will wait for your PR, Thanks !!

@RoyMattar
Copy link
Contributor

I agree with refactoring/restructuring in this way, where pieces of logic are extracted into separate src files (.c) but only header files (.h) are included.
Including src files is commonly considered bad practice, while the approach proposed here supports modular design, which is better and a lot easier to maintain, scale and test/debug.

I have started working on refactoring the code in this way.

@ritwik12
Copy link
Owner

@RoyMattar Thanks for taking interest!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants