ritwik12 / Virtual-Assistant

A linux based Virtual assistant on Artificial Intelligence in C
GNU General Public License v3.0
128 stars 95 forks source link

Code structure #50

Open pavan-pan opened 5 years ago

pavan-pan commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

@riya-17 I would like your reviews here

pavan-pan commented 5 years ago

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 commented 5 years ago

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

ritwik12 commented 5 years ago

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

virajmalia-zz commented 5 years ago

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 commented 5 years ago

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

RoyMattar commented 4 years ago

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 commented 4 years ago

@RoyMattar Thanks for taking interest!!