This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
en:dev:all:psr [16.05.2015 09:21] – created Manuela v.d.Decken | en:dev:all:psr [28.12.2018 23:28] – [Basic rules for programming in the WB-environment] 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 ====== | ||
- | ===== Offizielle | + | ===== Official |
+ | {{: | ||
+ | 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:// | ||
+ | The most important keywords defined in RFC2119 are: | ||
+ | ^keyword ^explanation | | ||
+ | |MUST / REQUIRED / SHALL |This means that the definition is an absolute requirement of the specification.| | ||
+ | |MUST NOT / SHALL NOT |These phrases mean that the definition is an absolute prohibition of the specification.| | ||
+ | |SHOULD / RECOMMENDED |This is also a very strong requirement/ | ||
+ | |SHOULD NOT / NOT RECOMMENDED |:::| | ||
+ | |MAY / OPTIONAL |This states an item which is truly optional.| | ||
- | {{: | + | * **[[en:dev:all:psr:psr-0|Autoloading Standard (PSR-0)]]** - This standard aims to provide a standardized file format, as well as class name and namespace conventions that enable plug and play code. <span important> |
- | Die grundlegenden Standards für WebsiteBaker sind die Standards [[http:// | + | * **[[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. |
- | Auf den nachfolgenden Seiten haben wir die Originalstandards ins Deutsche übersetzt. Vielleicht nicht ganz wörtlich, jedoch absolut sinngemäß. Manche mögen sich an der recht strikten Ausdrucksweise (das MUSS!, das DARF NICHT! etc.) stören. Diese Ausdrücke sind aber exakt so aus den originalen PSRs, die sich wiederum strikt an [[http:// | + | * **[[en:dev:all:psr:psr-2|Coding Style Guide (PSR-2)]]** This provides instructions that ensure that PHP code always has a standardized visual appearance. |
- | Die wichtigsten Schlüsselworte wurden/ | + | * **[[http:// |
- | ^englisch ^deutsch ^Erklärung | | + | * **[[en:dev:all: |
- | |MUST / REQUIRED / SHALL |MUSS / ERFORDERLICH / SOLL |es ist ein absolutes Erfordernis der Spezifikation. | | + | |
- | |MUST NOT / SHALL NOT |DARF NICHT / SOLL NICHT |es ist ein absolutes Verbot durch die Spezifikation. | | + | |
- | |SHOULD / RECOMMENDED |SOLLTE / EMPFOHLEN |Auch das ist ein absolutes Erfordernis/ | + | |
- | |SHOULD NOT / NOT RECOMMENDED |SOLLTE NICHT / NICHT EMPFOHLEN |:::| | + | |
- | |MAY / OPTIONAL |KANN / OPTIONAL |hiermit wird eine wirkliche Option bezeichnet, die sein kann aber nicht muss| | + | |
- | * **[[dev: | + | ===== Basic rules for programming in the WB-environment ===== |
- | * **[[dev: | + | With every subsequent release of WebsiteBaker, |
- | * **[[dev: | + | 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. |
- | * **[[dev: | + | |
- | * **[[dev: | + | |
- | ===== 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. | + | |