ElkArte Community

Project Support => General ElkArte discussions => Topic started by: Ant59 on August 26, 2015, 05:07:13 am

Title: Addons vs Modules
Post by: Ant59 on August 26, 2015, 05:07:13 am
Without me having trawling through the source code, could someone explain what the difference (if any) there is between addons and modules? I see both referred to, but I can't understand a difference between them. As far as I understand, they both add features, they both auto-load from the addons/ directory and they are both toggle-able through the core features page. What am I missing?
Title: Re: Addons vs Modules
Post by: emanuele on August 26, 2015, 08:28:43 am
I wrote something a while ago:
http://www.elkarte.net/community/index.php?topic=831.msg16689#msg16689

It's not yet complete tough.

Addons are packages that extend ElkArte.
Modules are a way to extend ElkArte (similar to hooks).
Title: Re: Addons vs Modules
Post by: Ant59 on August 26, 2015, 09:29:15 am
I don't understand why we need both? Don't they do exactly the same thing?
Title: Re: Addons vs Modules
Post by: emanuele on August 26, 2015, 05:57:55 pm
Addons are really the zip files.

"Module" is a name I made up for something that is not exactly an hook. At least in my mind, it's something that works alongside a controller attaching events instead of hooks.
Yes, both (hooks and "modules") are the same in the sense they aim at extending, but are somehow different in the way they work.

Yes, it is confusing, everything can be renamed as "hooks", not a big problem (apart some typing). ;D
Title: Re: Addons vs Modules
Post by: Ant59 on August 29, 2015, 06:24:48 pm
Haha, okay I understand now. I think the naming scheme is a little confusing, but it's not important.
Title: Re: Addons vs Modules
Post by: Joshua Dickerson on August 29, 2015, 06:57:41 pm
@ant59, I agree. I still don't understand what @emanuele said and I've read it 100x and I am pretty familiar with the code.
Title: Re: Addons vs Modules
Post by: emanuele on August 30, 2015, 07:10:48 am
hmm... put it another way: modules are pieces of code that only work with controllers and that attach to events (even listeners?).
Why are there in a separated directory? Because Elk can find them by mane pattern and autoload what is necessary.
Why are they different from hooks? Because they work differently (e.g. on the passing of arguments, persistence of the instances, etc.).
Why I cannot explain it any better? Because I'm not good at explanations. :(