User Tools

Site Tools


en:dev:all:psr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
en:dev:all:psr [16.05.2015 09:21] – created Manuela v.d.Deckenen: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 Standards =====+===== Official Standards ===== 
 +{{:check.png?nolink&128 |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  (see [[http://www.php-fig.org/#voting-members|PHP-FIG Referenzliste]]). \\ 
 +The basic standards for Website Baker are the standards [[http://www.php-fig.org/psr/psr-0|PSR-0]] / [[http://www.php-fig.org/psr/psr-1|PSR-1]] / [[http://www.php-fig.org/psr/psr-2|PSR-2]] and [[http://www.php-fig.org/psr/psr-4|PSR-4]] of the **PHP Framework Interop Group**.\\ 
 +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://tools.ietf.org/html/rfc2119|RFC 2119]] and should therefore be understood exactly in this sense.\\ 
 +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/prohibition. However, there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.| 
 +|SHOULD NOT / NOT RECOMMENDED |:::| 
 +|MAY / OPTIONAL |This states an item which is truly optional.|
  
-{{:check.png?nolink&128 |Standards}}Die Standards für WebsiteBaker wurden jetzt auch nicht neu erfunden und willkürlich festgelegt, sondern wir verwenden prinzipiell die selben, die auch sehr viele andere namhafte Projekte und große Frameworks (siehe [[http://www.php-fig.org/#voting-members|PHP-FIG Referenzliste]]) benutzen.  +  * **[[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>As of 2014-10-21 PSR-0 has been marked as deprecated. PSR-4 is now recommended as an alternative.</span> 
-Die grundlegenden Standards für WebsiteBaker sind die Standards [[http://www.php-fig.org/psr/psr-0|PSR-0]] / [[http://www.php-fig.org/psr/psr-1|PSR-1]] [[http://www.php-fig.org/psr/psr-2|PSR-2]] und [[http://www.php-fig.org/psr/psr-4|PSR-4]] der **PHP Framework Interop Group**.\\ +  * **[[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://tools.ietf.org/html/rfc2119|RFC 2119]] halten, übernommen worden und sollten auch exakt so verstanden werden.\\ +  * **[[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/werden nach folgendem, in RFC2119 definierten Sinn übersetzt: +  * **[[http://www.php-fig.org/psr/psr-4|Improved Autoloading (PSR-4)]]** -A more modern interpretation autoloading, which reflects the continued progress in the ecosystem.  
-^englisch ^deutsch ^Erklärung | +  * **[[en:dev:all:wb-adaption|WebsiteBaker-Adaption]]** - General adaptation of PSR standards to specific conditions of Website Baker.
-|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/Verbot. Jedoch kann es in Ausnahmefällen gute Gründe geben, diesen Punkt zu ignorieren. Dazu sollten aber die vollen Auswirkungen der Missachtung gut verstanden und sehr genau überlegt werden ob die Abweichung tatsächlich erforderlich ist.| +
-|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:all:psr:psr-0de|Autoloading Standard]]** - Er zielt darauf abein standardisiertes Dateiformat sowie Klassennamen und Namespace Konventionen bereitzustellendie Plug&Play Code ermöglichen. +===== Basic rules for programming in the WB-environment ===== 
-  * **[[dev:all:psr-1de|Basic Coding Standard]]** - Hiermit soll ein möglichst hoher Grad an Kompatibilität von PHP-Code aus unterschiedlichen Quellen erreicht werden.  +With every subsequent release of WebsiteBaker, the programming style evolves continually away from the previous 'anarchic' stylewidely used for almost 10 yearstowards to a more modular, but also forcibly bound to strict programming interfaces mannerThis requires a consistent rethinking especially for addon programmers.\\ 
-  * **[[dev:all:psr-2de|Coding Style Guide]]** Enthält Anweisungendie dafür sorgendass PHP-Code immer eine standardisierte optische Erscheinung hat. +At presenti.e. before 2.10.0, compliance with many regulations is still voluntaryin the 2.12.0 much is already deprecatedand 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:all:psr-4de|Improved Autoloading]]** - Eine modernere Interpretation automatischen Ladensdie die weiteren Fortschritte im Ökosystem reflektiert. +
-  * **[[dev:all:wb-adaption|WebsiteBaker-Adaption]]** - Generelle Anpassung der PSR-Standards an spezielle Bedingungen von WebsiteBaker.+
  
-===== 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, 'anarchischen' Stil, hin zu einer immer modulareren, jedoch zwangsweise auch an strenge Schnittstellen gebundenen ProgrammierweiseDas wird vor allem von Addon-Programmierern ein konsequentes Umdenken erfordern.\\ +.. which should shouldregardless of WBapply as well to any at least semi-professional project and be a basis of every serious programmer training.
-Derzeitalso bis zur 2.8.4 ist die Einhaltung vieler Regeln noch freiwilligab 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, für stabile Flexibilität und für Austauschbarkeit, Wiederverwendbarkeit und vor allem Wartungsfreundlichkeit von Code sorgen werden.+
  
-==== Allgemeine Regeln für Addons ==== +Addons ... 
-.. die eigentlich sounabhängig von WB, in jedem halbwegs professionellen Projekt gelten sollten und Grundlage jeder ernsthaften Programmierer-Ausbildung sind.+  ... May trigger neither the core nor other addonsbut are generally triggered by the controlling core 
 +  - ... Must not interfere with the flow of the entire system 
 +  - ... 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 (2.12), further restrictions will comeSee the respective sections of this documentation.
-  - ... 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 (gilt auch für Installation und Upgrade) +
-  - ... 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.9werden noch weitere Einschränkungen kommenSiehe die jeweiligen Abschnitte dieser Dokumentation.+
  
en/dev/all/psr.txt · Last modified: 28.12.2018 23:37 by Manuela v.d.Decken