Virtual-Assistant
Virtual-Assistant copied to clipboard
Code structure
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
@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.
@riya-17 I would like your reviews here
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.
@ritwik12 I find the idea of @pavan-pan better. It will increase the understanding of code as well. What do you think @ritwik12 ?
@pawan-pan sure, please go for it and send a PR
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.
@virajmalia That's great, will wait for your PR, Thanks !!
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.
@RoyMattar Thanks for taking interest!!