Make global parameters singletons
See original GitHub issuePrerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Running the latest version of Constellation
- Attached the Support Package via
Help
>Support Package
- Checked the FAQs: https://github.com/constellation-app/constellation/wiki/FAQ
- Checked that your issue isn’t already filed: https://github.com/constellation-app/constellation/issues
- Checked that there is not already a module that provides the described functionality: https://github.com/constellation-app/constellation/wiki/Catalogue-of-Repositories
Description
Currently, global parameters are being rebuilt inside each plugin which has resulted in discrepancies where the global parameter is not configured the same way within a plugin.
Steps to Reproduce
- [First Step]
- [Second Step]
- [and so on…]
Expected behaviour: global parameters built outside of plugin
Actual behaviour: global parameters built inside each plugin Reproduces how often: 100%
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
JavaScript: global variables vs singletons | by Shruti Kapoor
The Singleton pattern is basically just a lazily initialized global variable. It ensures that the class has one instance and that instance is ......
Read more >Differences between Singleton and global variable [duplicate]
Singleton is used when we do not want to create more than one object. Singleton class ensures that not more than one object...
Read more >Global Variables in Java with the Singleton Pattern
The Singleton pattern ensures that only one instance of a class will be created and provides a global point of access to it....
Read more >How to make GLOBAL VARIABLES | SINGLETONS in Unity
Have you felt it before? Making an object reference for each and every variable ?SOLVE IT BY MAKING A SINGLETON SCRIPTthat can make...
Read more >Singleton Pattern Deep Dive: Why is it bad? - - Sihui Huang
They both provide a global point of access for an object or a variable · The single pattern guarantees there's only one instance,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just jumping in here too. For some more background had a look at the following and see how
DateTimeRangeParameterType
is being built again.https://github.com/constellation-app/constellation-training/blob/32d97260c4e7b1bfeebe3ed30435fd215ce8b2a5/constellation-training-solutions/TrainingSolutions/src/au/gov/asd/tac/constellation/training/solutions/chapter4/ChainCitiesPlugin.java#L60
To be able to use the date range the user wants to query on the
DateTimeRangeParameterType
needs to be available to the plugin. you can see how its being usedhttps://github.com/constellation-app/constellation-training/blob/32d97260c4e7b1bfeebe3ed30435fd215ce8b2a5/constellation-training-solutions/TrainingSolutions/src/au/gov/asd/tac/constellation/training/solutions/chapter4/ChainCitiesPlugin.java#L68
So back on line 60 what we should do rather than newing instances is get the existing instance of
DateTimeRangeParameterType
- i.e these should be singletons.I was thinking of using a builder pattern so when say build - it will either built it or give you an instance of it if the builder has previously built it.
Happy for other suggestions to. Note that global parameters are used in other modules (like the Training module suite) so minimal breaking API changes is highly desirable.
I think the implementation here #559 is similar to what you’ve described. Advise if otherwise.