Addon Model, conflict and cooperation

Okay, let me ask it another way. If two addons extend the XenForo_ControllerPublic_FindNew the base class will get run twice, so the query gets run twice, and no matter what I or they do one of the addons will not work. Again, unless I'm missing something.
 
No, the base class won't be run more than once. You probably missed something. Why don't you explain why you think it will run twice and I will try to correct it for you?
 
In reality, XenForo takes and extends the base class X amount of times based on add-ons attempting to extend it. Once accomplished, it'll call the last extended class as that'll essentially (and if all works out correctly), all the required code and changes. This is why XenForo utilizes a proxy system, as you can bring in the code from x amount of classes all expecting to inherit from one main class and run them all at once. Conflicts are really down to add-on authors to work out between each other.

In your case (note: I haven't looked in code), you'd want to call the parent with modified instructions (take out certain node_ids) and perform the query. You set the modified parameters and call return parent::function(args);. If two functions extend it, add-on b will now take over and perform the necessary modifications for that add-on and pass it's modifications up the line. By the time you get to the actual query, every add-on will have gotten the desired effect and XenForo can perform the query, returning the results expected by all.
 
I am writing an addon that overrides the XenForo_ViewPublic_Thread_ViewNewPosts class, to allow for filtering based on user. If anyone (as I understand it) for any other reason, even if they don't change the output, writes another mod that overrides the same class there is a conflict. That's not an argument, it's fact. However, what I'm asking is if/how the XenForo team, or other addon authors, deals with this.

It's possible I haven't dug deep enough yet, or missed someway on sharing the output that is already built into the system.


Conflicts are really down to add-on authors to work out between each other.


Is there any way of preventing conflicts ?

IDEA:
When an addon is created ... could some sort of code be produced which tells which parts of xenforo were added and extended ? Then this data could be compiled automatically by Xenforo so developers could download the information and make sure they are not stepping on other's feet ?

Might it even give some good ideas FOR integration with other Addons ? like a Tags addon .... Gallery Addon ... etc.

Would there be a way to produce addon "code changes" done by an addon ... such that the data can be easily accessed by other developers ? These ?XML based code changes could be posted in the Resource Manager ?
 
In your case (note: I haven't looked in code), you'd want to call the parent with modified instructions (take out certain node_ids) and perform the query. You set the modified parameters and call return parent::function(args);. If two functions extend it, add-on b will now take over and perform the necessary modifications for that add-on and pass it's modifications up the line. By the time you get to the actual query, every add-on will have gotten the desired effect and XenForo can perform the query, returning the results expected by all.
It seems like it is possible for the really good coders to avoid stepping on each other's toes.
 
It's a clever system. Conflicts can still occur, but my main confusion/concern (that conflicts where inevitable) was based on a lack of understanding of how the addon system dynamically extends classes, which in my defense is somewhat unique :)
 
It's a clever system. Conflicts can still occur, but my main confusion/concern (that conflicts where inevitable) was based on a lack of understanding of how the addon system dynamically extends classes, which in my defense is somewhat unique :)
Should this be page one in the "Newbie's Guide to Addons" ?
 
It depends. If you have a new addon developer with OO experience, it will confuse them as it did me. Perhaps just a better explanation (or link to one) when you actually create a new listener?
 
It seems like it is possible for the really good coders to avoid stepping on each other's toes.
If XenForo develops and writes the software correctly on all the queries, it should be easy for even novice programmers to avoid stepping on each other's toes. The system is intuitive enough to avoid these. Most conflicts are simple and easy enough for a single author to modify their code to fix the conflict.

It's a clever system. Conflicts can still occur, but my main confusion/concern (that conflicts where inevitable) was based on a lack of understanding of how the addon system dynamically extends classes, which in my defense is somewhat unique :)
It's easy enough to fix, write you're add-on, and if there is a conflict, you can deal with it later. It's relatively easy.
 
If XenForo develops and writes the software correctly on all the queries, it should be easy for even novice programmers to avoid stepping on each other's toes. The system is intuitive enough to avoid these. Most conflicts are simple and easy enough for a single author to modify their code to fix the conflict.

Have you seen other software use a similar system to what has been outlined ?

Is there more need for this type of software in the forum addon community .. in part because of the larger number of "novice" code producers ?
 
No, XenForo takes a unique approach due to their architecture allowing this type of system. The system is fine and works flawlessly. Their are a few issues with how one or two things aren't as open as they should be. Hambil's concern was genuine and he had the reasons for concern. However, the system is written to attempt to avoid such issues or make them relatively easy to solve.

XenForo shouldn't have to deal with keeping information on add-ons and incompatibilities. DarkImmortals add-on was incompatible with BBCM. DI fixed the add-on within a day and they work flawlessly together now. If it doesn't deal with the Core, XenForo shouldn't be involved. Can we leave philosophical programming debates to programmers? Please?
 
Top Bottom