I have been very busy with research and classes lately, so haven’t had a lot of time to look at code. I am a bit surprised this post slipped through my net!
I have a lot of thoughts, firstly being that I am extremely grateful that this is something you’re (@ghutchis) concerned about! I love Avogadro, and while I may say it a lot, I could not count a single day in probably the past year that I have not needed to use it. There are a lot of things that I think about, a lot of bugs that I encounter, and some things I feel like would be an easy fix, while some seem so intractable that I could never even know where to start.
I’ll take a change for me that seemed like it would be extremely easy to deal with at first and use it as a case study: the molecular properties dialogue. (this is going to be a long one)
At first I thought this would be an easy thing to work on, I just need to know how to add elements and pull the variables to populate it. I realized pretty quickly that the first step would be to find the correct file to work on. I searched through the GitHub page, looking first in avogadroapp
, since I figured that UI stuff would be an application side endeavor. That wasn’t right, so then I looked into avogadrolibs
, and went into the avogadro
file within. After that I figured, okay, this is a Avogadro thing, so lets look in core
or rendering
, but neither of those were right. Then searched through qtgui
since this is a UI thing, but no luck there either. Then I made my way to qtplugins
where finally I found the file called molecularproperties
, exactly what I wanted! It only took me around an hour of poking through things, which while it wasn’t a huge amount of time, was a bit tedious. That was the first step.
Next was trying to figure out what I needed to do next; do I need to look through the molecularproperties.cpp
, molecularpropertiesdialog.cpp
, or molecularpropertiesdialog.ui
file? My solution was to just check through all of them and see if I can understand what was happening. The first stop was the plain molecularproperties.cpp
file, which is pretty short, and I felt somewhat confident after reading that I knew slightly what was going on there. Next up was molecularpropertiesdialog.cpp
, which is a very different beast. This had a preamble that pulled in 16 different headers or Qt pieces, which seemed fine, and I recognized many of those pieces. I started reading through the file, and immediately realized I had no idea what questions I even needed to ask to get started. Some parts seemed easier, like MolecularPropertiesDialogue::updateLabels()
, which made some sense, all it did was clear labels and reupdate them using some of the other functions in that file. I used some of these as a foothold, and I do think that, for the most part, I understand that file. Next up on the chopping block was the .ui
file. I really do not know where to start for this file, do I need to just add stuff and it’ll get handled, or do I need to change the .cpp
file to get it to register properly?
Then it hit me, I know that I want the dialogue to display information about an output file if I am opening it, but I have no clue how that works. I’d like to display stuff like single point energy, thermodynamic information, HOMO and LUMO energies, stuff like that. That all comes from an output file, but how do I pull that information from the output file and put it in there? What do I need to put in the preamble, what is the object that I need to call, do I need to make all that stuff optional so it isn’t there if it isn’t an output, and if so how? Those questions need answers, but who do I ask? I don’t know anyone versed in C++ and Qt, nor do I have the technical skills (yet) to do the asking myself, not without spending hours and hours on it, definitely not time I have available to me.
Okay, that was a lot of text. As a TLDR, my main problems are the following:
- Inexperience with C++ (self problem)
- Inexperience with Qt (self problem)
- Confusion around where the files for a feature are located in the codebase
- Confusion about what objects exist (for example, something like
m_molecule
, what does it contain, and where do I find out what that object looks like)
- Confusion about how to call things
- Issues in running tests
a) I could use my typical method for working on code, just change something and see what happens, but as far as I know, I have to recompile and rebuild the whole thing to test a single change, which takes a huge amount of time.
b) If there is a way to only change a single bit of code and not have to recompile the whole project, that would be a game changer, for me at least.
- Commenting of code seems to be extremely low, in my experience reading through it, I often don’t even know the purpose of entire
.cpp
files.
a) An example is something like viewfactory.cpp
, which seems to do nothing at all, but is referenced in other files like multiviewwidget.cpp
.
Goodness, that TL:DR is also pretty long. If I had to say 2 things that would make everything easier it would be better documentation and an easier way to test changes locally.
I also felt like I rambled a lot there, so if anyone is confused please let me know!