Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisualizerType simplifications #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HelgeStenstrom
Copy link
Contributor

The enum VisualizerType has been simplified by removing the string representation, and replacing it with an integer representation.

Currently, the only usage that I have seen for the integer representation, is to be able to set the default visualization upon start of the player. That is perhaps better done using the enum value itself. But the enum is coupled to the list of visualizations in the corresponding fxml file; I guess that's why you are not using the enum.

In the future, you might want to create the visualizer menu programmatically, from the enum values. Then you don't have to keep them matched, and can easily change the order in just one place (which will be the enum definition)

A somewhat unrelated change is in VisualizerStackController. The changes are only made to improve the readability, and to make it easier to probe values at debug time. It becomes clear that there is redundancy between the two changed methods. But that is left for future refactoring.

@goxr3plus
Copy link
Owner

Yes you are right :), have you tested that it works as before correctly?

@goxr3plus
Copy link
Owner

It is very very important that eith every change you make you try the app yo verify it's running well on that part, or else we have braking changes which is hard for me to stop.

@HelgeStenstrom
Copy link
Contributor Author

Yes, I have tested. No problems as far as I could see.

But you have the main responsibility of testing, since it's you who decide if the pull request should be merged. You must also understand the code with the merged changes. My pull requests are just proposals.

@HelgeStenstrom
Copy link
Contributor Author

HelgeStenstrom commented Jul 17, 2019

Before I made the change, I looked for users of the toString() methods of the various enum values. I only found calls for the CIRCLE_WITH_LINES value. If there are calls of toString for other values, then the calls will fail, since the default toString() method of Object returns an object identity string, not the string value such as "6" that is now removed.

But it's easy to re-implement the toString metod as it was, without doing so for every value individually. You can create one for the enum that calls the getValue() method.

Currently, with my pull request, the values returned by getValue() are the same as would be returned by .ordinal(). If you want to keep it that way, the enum can be further simplified. But some people, including Joshua Bloch (author of Effective Java, and of some core Java libraries) recommends against that. See for example https://stackoverflow.com/questions/8157755/how-to-convert-enum-value-to-int

@goxr3plus
Copy link
Owner

@HelgeStenstrom It's the responsibility ot the one who makes pull requests to see if his changes are not braking something and then me finilizing the hard parts if so.

:) Imagine i hqve worked in big projects with 30 contributors if everybody did changes and expected the main developer to know everything, not manageable.

@goxr3plus
Copy link
Owner

I have to test this carefully, it might brake backwards database combatibility or something, many antipateerns i have inside XR3PLAYER, i was very junior back then :)

@goxr3plus goxr3plus self-requested a review July 25, 2019 08:55
@goxr3plus
Copy link
Owner

I think i will have time these days to actually test these new changes .

@goxr3plus
Copy link
Owner

We have to make the visualizers a completely new library, i will make a new repository and choose a name can you suggest some names :)

@goxr3plus
Copy link
Owner

@HelgeStenstrom

I am almost ready to merge this .

Sorry for taking so long :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants