While setting up the site around my sign-up plugin I had to look for other plugins, ready made ones, to compliment it but I had an hard time doing it. And not due to the lack of offer.
One of the things the plugin does is redirecting visitors from the
wp-login.php page to another page during registration, logout and login and not always to the same page.
I had to implement the functions for this lacking the possibility to do that, and only that, using another plugin.
I could find plugins doing the same thing but with unnecessary weights and options and bells and whistles.
I just really needed to redirect users accessing the login page (and before login and not after, WordPress does that).
I will slice the sign-up plugin down into smaller plugins: I do not see the same scenario happening very soon and want to reuse parts of what I wrote in other projects.
If you are a little into development you did catch it: Object Oriented Programming philosophy. Write small, specialized, even stupid pieces of code and assemble them to create complex software. Like this
The same goes with my idea of a plugin: its functions can be described in one phrase like:
The plugin redirects visitors trying to login to a set page. The plugin creates the "member" and the "member administrator" roles. The plugin customizes profile, login and registration fields. The plugin removes profile fields. The plugin removes menu items for certain user roles. The plugin redirects set users to a set admin page anytime they access the admin area.
I can re-use one or two of those in future projects; this one I will not be able to re-use much:
The plugin redirects visitors trying to login to a set page, creates the "member" and the "member administrator" roles, customizes profile, login and registration fields, removes profile fields,removes menu items for certain user roles, redirects set users to a set admin page anytime they access the admin area.
The more a plugin size and responsibilities grow from the meager construction block to the finished construction itself the more its re-usability lessens.
My rule of thumb here is that what the plugin does should require no more than one sentence to describe and not contain the word “and”. Sometimes, as all rule of thumbs, the rule does not work but a second thought should always be made about the real tie that binds two plugins responsibilities: does one really makes no sense without the other?
The idea above can be very well be synthetized with the title. WordPress itself is not completely Object-oriented and Object-oriented practices are not enforced. I see plugins reflect, the same way crystals do, this tendency from the small-as-a-function scale to the large-as-a-pluign one. Creating classes, their interfaces, their competences and ways of communication do enforce, or at least require some thought about, responsibility separation.
I’d like plugins to be made the same way: do one thing and one thing well.