Sunday, March 19, 2023

Oh Tableau, I want to comment my code... my mind is like a steel siv!

Commenting code

I like to comment my code.  My professors made it a point to ensure that everyone understood the importance of comments in my code and I have tried to faithfully apply what I have learned.  Unfortunately, when we drift to applications like Tableau, there really isn't a great mechanism to make comments that wouldn't be visible to the end user of the dashboard.  To be fair to Tableau, Excel doesn't do this well, and I suspect that PowerBI doesn't do it either.  While we could make comments in our underlying SQL, I'm trying to get out as many records as I possibly can so that we can have it available in our data sources for the unexpected future needs.

Our data sources are being pulled directly from Oracle.  They start my my initial generation of a query based on an entity-relation diagram that I created to provide information the looks like what you would typically find in a report writer in an HRIS system.  These queries are then turned over to our IT team who then create a view, and then a materialized view which Tableau is linked to.  As much as I wish I could control the entire process, the folks that I work with are amazing, talented, and extraordinarily responsive.  I am fortunate to work with these people because I am always learning new things from them.

The "code review"

While our HRIS team is composed of four people and a couple vacancies, currently it is only my supervisor and I who have the technical skills.  I rely on my supervisor to help with the initial reality check on our dashboards.  While we were going through some of my work, we were noticing that some of the numbers weren't matching up and I was having problems understanding and explaining why in the moment.  One of the dashboards was developed months ago with some ongoing modifications to both the underlying query and the filters have been applied in Tableau made it impossible for me to explain, with certainty, the exact changes needed to be able to run a query against it to get the same information that was shown in the Tableau dashboard.

The magic of commenting code lets you know why you made specific decisions.  You might want to know days, weeks, months, or even years after you wrote your code why your code does something.  Just because I know why I applied certain filters in Tableau now, doesn’t mean that I will remember three months down the road.  Beyond a simple conversation with my supervisor, with whom I have a great relationship, I would hate to put my Chief Human Resource Officer (CHRO) in a position where he was having a hard time defending the numbers.

The old pen and paper

This problem isn’t insurmountable.  We have the old ways of doing things.  I try to be good about keeping notes pertaining to how things are done.  Frequently, this is in a paper notebook.  Compared to code comments, this is far from ideal.  With code comments, they are concise and available where you need them.  This is never the case in my paper notebooks.  My paper notebooks don’t let me remove the comment command characters to try the original code.  While I understand that having inline comments in Tableau may be challenging from a development standpoint, it is a big miss from my perspective.

The errors

Outside of the “code review”, I was able to identify some of the errors or issue that we were coming up with.  It didn’t take a particularly long time, but it definitely took longer that I would have liked to while I was in a meeting.  The answer was pretty clear once I found it in my notes and setting up a method to validate it was a simple process.  It was a filter on five job titles but in self-imposed pressure of the meeting, I could not come up with a mechanism to verify it.  Past the meeting, I could easily identify it, look up the correct job title codes, and create a simple query to share with my supervisor to give him the correct answer.

The code review was also helpful for identifying some other issues that I had.  Sometimes it is nice to just chat about the work and get perspective from another set of eyes.  Errors might be dumb but because you made them, you might not see what is right before your eyes.  An example of this revolved around a couple formulas on my dashboard that were giving me the same result.  There was no reason for them to be the same result and I checked them a couple times, getting the same result every time.  After our meeting, I was able to check it again and I must have been clicking on the wrong formula because there it way, front and center, my formula was clearly referencing the wrong attribute in the relation.

Feedback is a gift

As an HR Manager, I have told people this very phrase for years.  Feedback is a gift.  Feedback allows you to learn the perspective of someone else.  If offers you a unique insight that you may not otherwise have.  Right or wrong matters not, it is an opinion.  You have a choice on what to do with this feedback.  I value these “code reviews” for the feedback gained.  I have learned a lot through these exercises.  Sometimes it is a matter of someone asking me the questions that I haven’t asked myself.  In the end, regardless of agreeing or not, I find the feedback extraordinarily valuable.

Feedback for the Tableau development team

Tableau development team, if I may, the ability to have comment my dashboards so that I can remember what decisions I made, when I made the, and why, would be very helpful.  I am sure that I am far from the only user who would appreciate this feature.  If it does exists, please let me know where because none of the Tableau experts at my institution were aware of such a feature in your otherwise amazing product.

No comments:

Post a Comment

Followers