This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:dev:all:psr [25.05.2015 15:13] – insert first part of translation in coding standards (I had to undo the same change on the German page where I translated in place by mistake) mrbaseman | en:dev:all:psr [28.12.2018 23:37] (current) – [Official Standards] Manuela v.d.Decken | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
- | |||
====== Coding Standards ====== | ====== Coding Standards ====== | ||
===== Official Standards ===== | ===== Official Standards ===== | ||
- | We did not reinvent the most basic standards for Website Baker and arbitrarily define some rules, but we use basically the same set of rules as many other notable projects and large frameworks | + | {{: |
The basic standards for Website Baker are the standards [[http:// | The basic standards for Website Baker are the standards [[http:// | ||
Some might feel uncomfortable with the quite strict wording using the expressions MUST! or MUST NOT! etc. However, these terms are taken exactly as they are from the original PSRs which in turn striclty stick to [[http:// | Some might feel uncomfortable with the quite strict wording using the expressions MUST! or MUST NOT! etc. However, these terms are taken exactly as they are from the original PSRs which in turn striclty stick to [[http:// | ||
Line 14: | Line 12: | ||
|MAY / OPTIONAL |This states an item which is truly optional.| | |MAY / OPTIONAL |This states an item which is truly optional.| | ||
- | * **[[dev: | + | * **[[en:dev: |
- | * **[[dev: | + | * **[[en:dev:all:psr:psr-1|Basic Coding Standard (PSR-1)]]** - This standard helps to achieve the highest possible degree of compatibility of PHP code contributed from different sources. |
- | * **[[dev: | + | * **[[en:dev:all:psr:psr-2|Coding Style Guide (PSR-2)]]** |
- | * **[[dev:all:psr-4de|Improved Autoloading (PSR-4)]]** -A more modern interpretation autoloading, | + | * **[[http:// |
- | * **[[dev: | + | * **[[en:dev: |
+ | |||
+ | ===== Basic rules for programming in the WB-environment ===== | ||
+ | With every subsequent release of WebsiteBaker, | ||
+ | At present, i.e. before 2.10.0, compliance with many regulations is still voluntary, in the 2.12.0 much is already deprecated, and later on many of the specifications of 2.12.0 will be mandatory. All this sounds very restrictive to many, but this is gladly accepted, since precisely these limitations will eventually ensure a stable modularity, flexibility and interchangeability for stable, reusability and mainly maintainability of code. | ||
- | ===== Grundsätzliche Regeln zur Programmierung im WB-Umfeld ===== | + | ==== General rules for Addons |
- | Mit jeder weiteren Version von WebsiteBaker entfernt sich der Programmierstil immer weiter vom bisherigen, seit fast 10 Jahren gewohnten, ' | + | .. which should should, regardless of WB, apply as well to any at least semi-professional project and be a basis of every serious programmer training. |
- | Derzeit, also bis zur 2.8.4 ist die Einhaltung vieler Regeln noch freiwillig, ab 2.8.4 wird vieles bereits deprecated und ab 2.9 werden viele der Vorgaben zwingend sein. Das alles hört sich für viele sehr einschränkend an, was aber gerne in Kauf genommen wird, da genau diese Einschränkungen letztendlich für eine stabile Modularität, | + | |
- | ==== Allgemeine Regeln für Addons | + | Addons |
- | .. die eigentlich so, unabhängig von WB, in jedem halbwegs professionellen Projekt gelten sollten und Grundlage jeder ernsthaften Programmierer-Ausbildung sind. | + | |
+ | | ||
+ | - ... Are normally not allowed to establish any direct connection to the outside world | ||
+ | - ... May never modify or write data to areas of other addons or the Core | ||
+ | - ... Never change the code of other addons or the core (also applies to installation and upgrade) | ||
+ | - ... May only send data to the browser throught the responder of core | ||
+ | - ... May not define global variables or global constants. | ||
+ | - ... May never use indirect addressing or allow that! | ||
- | Addons... | + | for later versions |
- | - ... dürfen weder den Core noch andere Addons triggern, sondern werden grundsätzlich vom steuernden Core getriggert | + | |
- | - ... dürfen den Ablauf des Gesamtsystems nicht stören | + | |
- | - ... ist im Normalfall keine direkte Verbindung zur Außenwelt gestattet | + | |
- | - ... dürfen niemals schreibend auf Datenbereiche anderer Addons oder des Core zugreifen | + | |
- | - ... dürfen niemals den Code anderer Addons oder des Core ändern | + | |
- | - ... dürfen ausschließlich über den Responder des Core Daten zum Browser etc. senden | + | |
- | - ... dürfen keine globalen Variablen oder globalen Konstanten definieren. | + | |
- | für spätere Versionen (ab 2.9) werden noch weitere Einschränkungen kommen. Siehe die jeweiligen Abschnitte dieser Dokumentation. | + | |