Latest News: Bitwig updates Bitwig Studio to v5.1
Code Cleanup?
- KVRist
- Topic Starter
- 324 posts since 12 Apr, 2020
So I my progress with Java development I noticed some of my data was becoming stale on a console restart or reloading the scripts with the gui.
Is there a recommendation for what I should put in cleanup? Should I destroy all my objects and data on exit()? Or should I just re-initialize them in init()?
Is there a recommendation for what I should put in cleanup? Should I destroy all my objects and data on exit()? Or should I just re-initialize them in init()?
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
- KVRAF
- 4140 posts since 13 May, 2004
In general, there is no need for memory cleanup in Java. But if you have open files, streams etc. you need to close them. But with a "normal" controller extension there should be no need to cleanup anything.
What do you mean by "stale data"?
Again: Learn Java first
What do you mean by "stale data"?
Again: Learn Java first
- KVRist
- Topic Starter
- 324 posts since 12 Apr, 2020
i am learning itmoss wrote: ↑Thu Oct 01, 2020 8:24 am In general, there is no need for memory cleanup in Java. But if you have open files, streams etc. you need to close them. But with a "normal" controller extension there should be no need to cleanup anything.
What do you mean by "stale data"?
Again: Learn Java first
yes... seems its possible to have data from a a static class and static variable in that class. the class is never unloaded fully on reload. so i had some indexes there that were not resetting. basically my singleton implementation sucked so i fixed it. this is how i learn it
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
- KVRAF
- 4140 posts since 13 May, 2004
- KVRist
- Topic Starter
- 324 posts since 12 Apr, 2020
Oh man thanks for sharing this! too good... "A little more than a decade ago, I used singletons a lot. " ... well, its been more than 15 years since I studied Java... Also while learning Java and developing some software in ActionsScript for a company I spent months writing the worst architected program in my life. I was passing the same objects through hundreds of constructors over and over that could have been resolved with a simple set of globals or a Singleton class.moss wrote: ↑Thu Oct 01, 2020 10:56 am 6 Reasons Why You Should Avoid Singletons:
https://www.davidtanzer.net/david%27s%2 ... etons.html
When I got to Volition everything changed for me and our process was much more on the level of just find ways to keep it simple and get the work done. It was more important that lower level systems had stronger architecture than the higher level systems like gameplay or interface which is what I focused on.
When it comes to code seperation like (Model/View/Controller) this is something I never really fully grokked in practice. Sometimes it just makes more sense to group many parts together... and avoid code seperation because it can be unneccessary. For example you could write a simple controller script in the API in two Java Classes(what gets spit out of the help auto-generate script).. It would be totally functional and readable.
Maybe someday I could convince you to help me via a code review, I would learn a lot and you could have a laugh.
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest