Opened 6 years ago
Closed 5 years ago
#4160 closed enhancement (wontfix)
Add to w.org plugin's directory the support of additional params from readme.txt - "Coding-Standards:" (like "Tags") and "Micro-Framework:"
Reported by: | KestutisIT | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Plugin Directory | Keywords: | 2nd-opinion |
Cc: |
Description
I'm suggesting an approach that could help to raise the plugin's code quality at w.org plugins directory, as well as to improve filtering of better code's quality plugins, and make the search more accurate and precise by adding two more parameters to "readme.txt" and to parse them with "Plugins-directory" plugin, that parses those "readme.txt" files.
Those additional parameters are the following:
- "Compliant With:" <LIST OF CODING STANDARDS> - similar to what we have with "Tags" now.
- Micro-Framework: - what was the 'boilerplate', on which plugin was made, i.e. SolidMVC, Redux Framework, Unyson Framework.
HISTORY
In the coding standards world there is nothing in "black-and-white" only. There is so much of "gray". And what I heard from WordPress core committers and team leads last year when I presented to all the the “SolidMVC” micro-framwork, which is collection of coding standards, and guideline to start in same day for a Software Architect that comes from other programming languages (like C# or JAVA) or PHP frameworks (like Symfony or Laravel). What they said, that:
“The biggest issue about the coding standards, is not about “do you use echo or print” - that’s none how impact the code quality or readability. The biggest problem is that majority of WordPress plugin developers still does not know what the S.O.L.I.D. Principle is, what Model-View-Controller is, that they have to separate code from templates, or what is PSR-2 or PSR-4 Autoloaders. If they would knew all that, we would already live in a better world.”
That is collective-quote from Dion Hulse (@dd32), Joost de Valk (@joostdevalk), and few other team leads that sat by the table.
CODING STANDARDS ("Compliant With: <..>, <..>, <..>")
Coding Standards list can be a similar to tag cloud in StackOverflow - here defined tags can be added automatically, but the new tags has to be approved by moderator:
PSR-2 - created by PHP evangelists, but is pretty much cross-platform, any C# or JAVA developer can pick-up this.
PSR-4 Autoloaders - created by PHP evangelists, but is also, pretty much cross-platform, as in C# or JAVA the loading is done automatically as well.
Semantic Versioning - again, evolved from PHP.net's version_compare()
, and became a cross-platform dependency-hell preventer.
BCNF Database Structure - there can also be a lower level definition of Third Normal Form or more strict - Fourth Normal Form
Unicode CLDR KEY=>VALUE language package support - Open-Source “Unicode CLDR” is cross-platform KEY=>VALUE translation-based solution for databases of GEO-CODING (country names, city names, ares, Airport Codes (IATA), phone regions etc.), and is largely sponsored by Google.
_Notes: Google also developed Google AMP for WordPress (Accelerated mobile pages) and was main sponsor of WordCamp Europe 2018. As well as this is most popular language translation solution. Also it is the fastest solution, as the language data gets to the memory right away without parsing, can be edited by any editor, including Notepad++, and is suitable for enterprise project with different extensions on same code-base, where LANG_ITEM_TEXT in template, based on extension and loaded file might describe a car or a boat._
POT (Portable Objects Template) files - popular only within WordPress and WPML. The biggest drawback of it, that is is pretty-much commercial tool - the only useful editor is PO-Editor, which is free to translate, but is paid for plugin developers to generate those .PO/.MO files. It is not cross-platform, it's file has to be parsed (is not native to the language) and is not suitable for extensions and large enterprise projects that needs to run different extensions on same code base.
MICRO-FRAMEWORK: <..>
2 of 3 modern medium+ size plugins and themes runs on some kind of micro-framework, developed by the company or MIT-open-sourced.
None - for the WordPress plugins, that are not based on some kind of micro-framework.
SolidMVC - a GDPR-compliant micro-framework that based on collection of most popular coding-standards (PSR-2, PSR-4 Autoloaders, Semantic Versioning, Unicode CLDR support, BCNF Database Structure) and Technologies (Font-Awesome) to allow any Object-Oriented Software Architect from C# or Java, PHP Software Architects comming to WordPress from Symfony or Laravel, to pick-up and start coding in WordPress withing the same day, without any need to learn any new coding standards. I, as software architect, developed the SolidMVC together with professors and lectors from worlds TOP-500 universities, that are the creators of Software Engineering Master Degree courses of Software Architecture and Design courses. The SolidMVC was developed in 4 years (2015-2019) and is licensed under almost unlimited - MIT-license, meaning that it can be used for both - commercial and non-commercial use. The example MVP (Minimum Viable Product) of SolidMVC is at w.org as "Expandable FAQ".
Redux Framework - popular solution for options for theme authors.
Unison framework - also popular framework by theme authors, it was also used by older versions of Avada.
So keeping in mind, that I put 4 years to develop a micro-framework to create plugins, as well as there is many other micro-frameworks, as well used by hundreds of authors, as a micro-framework author, I'd really love to know who are enjoying and creating the plugins on given technology. As well as that could be a perfect way to understand whose coding quality is high enough and to develop the websites by using the "same-family" code-base, which may prevent the mentioned "dependecy hell" as well as "updateness".
Change History (7)
#2
in reply to:
↑ 1
@
6 years ago
Well, actually, - many, because, I believe, the section would appear in plugin's page at w.org, only if the values are defined. And then the two example situations, when it would be super valuable:
- “I’m building a widget for DirectAdmin that will patch the plugins automatically, but not update them”. For this I need to avoid thing, called “dependecy hell”, and this is solved only if the plugin follows the “Semantic Versioning” (SemVer) coding standard.
- I just hired a new developer in my company, who is software architect coming from C#. So he is familiar with PSR-2 and PSR-4 Autoloaders (meaning, he don't have to bother understanding includes). His task is to take some similar plugin from w.org, and make a "Dietary product list" plugin - so what he does, is he first searches at w.org for similar scope plugins (in this case "FAQ plugin") that is "PSR-2"-compliant, as this is the code he can pick-up and start editing at DAY 1.
Replying to joyously:
Seems like you can't fully use an incomplete classification system. All of the existing plugins would not have values for the new fields, and even new plugins would not necessarily have a valid value to put in. So what good would it actually do?
#4
follow-up:
↓ 6
@
6 years ago
I'm less interested in the technical aspect of this (which you've outlined very thoroughly), but how does this help the end user? They don't know what coding standards and frameworks are, so what value would this add?
#5
@
6 years ago
- Keywords 2nd-opinion added
I have to agree with @Clorith here, does adding these tags benefit the target audience of the Plugin Directory?
If you take the general audience of "WordPress Users" it certainly doesn't.
If you take the audience of "WordPress Developer creating sites" then it may, but does it really?
- Does the developer need to know that under-the-hood it makes use of SuperAwesomeLibrary? Or just that it works?
- Do they need to know that the code is in their preferred PSR format? or just the functions/methods it can interface with to perform a task? Any decent developer should be able to pick up any PHP code regardless of what it's written in and be able to use it as-is, but furthermore, the developer shouldn't even need to be able to edit the plugin as they shouldn't be doing that at all.
On the topic of POT files
though, it's worth noting that plugins in the directory do not need to use them directly, as we handle the translations through GlotPress unless the author wishes to handle translations themselves somehow. WordPress Core only supports po/mo/json files for translation, and if that changes in the future plugins will just be able to use it without any changes.
#6
in reply to:
↑ 4
@
6 years ago
Replying to Clorith + Replying to dd32:
Ok @Clorith adn @dd32 , I will base my comment of facts and research / sales results:
- "KNOW YOUR CUSTOMER". At WordCamp Europe 2018 one of the main talks was "WordPress in 2019" by @noel_tock (Noel Tock), which was about where WordPress was 10 years ago and where it will be next year, and how it changed. Session - https://2018.europe.wordcamp.org/session/wordpress-in-2019/ , slides - https://www.slideshare.net/ntock/wordpress-in-2019 . From the attached images bellow, you see, that if in 2010 WordPress had a coverage from "representational "About.us" site" to the very complex website (enterprise solution), then in 2018 it is already different - the "About Us" websites are now fully covered by Facebook, for those who need a bit more modifications for the "About.us" websites - they use Wix.com. WordPress is used then, when either - privacy matters a lot, meaning everything has to be self-hosted, including internal analytics, no Google tracking, no policy given big company like Facebook - and Facebook does that a lot, it tries to set 'their favorable' political views, as well as even to use your friend as a 'product' by their newest "Include donation campaign to your birthday". So there is a lot of people who resist to that - but everyone who I met, who does resist to Facebook, does not install WhatsApp, Messenger or Facebook apps on their phones, and use Facebook only via Web - all they were smart, tech-savvy people. So they know what is PGP key, ProtonMail.ch, HTTPS and Signal App. Very often they also have at least basic understand about security, and this is where often pop-us questions about data validations and coding standards - they may not be a developers or so, but they have heard in one or another conference some term, what is secure and high-quality, and they want an "MVC website with S.O.L.I.D. and there has to be HTTPS and semantic versioning". Also they want "PHP7, and object-oriented code". That's what I hear often from those people. So despite they may not know exactly what it does, they got recommendations from their IT friends, on some Facebook IT group, to what to use for their product. So how to discover those WordPress plugins at w.org right now, whose code follows these security standards, and design principles - we can't, just via Google index we may pick-up some data from the content. White there has to be a way to do that.
*NOTE: If someone has a question, what the empty white space in the middle represent there in a picture of 2018 - that is SaaS software - a niche websites, like Booking.com or AirBnb.com, that focuses on specific problem and provide multi-tenancy feature - allowing customers to create their own profile of seller and make money
- WORDPRESS FOR ENTERPRISE & WORDPRESS FOR PUBLIC SERVICES. Today WordPress is much more Enterprise-accepted than it was in 2010, so that blue bar for today should be moved even further. The big companies started to trust WordPress. In Summer, 2018, I convinced probably the first capital in European Union - Vilnius City Municipality, to ditch their current custom made website, and switch to WordPress. And they did that - so now WordPress is being used for PUBLIC SERVICES. And I go even further - last weekend I pitched the SolidMVC, as the in VoteCraft hackathon in European Parliament Bureau in Vilnius. I been working in Digital Democracy (Online Petitions and Internet Voting) field for past 5 years, did my scientific research, involved in to that Vilnius University proffers and even a Dean of Faculty of Mathematics and Informatics - that's how the SolidMVC has born - it is not just a micro-framework for C#'ers or JAVA'ers to start writing their code immediately without any need to learn additional coding standards, SolidMVC is also secure-enough to use if for elections, by starting local elders of city areas elections online with secret-voting. That includes cryptography, and even digital signatures - and WordPress already has plugins in E-Signature field like this one - https://www.secure.approveme.com/demo/ ). So things moving forward, and even government organizations started to trust WordPress security.
- EDUCATE THE WORLD. 10 years ago nor Mayors of the Cities, nor Ministers at the Parliament had any idea about how the WordPress is different from Symfony, or PHP from JAVA. Today they have that knowledge. WordPress leads the 33% of the whole internet - so that also put a lot of responsibility and ability to educate the world - educate them about security, coding-standards, programming languages, frameworks, micro-framorks, principles and techniques. So the main question is here - do we want to make the world smarter, if so - then let we give our customers more details about micro-framework and coding standards used - not everybody will dig-down to it, but people and curious - that is given to use by the nature, they will Google or ask - their friend or in plugins support forum - what it is, and how to eat that. And the message will spread.
- CUSTOM-WORKS TO PLUGIN & STATS OF "TYPICAL WP PLUGIN BUYER" IN 2019. By taking an example of mine Reservations plugin sold on Envato for ~2000 times, I can say, that only 15 people of those 2000 (less than 0,1%) had no idea of what they doing - meaning they tried to upload plugin as a theme, or whole package ZIP, not just the plugin's ZIP. 500 customers (20%) were individual developers, doing the website for their customer - they really did cared about security, and scalability-ensuring patterns (like BCNF-database structure and MVC). Then the majority of customers - 1500 customers, where the Agencies (with 3-10 employees, of whose 1-8 were developers), who are doing websites for their end-customers, which is often is medium to enterprise companies (100-1000 employees). 50% of them did custom-works to the plugin. And they bought the plugin just because they can do the custom works with it. Meaning they needed the MVC, S.O.L.I.D. and plugin support for Unicode CLDR (Key=>VALUE pairs) to add the Geo-Data in their language i.e. country names, city names, phone area names and so on, on what they are working, and they changed the plugin's behaviour to fit their medium/enterprise business customer needs, i.e. a business rule, that if object is rented in state X, for a Y days, and it was returned before the noon, then do not charge additional day costs - the rules that you cannot predict by filters or hooks - or you would need 100,000 filters and hooks support and 1 million pages documentation for all them. That would not work for the larger business, as nobody would want to learn now to hook to and what is the filter names of each bigger plugin.
- WHEN FILTERS & HOOKS ARE GREAT:
- I love the WordPress because of it's filters and hooks - the ability to hook to the WordPress core from a plugin - but at he same time keep in mind that WordPress has probably over 100 people who been writing it's documentation of hooks in last 15 years - the regular plugin authors does not have this luxurity, plus nobody would want to learn the names of filters of the plugin that does not have at least 1 million active installations and 10 millions downloads, especially if that is web-agency who bought that plugin for use in that 1 particular customer's website and they are done and goes to next project.
- Also it is great for child themes of some kind of theme.
- Also, for cross-plugin WordPress plugins - i.e. "ReCaptcha integration" plugin (if it is not done by the plugin), "SMTP mailing settings" plugins, "Google Analytics" plugin or "WPML" language plugin (while I personally think that WordPress Multisite with Network-Enabled plugin and linking by ID's is much better, more stable, and more scalable solution, plus it is free).
- All other bigger plugins, have no need to have filter or action hooks, if they don't want to (a choice in favor) - I does complicate the testing of that plugin if it has UnitTests, as you don't know if the function 5+3 will always return 8. So instead of filters-and-hooks these plugins use extension-points for i.e. Captcha Provider (i.e. ReCaptcha), Notification method (i.e. SMS Provider) or Payment Method (i.e. PayPal), where they add their payment method library's folder to /wp-content/plugins/GreatSystem/Libraries/ folder, and then use a transpiler class, i.e.:
<?php final class PayPalToGreatSystemTranspiler implements GreatSystemPaymentMethodInterface { <..> }
- And here the GreatSystemPaymentMethodInterface has all the required method and in documention is cleary described what each method implementation does. So there is no need then to write a 10,000 pages documentation with 10,000 filter names, just make one class that is testable and suitable for TDD (Test-Driven-Development) and can be tested with PHPUnit on PHPStorm via "/wp-content/plugins/GreatPluginTests/" plugin, if that payment methods comes pre-installed or from '/wp-content/plugins/PayPalForGreatSystemTests/Init.php'.
- So with my, enterprise-ready, plugin I may hook to cross-plugin type plugin like WPML but not vice-versa.
- WHEN THE POT (Portable Objects Template) IS GREAT:
- It is cool that WordPress core made in POT. It is a platform, not a product for niche market, so there is no WordPost, WordArticle etc. - but if it would, the nobody would ever want to maintain different code-base for every extension - that is for what POT is absolutely not suitable.
- Also the POT files are great for themes - I believe that themes has to be light and fast and should not go into plugin territory.
- POT files might be also great for some small one/two file plugins, that does not need any micro-framework, like "EasySMTP". Also POT can be useful for 'hook-based' general-purpose plugin like WooCommerce.
- But that is only one option. Besides the WooCommmerce there is other products, for other market needs. Especially for the companies, who don't like WooCommerce and it's ads-full interface and promotion of other WooCoomerce product / extensions in WooCommerce admin, as well as those who focus on fast and scalable solutions for medium-size to enterprise companies, and when they look a products that have a defined use-case scenario, i.e. Hotel Booking, without any need to configure thousands of options before launch.
- So for all those 'd' cases - it is enough that plugin just have a text-domain registration, would apply plugin locale filter before loading it's language file file (doesn't matter it is Unicode CLDR or POT) and register 'load_textdomain' and 'load_plugin_textdomain' - that is enough that the w.org would be able to fully process through GlotPress the plugin name and description for translation, which is important for multilingual w.org website - you can see that right here - the 5 lines are available for translation - https://translate.wordpress.org/projects/wp-plugins/expandable-faq/dev/lt/default . And the Source code of the mail controller is here - https://plugins.trac.wordpress.org/browser/expandable-faq/trunk/Controllers/MainController.php
- The excerpt with only the 'i18n' method of SolidMVC micro-framework, of MVP (extension-less boilerplate) is below:
<?php final class MainController { // Because loading of language text is not allowed in the very early time, we use constants to simulate language text behavior, just the text is English const LANG_ERROR_CLONING_IS_FORBIDDEN_TEXT = 'Error in __clone() method: Cloning instances of the class in the Rental System is forbidden.'; const LANG_ERROR_UNSERIALIZING_IS_FORBIDDEN_TEXT = 'Error in __wakeup() method: Unserializing instances of the class in the Rental System is forbidden.'; const LANG_ERROR_SESSIONS_ARE_DISABLED_IN_SERVER_TEXT = 'Warning: Sessions are disabled in your server configuration. Please enabled sessions. As a slower & less secure workaround you can use virtual session via cookies, but that is not recommended.'; const LANG_ERROR_PLEASE_UPGRADE_PHP_TEXT = 'Sorry, %s requires PHP %s or higher. Your current PHP version is %s. Please upgrade your server Php version.'; const LANG_ERROR_PLEASE_UPGRADE_WP_TEXT = 'Sorry, %s requires WordPress %s or higher. Your current WordPress version is %s. Please upgrade your WordPress setup.'; const LANG_ERROR_EXTENSION_NOT_EXIST_PLUGIN_CHILD_THEME_TEXT = 'Sorry, but %s extension does not exist neither in %s plugin directory, nor in %s child theme folder, nor in it's parent %s theme's folder.'; const LANG_ERROR_EXTENSION_NOT_EXIST_PLUGIN_THEME_TEXT = 'Sorry, but %s extension does not exist neither in %s plugin directory, nor in %s theme folder.'; const LANG_ERROR_UNKNOWN_NAME_TEXT = 'Unknown name'; const LANG_ERROR_DEPENDENCIES_ARE_NOT_LOADED_TEXT = 'Dependencies are not loaded'; const LANG_ERROR_CONF_WITHOUT_ROUTING_IS_NULL_TEXT = '$confWithoutRouting is NULL'; const LANG_ERROR_CONF_IS_NULL_TEXT = '$conf is NULL'; const LANG_ERROR_LANG_IS_NULL_TEXT = '$lang is NULL'; const LANG_ERROR_IN_METHOD_TEXT = 'Error in '%s' method: %s!'; // Configuration object reference private $confWithoutRouting = NULL; private $conf = NULL; private $lang = NULL; private $canProcess = FALSE; // Have to be in main controller, as we don't use that for abstract controller private static $dependenciesLoaded = FALSE; // <..> /** * Internationalization. * Load the language file, only if it is not yet loaded * * @access private * @return null|\ExpandableFAQ\Models\Language\Language * @throws \Exception */ private function i18n() { if(static::$dependenciesLoaded === FALSE) { throw new \Exception(static::LANG_ERROR_DEPENDENCIES_ARE_NOT_LOADED_TEXT); } // Singleton pattern - load the language file, only if it is not yet loaded if(is_null($this->lang) && static::$dependenciesLoaded === TRUE) { // Assign routing to conf, only if it is not yet assigned $conf = $this->conf(); if(is_null($conf)) { throw new \Exception(static::LANG_ERROR_CONF_IS_NULL_TEXT); } // Traditional WordPress plugin locale filter // Note 1: We don't want to include the rows bellow to language model class, as they are a part of controller // Note 2: Keep in mind that, if the translation do not exist, plugin will load a default english translation file $locale = apply_filters('plugin_locale', get_locale(), $this->confWithoutRouting->getTextDomain()); // Load textdomain // Loads MO file into the list of domains. // Note 1: If the domain already exists, the inclusion will fail. If the MO file is not readable, the inclusion will fail. // Note 2: On success, the MO file will be placed in the $l10n global by $domain and will be an gettext_reader object. // See 1: http://geertdedeckere.be/article/loading-wordpress-language-files-the-right-way // See 2: https://ulrich.pogson.ch/load-theme-plugin-translations // wp-content/languages/<PLUGIN_FOLDER_NAME>/lt_LT.mo load_textdomain($this->confWithoutRouting->getTextDomain(), $this->confWithoutRouting->getGlobalLangPath().$locale.'.mo'); // wp-content/plugins/ExpandableFAQ/Languages/<EXT_FOLDER_NAME>/lt_LT.mo load_plugin_textdomain($this->confWithoutRouting->getTextDomain(), FALSE, $this->confWithoutRouting->getLocalLangRelPath()); $this->lang = new \ExpandableFAQ\Models\Language\Language( $this->confWithoutRouting->getTextDomain(), $this->confWithoutRouting->getGlobalLangPath(), $conf->getLocalLangPath(), $locale, FALSE ); } return $this->lang; } // <..> }
Seems like you can't fully use an incomplete classification system. All of the existing plugins would not have values for the new fields, and even new plugins would not necessarily have a valid value to put in. So what good would it actually do?