+ Reply to Thread
Results 1 to 13 of 13

Thread: LibConnect - Making addon to addon communication not only possible, but simple

  1. #1
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default LibConnect - Making addon to addon communication not only possible, but simple

    Hey all. This idea dawned on me last night, and I just spent the last hour coding it, testing it, and documenting it.

    Information:
    What is LibConnect?
    LibConnect allows for simple yet very powerful addon to addon communication.
    Note: This does NOT allow for user to user addon communication.


    How does it work?
    LibConnect has two methods - that's it.
    LibConnect.put is the first method. The documentation on this method is as follows:
    Puts information out there. Will return true if data is successfully set.
    Parameters:
    identifier - The identifier other addons will use to know it's you
    key - The key for the data you are inserting
    value - The value [of the key] for the data you are inserting
    channel - [OPTIONAL] Adds another layer of 'privacy' over global. Other addons will also need your specific channel name to access the data you are inserting
    LibConnect.grab is the second method. The documentation on this method is as follows:
    Grabs information that's already out there. Will return nil if no information could be found.
    Parameters:
    key - The key for the data you are getting
    identifer - [OPTIONAL] The identifier for the data you are getting. If you do NOT set an identifier [or channel], then a table will be returned with all the identifiers (the values being the data set by those identifiers). Use: for key, value in pairs(variable) do ... end
    channel - [OPTIONAL] Some data may be in a channel, i.e. not in global. If that is the case, you need to set the channel. Requires identifier (or else it will return nil)

    Why should I use it?
    LibConnect is very powerful. It allows for addons to easily pass anything to other addons. This could be a table, an object, or even a full function.
    LibConnect makes addon to addon integration much simpler as well.
    There are so many possibilities. I could create a DPS meter, then put all of the data/logs/etc into LibConnect, and let other addons use that information for whatever they please.
    I could release information as to what my addon is doing in LibConnect, to make other addons aware. This information could be publicly available to whichever addon wants it if desired.

    LibConnect is just the tool - how you use it is up to you, and the rest of the addon developers.
    Download (approved in less than 5 minutes of uploading, as usual; thanks RiftUI): http://www.riftui.com/downloads/info202-LibConnect.html

    This is only the first beta, so please do tell me if you have any issues, suggestions, questions, etc.
    Last edited by TimeBomb; 03-08-2012 at 12:48 PM.

  2. #2
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    What's the difference to storing certain information you want to share in a global and creating event hooks for other addons to tie into?

    Sounds like a whole lot of overhead and extra, unnecessary memory usage.
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  3. #3
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    Also, how does it dump data?
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  4. #4
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Quote Originally Posted by Verea View Post
    What's the difference to storing certain information you want to share in a global and creating event hooks for other addons to tie into?

    Sounds like a whole lot of overhead and extra, unnecessary memory usage.
    Quote Originally Posted by Verea View Post
    Also, how does it dump data?
    Some very good questions.
    First, to address some of your concerns:
    Resource Usage/Unnecessary Overhead:
    The library is extremely simple. I've done stress testing and haven't seen any situation where the library uses any noticeable amount of resources, no matter the data being grabbed, placed into, or currently being held by the library.

    Dumping Data:
    Because of how simple and efficient the library is, this isn't the biggest worry in my book, but I do want to get it addressed. Truth be told, I didn't think of this when contemplating and writing the addon.
    I'm interested in peoples input on this subject.
    The way I see it, I have a few options:
    1) Periodically clear all old data at a fixed rate
    2) Using a similar system as #1, allow variables to set their expiration time when using the put method
    3) Just for the purpose of easily deleting data, add a method that lets a single identifier to be cleared, or a single key owned by a single identifier. My concern is that the above options are not only more viable, but less harm can come of it.

    Currently, the only way to clear data is for the addons to manually set keys to nil. Not a good way to handle it, obviously.


    In terms of it's overall use... Why use it? Well, there are a few reasons I may propose, but in the end, it's power comes from how many addon developers pick it up and use it.

    When an addon developer wants to give information out to other addons, he or she uses their own method. Whether that be a global event, a global variable, a global method, etc - that's specific to their addon.

    What LibConnect provides is a similar interface that is easily usable by any and all addons. You don't have to write your own interface. Addon developers don't need to be confused between numerous different addon-specific interfaces that are offered by numerous addons - they deal with one simple interface.

    The overhead, the resource usage - I see no reason why to worry about that. LibConnect is extremely easy to use. But it will be so much more powerful when numerous addons start using it.


    I hope this answers some of your concerns.


    I am writing an update now that includes the removal of channels. They are unnecessary and confusing. The update will also include some manner of cleaning up, which I am interested in hearing more peoples opinions on.

  5. #5
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    Quote Originally Posted by TimeBomb View Post
    When an addon developer wants to give information out to other addons, he or she uses their own method. Whether that be a global event, a global variable, a global method, etc - that's specific to their addon.

    What LibConnect provides is a similar interface that is easily usable by any and all addons. You don't have to write your own interface. Addon developers don't need to be confused between numerous different addon-specific interfaces that are offered by numerous addons - they deal with one simple interface
    Why would a random addon want my information?
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  6. #6
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Quote Originally Posted by Verea View Post
    Why would a random addon want my information?
    LibConnect doesn't have a specific definition as to how or in what ways you [should] use it. It's just another tool.

    Currently, addons aren't built with the idea of sharing information being necessary. LibConnect opens up this arguably huge avenue.
    It could be used for sharing generic information, or allowing addons to easily plugin to your addon, or allowing a multitude of addons to connect together like a web. There are a lot of possibilities not only between different addon developers, but between different addons by a single developer.

    I think you are attempting to figure out what need this library fills the void of, much like what one may do when creating a product or business - what need is there for my product in the market? Many poor or just plain odd products are put out into the world because this question was never asked and has no good answer.

    But this isn't a business nor a product. It's just another tool which opens an arguably huge avenue that was not opened before.

    It's not a necessity, currently. I do believe that it may become one for some addons.

  7. #7
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    The obvious example would be an auction addon wanting to expose price information, for instance. A standardized method might help.

    Although I wonder if inspect.addon.detail('foo').data isn't good enough...
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  8. #8
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Quote Originally Posted by the_real_seebs View Post
    The obvious example would be an auction addon wanting to expose price information, for instance. A standardized method might help.

    Although I wonder if inspect.addon.detail('foo').data isn't good enough...
    Really, LibConnect is nothing more than similar interfaced storage usable between addons.
    What addon developers do with it is up to them.
    It could house the connectors to web together a few different addons.
    It could be used for same-dev addons to connect their addons together easily.
    It could be a place where information is placed for seemingly no reason, just in case other addons want to use it.
    It could be used to create something completely different than anything I can imagine.

    I'm finishing up an update to it now.
    I've removed channels. I've added an exists method and a throwaway method(which will delete a key/identifier).
    I've decided, for the time being, to not dump data. I started implementing it and realised that not only is this more trouble than it's worth for the average addon developer, but it also will end up causing LibConnect to use more resources. If it becomes a problem later on, I'll look back into it.
    Last edited by TimeBomb; 03-08-2012 at 09:34 PM.

  9. #9
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    Quote Originally Posted by TimeBomb View Post
    Really, LibConnect is nothing more than similar interfaced storage usable between addons.
    For?
    What addon developers do with it is up to them.
    Nothing useful, as whatever a developer would ever do with it would require the other addon to be present as well, at which point it becomes more useful to just call the addon directly and not require an excess library doing nothing but being a massive memory leak.

    It could house the connectors to web together a few different addons.
    It really doesn't because the information is just out there, without any goal, doing nothing. You assume other addons can do something useful, but information is always supplied on a 'need' basis. If an addon has 'need' for a certain amount of information, the way to go is to poke the addon that can supply it.

    It could be used for same-dev addons to connect their addons together easily.
    Or he could write a couple of functions which cause less overhead and have no memory leaks.

    It could be a place where information is placed for seemingly no reason, just in case other addons want to use it.
    You don't place information somewhere with no reason, there is no reason to do that other than wasting resources and CPU cycles.

    It could be used to create something completely different than anything I can imagine.
    Except not really, it's a pointless add on with no real purpose. On top of that it's a massive memory leak.

    I've decided, for the time being, to not dump data. I started implementing it and realised that not only is this more trouble than it's worth for the average addon developer, but it also will end up causing LibConnect to use more resources. If it becomes a problem later on, I'll look back into it.
    That's a horrible design decision and perfectly illustrate why I would highly derecommend ever using this library. It's quicker, more efficient and far more logical to ask for information from the addon itself.
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  10. #10
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Ignoring the biased comments here (snip snip)...
    Quote Originally Posted by Verea View Post
    For?

    You assume other addons can do something useful, but information is always supplied on a 'need' basis. If an addon has 'need' for a certain amount of information, the way to go is to poke the addon that can supply it.

    Or he could write a couple of functions which cause less overhead and have no memory leaks.

    You don't place information somewhere with no reason, there is no reason to do that other than wasting resources and CPU cycles.

    On top of that it's a massive memory leak.

    Alrighty. First, let me say, I am glad to see there are developers with your attitude and experience still spending time programming game addons.

    First - the biggest issue you have brought up is CPU and memory leaks.
    When I tested for CPU leaks, I completely forgot to test for memory leaks. I apparently forgot the number in the UI for addon memory was there.
    I've taken another gander at everything and yes - you are very correct - this addon is extraordinarily prone to blatant memory leaks.

    While I could dump the data and help correct the memory leak, instead, I've put some thought into this, and decided that I'll just drop the addon.

    While I still, unlike you, like the overall idea of what I made possible with this addon, the memory issue in and of itself is best handled on a per-addon basis. Dumping data into a separate addon such as LibConnect, for better or worse, can easily cause numerous issues. Memory leaks if I don't dump, other issues if I do, etc etc.

    Thanks a lot for your feedback and criticism, Verea.
    /LibConnect dead

  11. #11
    Plane Touched
    Join Date
    Feb 2012
    Posts
    228

    Default

    I agree with Verea in that, right now, it's hard to find an scenario where a shared database like LibConnect could accomplish something a proper public interface couldn't do better.

    However, I see your library as the first step in the right direction. If you added a way to easily index the tables we share, handle table ownership and permissions, and all that database stuff, I'd use it instead of my own tables to store my addon data.

    Then, other addons could use that data for what they want to without me having to care about exposing a public interface, just grant the proper permissions for them to access the tables I want to share.

  12. #12
    Rift Chaser
    Join Date
    Oct 2011
    Posts
    398

    Default

    Quote Originally Posted by Baanano View Post
    I agree with Verea in that, right now, it's hard to find an scenario where a shared database like LibConnect could accomplish something a proper public interface couldn't do better.

    However, I see your library as the first step in the right direction. If you added a way to easily index the tables we share, handle table ownership and permissions, and all that database stuff, I'd use it instead of my own tables to store my addon data.

    Then, other addons could use that data for what they want to without me having to care about exposing a public interface, just grant the proper permissions for them to access the tables I want to share.
    Thanks for the feedback.
    My intentions were fuzzy and my initial implementation was poor and over simplified.

    In reality, for something like this idea to be even remotely useful, it would have to be more of a RDBMS or something along those lines than just a simple global table.

    Once that is done, then, while that makes it more desirable to use than, say, LibConnect, the question of what can really be done with it comes into play.

    While I was willing to write up something simple to cover this scenario, as I did with LibConnect, I just don't see writing something this elaborate being a smart decision without having any prior reason. I don't have time to waste like that.
    Last edited by TimeBomb; 03-09-2012 at 03:06 AM.

  13. #13
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    I would just like to say that it was never my intention to discredit your idea, while my opinion might be different and I feel data sharing is best done on a on-addon basis with own functions doesn't mean that I think your idea is bad. However, my concerns were with the implementation.

    I'm glad you had the rationale to see that too though, such an attitude is rare from developers as they often don't like to take criticism to heart. Props for that.

    /V
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts