[keyword] PHP

OOE graphical UML models

HOT TIP: this content is flagged as highly recommended !

This essential and unique subzone progressively includes information on the main Interfaces/Classes in the OOE = Object Oriented Examples = One Of Each object-oriented tutorial module, modelled here in graphical Unified Modeling Language (UML) using the Webel «!wrapper» @Components and «!analysis» @Interfaces recipe - a powerful UML analysis modelling strategy developed over many years by Dr Darren of Webel IT Australia, adapted here to parasitically analyse "already design(ed)" reverse-engineered PHP Interfaces/Classes.

QUICKSTART: use the search table of all UML elements for the OOE module with filters

Flag Plus: graphical Unified Modeling Language (UML) models for PHP

HOT TIP: this content is flagged as highly recommended !
QUICKSTART: jump straight to one of the UML model element and diagram reports for the Flag Plus contributed module:

- The full gallery or the icon gallery of UML diagrams for Flag Plus.

- The UML element overview table of all UML model elements for Flag Plus.

Description
This overview diagram of the entire Flag Plus module system is more graphically complex than is usually recommended ! See also within this zone the dedicated linked "focus" diagrams for each analysis model element with only its nearest neighbour model elements.

TIP: PHPCSMD: a plugin for PHP Code Sniffer compatible with NetBeans8 and the Drupal Coding Standards from Coder

If you are using NetBeans IDE for Drupal contributed module development - my absolutely favourite IDE for many years, and super for PHP and Drupal work - then you SHOULD take the time and trouble to install a plugin that gives you feedback on departures from Drupal coding standards, this can save you days of fiddly work.

PHP magic functions and "overloading"

NB: the term 'overloading' in PHP does not mean the same as in Java or most other OO languages.

From Doc: Overloading:

Overloading in PHP provides means to dynamically "create" properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types.

[pattern] Design By Contract (DBC)

HOT TIP: this content is flagged as highly recommended !

Both Java and PHP offer a formal interface type, which corresponds to the Unified Modeling Language (UML) element Interface; in C++ the same can be achieved with abstract classes, and can be handled in UML either through special reverse/forward engineering identification methods and/or by «Interface» stereotypes (depending on the UML tool, and the UML version).

Although it is described in the Wikipedia article above as an 'approach for designing software' it is a de facto or "honorary" Design Pattern and features in nearly every modern software Design Pattern.

PHP: Integers

Knowing the different possible representations of integers is important when using Drupal, because, for example, it uses hexadecimal bitmasks for the constants used by hook_menu().

From PHP: Integers:

Integers can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation, optionally preceded by a sign (- or +).

Documenting PHP constants in Drupal

TODO: this content is incomplete, unfinished, or under construction.
STUB: this content is flagged as a placeholder only, with minimal content.

PHP UML (PEAR package)

The PHP UML package offers some limited reverse engineering capabilities:

TIP: PHP file inclusion workarounds for many Drupal hook functions in one module

TODO: this content is incomplete, unfinished, or under construction.

A typical problem/side-effect of the hook and form validation and submit handler function convention systems of Drupal6/7/8 is that module files can grow in size to cope with many hooks (and/or convention functions).

One way of (sort of) addressing it is illustrated in the Examples Project: form examples, which includes tricks like:

[pattern] PHP Interface constants [if used wisely]

There is much debate (see external links) about whether or not one should use constants in an interface.

TIP: workarounds for inability to overload methods (esp. constructors) in PHP

In PHP "Overloading" means the ability ' .. to dynamically "create" properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types. ..'
Note:

PHP's interpretation of "overloading" is different than most object oriented languages. Overloading traditionally provides the ability to have multiple methods with the same name but different quantities and types of arguments.

TIP: Debugging Drupal (and PHP applications)

"The most effective debugging techniques seem to be those which are designed and built into the program itself."

- Donald E. Knuth (1993)

PHP namespaces in Drupal (and autoloading)

Your server must be running at least PHP5.3 to handle namespaces !
The conventions for autoloading with namespaces are different between Drupal7 and Drupal8 !

From Drupal: namespaces:

Modules creating classes should place their code inside a custom namespace. The convention for those namespaces is

PHP for Drupal

A zone about PHP as it concerns Drupal.

TIP: NetBeans support for Drupal

These references are an absolute godsend for anybody developing contributed modules for Drupal in NetBeans IDE.

Subscribe to RSS - PHP