SystemsGenetics / KINC

Knowledge Independent Network Construction
MIT License
11 stars 4 forks source link

suggestion to organize analytics/data objects into folders #89

Closed spficklin closed 5 years ago

spficklin commented 5 years ago

I propose that we organize all of our analytics and data objects into folders. There are a lot of files and some have similar names. I think it might be easier if every analytic (at least) had it's own directory.

4ctrl-alt-del commented 5 years ago

In my experience it is best to leave all source files in the same folder. There is never a conflict because the names of sources files follow the names of classes and obviously there cannot be conflicting class names so it works itself out.

4ctrl-alt-del commented 5 years ago

Also, as far as organization, that is what namespaces are for, which are also appended to the file names of source files.

spficklin commented 5 years ago

The problem I have is just finding files. The file lists are getting longer (we have a few more analytics in the works) and some have similar names and we have data objects mixed with analytics. For example there are lots of files that start with the word 'pairwise' for both analytics and data objects. It's a bit overwhelming.

Here's a suggestion for the src directory:

src/
    core/
        core.pro
        datafactory.h/cpp
        analyticfactory.h/cpp
        data/
           pairwise/  
           expressionmatrix/
           correlationmatrix/
           ccmatrix/
        analytic/
            similarity/
            rmt/
            powerlaw/
            corrpower/
            extract/
            importexpressionmatrix/
            importcorrelationmatrix/

Inside of each of the data/analytic subfolders are all of the relevant classes for those types.

4ctrl-alt-del commented 5 years ago

I strongly advice that whatever directory structure that is used is mirrored in the code with namespaces. So in your case you would have a data and analytic namespace and then namespaces for each data and analytic type nested within. It is a very very bad idea to make a directory/naming convention that does not follow the namespace and class names.

Personally I do not like directories though. There are better ways to organize source files within qt creator. I would suggest simply adding a data and analytic namespace and moving all data and analytic types within their respective namespace. You could also move the factories too if desired.

spficklin commented 5 years ago

Can you expound on this:

It is a very very bad idea to make a directory/naming convention that does not follow the namespace and class names.

Why is it "very bad"

4ctrl-alt-del commented 5 years ago

It least for me if causes great confusion when including different header files because you have to remember the C++ fully qualified name and the file path which in your case are not the same.

As for directories, it becomes a mangled nightmare very quickly where the preprocessor will randomly fail at finding header files, look at https://stackoverflow.com/questions/28567466/qt-including-files-in-different-directories for an example.

spficklin commented 5 years ago

Also, I didn't get what you meant by this as well:

There are better ways to organize source files within qt creator. I would suggest simply adding a data and analytic namespace and moving all data and analytic types within their respective namespace

Is this something I can do in QT creator?

bentsherman commented 5 years ago

I agree with Josh, I really don't mind the long list of files because every file is named according to its namespace so it's guaranteed to be unique. In my experience, having more subdirectories just makes it harder to find things because you're constantly opening and closing folders.

Even just adding data and analytic subfolders wouldn't be very elegant because some files don't fit clearly into one or the other. Some files in the Pairwise namespace would go into data while others would go into analytic, and as Josh explained, that would be simply asking for build errors.