Jump to content

Benefit of modules over a plain class?


suntrop
 Share

Recommended Posts

I need some extra functions to work with user's data, implement PayPal and Stripe and some other.

Now I am wondering if there is any benefit using PW modules instead of just using a plain class and extending WireData? I do not need configurable modules and definitely not reuse them on another site … but perhaps later I need to hook into some methods. What do you think?  Module or a simple class?

Link to comment
Share on other sites

Imho the big benefit of modules is installability. So anything reusable or more generic can be a fit for a module. Other than that I don't see much reason to use modules over just classes. Personally I'm of the opinion to keep modules just for the code needed to interface with processwire anyways. Business logic, which is not processwire specific can just as well be in a plain class the module brings with it.

  • Like 5
Link to comment
Share on other sites

Thanks! That sounds good and is what I was hoping for ?. I wasn't sure if there are any limits when it comes to the API features if I skip the module and just create a class.

BTW … what do you mean by installability? Just being able to install something isn't worth anything on its own, is it? Do I miss something here?

  • Like 1
Link to comment
Share on other sites

On 10/22/2018 at 7:38 PM, LostKobrakai said:

Imho the big benefit of modules is installability.

 

On 10/22/2018 at 9:27 PM, suntrop said:

what do you mean by installability?

 

Bump. Answer needed @LostKobrakai in before to put this damn refactoring thing on the tasks list ?

Link to comment
Share on other sites

Note: this topic was moved to the "Module/Plugin Development" subforum. "Modules/Plugins" area is intended for support threads of existing modules, and any module development related questions or discussions belong here ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...