Php models

PHP Code Design
PHP is a server-side, open-source, HTML-embedded scripting language used to drive
many of the world’s most popular web sites. All major web servers support PHP
enabling normal HMTL pages to embed code fragments that get interpreted before being
served up to requesting users. PHP is often used with MySQL, a popular open-source
database engine.

PHP is a modern language for web site development with both procedural and object-
oriented programming and integrated database support. It often serves as the glue code to
connect web pages to a server-side database. An interactive web site is event driven.
Each user click, menu selection or keyboard action can initiate a thread of execution that
runs many lines of code.

Many web projects start as small code snippets gathered from open source sites. As the
web site grows to accommodate new data interfaces, web pages and more user features,
new developers are added to the team. Without design and documentation tools, the
project often becomes unmanageable, unreliable, insecure and costly to expand.

This paper shows techniques used to organize and communicate the structure of existing
PHP projects and design new enhancements. Software models provide the framework
that enables a development team to work together productively and understand, evaluate
integrate or implement new source code for a PHP project.

   •   PHP supports procedural programming where each root module calls functions
       that in turn call other functions creating a thread of execution that can be
       represented with a hierarchical Structure Chart diagram.

   •   PHP supports object-oriented programming with classes, attributes and functions.
       The static structure of object-oriented programs can be represented with a Class
       diagram using the Unified Modeling Language (UML) notation.

   •   The data structure of a relational database can be represented with a Data Model
       diagram, also called an Entity-Relation diagram.

This paper assumes a working knowledge of PHP. It illustrates object-oriented program
design with UML class diagrams and procedural program design with structure charts.
Tools can automate the process of generating design information from existing code and
generating new code from the design.
Modeling Basics
MacA&D and WinA&D from Excel Software are software-modeling tools enriched with
PHP language specific details used to generate source code. MacTranslator and
WinTranslator are reverse engineering tools that scan code to extract design information
to a text file. That information yields structure charts and class diagrams within the
modeling tool.

Models can be drawn from a palette of tools. As objects are placed on the diagram, they
are given a name and other properties. Each object, be it a module (function), class or
database entity has an associated entry in the global data dictionary for the project.
Language specific details like a function’s parameter list can be entered for PHP or other
programming languages. MacA&D and WinA&D use this information to generate PHP
code from the model with a simple button click.

PHP programs tend to be event driven by end-user actions like clicking a button on a web
page. An HTML form often presents a user interface where the action script runs the root
module (function) of some PHP code that calls an inverted hierarchical tree of modules as
illustrated below.




                               Server-Side PHP Threads of
                                Execution for a Web Page

As web sites grow, they become large software projects with many threads of executions.
The structure of each thread can involve a few PHP functions or sometimes hundreds of
functions. Programmers can use Structure Chart diagrams to illustrate module
hierarchies to understand, communicate, manage and enhance complex web sites.
Structure Charts of Procedural Code
Each thread of execution is represented with a Structure Chart diagram. At the top of the
diagram, the root module is shown as a named box. Each called module is shown as a
named box connected with a line and arrowhead pointing to it.




                     Structure Chart for PHP Thread of Execution

In the open source commerce project illustrated below, WinTranslator was used to
process PHP code. The output files are imported into WinA&D to automatically generate
structure charts.

WinA&D has a contents view at the left showing the name of each structure chart
diagram. The selected diagram is shown at the right. In the screen shots shown below,
you can see that the PHP software can draw graphs daily, monthly, yearly, etc.

The structure of the daily and monthly thread is almost identical. Each chart calls a
module named html_graph with a small box icon in the bottom right corner of the
module. This indicates that the module is linked to a child diagram titled html_graph
containing a shared branch of code. A developer can double-click that module to see the
child diagram.

When little human effort, WinTranslator and WinA&D can scan PHP code to
automatically document each thread of execution and identify shared branches of code
that it places on a separate child diagram.
Structure Chart in WinA&D for Daily Graph Thread




Structure Chart in WinA&D for Monthly Graph Thread




         Shared Diagram for HTML Graph
Class Model of Object-Oriented Code
Procedural programs define data structures and functions that access and manipulate that
data. As a program grows in size and complexity, the structural hierarchy of its modules
also grows. It becomes increasing difficult to keep track of which functions or threads of
execution are manipulating which data. Seemingly small changes can ripple through the
software system with unintended affects.

An object-oriented program organizes related data and functions into classes. To reduce
the ripple effect of program changes, the actual data structures are often hidden from the
other classes or functions that access that data through methods. The physical data
structure can change while the interface of the access method and its callers are
unaffected. Classes are reusable, self-contained, conceptual units of a program’s code
and data.

PHP supports object-oriented programming with classes, interfaces, attributes,
operations, constructors and destructors. A class can inherit another class, then reuse or
override its methods. Attribute and operation members of a class can have public, private
and protected access to limit accessibility of class members to other parts of the program.

The static structure of object-oriented programs can be represented with class diagrams
using the Unified Modeling Language (UML) notation. UML defines graphical notations
for describing and designing object-oriented software systems. It’s an open standard
controlled by the Object Management Group (OMG). Although UML has many diagram
types, class models are highlighted here to show static class structure and relationships.




                      UML Class Diagram for Online File Browser
A UML class diagram shows each class as a named box. The name of each class
attribute member is displayed in one section of the box, with class operation members
shown in another section. A class points to the parent class that it inherits.

In WinA&D, a class model can be drawn from a palette of tools. As each class instance
is placed on the diagram, it’s named in the Class Properties dialog. Each class has a
corresponding entry of the same name in the data dictionary where details of that class
are stored. Detailed information about a class is stored once, but can be presented on
many diagrams. Diagrams within the class model and in other types of diagram
documents share data stored in the global dictionary.

For a selected class object on the diagram, the Details button presents the Class Attributes
& Operations dialog. This dialog is used to define members of the class. In WinA&D
terminology, a class can have Attribute or Operation members. Behind the scenes,
WinA&D adds a dictionary entry for each class member with a name of the form
Class’Attribute or Class.Operation.

Each class member has a details dialog for defining language specific information for that
class member. WinA&D supports many programming languages for code generation
including PHP. Depending on which language is currently selected, the Attribute or
Operation Details dialog will vary slightly based on specific characteristics of the
selected language. WinA&D can concurrently store language specific details for multiple
languages for each modeling element.

The presentation of a class diagram can vary widely based on user-specified criteria.
Indications of pubic, private or protected access or function parameters can be shown or
hidden from the diagram. WinA&D gives the user a lot of flexibility to control how
classes are presented. Class members can be shown or hidden based on member type or
specific conditions related to the access or modifiers of each class member. Presentation
options can be applied across all diagrams, to specific diagrams or to individual instances
of a class.

Interface Objects

An interface object defines operation members without implementations. An interface
provides a contract that can be implemented by other classes. An interface looks similar
to a class box on the diagram with the addition of the <<interface>> stereotype at the top.

PHP Constants & Variables
Constants and variables of a PHP class are represented as class attributes in WinA&D.
Details of an attribute like its access, description and qualifications (static, constant and
initializer) are entered into the Attribute Details dialog and stored in the dictionary entry
for that attribute.
PHP Constants & Variables

The bottom left corner of a class member detail dialog may have Up and Down arrows
enabled. Click these arrow icons to navigate between items in a class member list
(attributes, operations, etc.) to quickly make editing changes.

PHP Methods, Constructors and Destructors

Methods, constructors and destructors of a PHP class are represented as operations in
WinA&D. Details of an operation like its access, description, arguments and
qualifications (Abstract, Static, Final) are entered into the Operation Details dialog and
stored in the dictionary entry for that operation.




                       PHP Methods, Constructors and Destructors
A PHP constructor is a method that is executed when an object is instantiated from a
class. The constructor name is normally __construct(), but for backwards compatibility
the method can have the same name as the class itself. PHP classes have an implicit
destructor function. Starting with PHP 5.0, an explicit destructor function named
__destruct() can be defined for a class.

Namespaces
The WinA&D modeling tool has a namespace feature that serves several purposes.
Namespaces can partition the models and dictionary information for a large project into
different domains like communication, interface, database or control. Many features can
be driven by namespace like report generation, import/export and naming conventions.
Namespaces are also used to identify the path to code folders that contain the source code
for a project.

For Java code, namespaces are used to represent packages during the design phase of a
project. For the C# language, namespaces represent that language’s namespace construct.

PHP code files are typically stored in one or more code folders. When capturing the
design structure of PHP code, namespaces can automatically be assigned to generate
class and function entries. These namespaces are then used to organize the generated
diagrams and link diagram objects to the associated code files.


Code Generation
PHP code generation in WinA&D uses information from a class model and its associated
dictionary entries. The code generation process is similar to that used for other object-
oriented and procedural languages.

For an object-oriented language, the resulting code includes a declaration for each class,
or interface with empty function frames for each method. Textual descriptions in the
design can be added as class, attribute and method comments in the code.

A checkbox on the customization dialog allows text from the Notes panel of the
Operation Details dialog to be inserted into the generated function frame, thus making it
easy to include programming comments or source code from the design model into the
generated function frames of the PHP code.
Customize Code

The Generate->Code->Customize command presents a dialog to customize the generated
code.




                       Dialog to Customize Generated PHP Code

The Customize dialog provides some control over what gets generated. For example, you
can include a predefined file header at the beginning of each generated code file and
automatically insert fields like the current time stamp, user name, organization, etc.

Generate Class and Interface Code from Class Diagram

WinA&D has two commands for generating code from a class model, the Batch and
Class Unit commands on the Generate->Code submenu.

     The Generate Code button on the tool bar runs the Batch or Class Unit command.

The Class Unit command for a selected class A automatically generates the code file
named A.php and prompts for a folder to store the resulting file. The Batch code
command generates code for one or more selected class or interface objects and prompts
for a file name and location. The customization dialog has options that control how a file
is named, where its stored and whether the user is prompted for a file name or location.

Generate Function Code from Structure Chart

WinA&D can generate a PHP code file that contains selected modules or all modules on
a diagram to a new code file or inserted into an existing code file. The generate code
frames include arguments, descriptions and implementation notes from the design.
Reverse Engineering
WinTranslator is a reverse engineering tool that scans source code and extracts design
information to a text file. That file is imported into empty project files created in
WinA&D where diagrams can be automatically generated. The reengineering process is
fully automated to quickly produce accurate diagrams of unfamiliar code.

WinTranslator can be used to generate class models from object-oriented code, structure
charts from procedural code or data models from SQL. For this discuss, we’ll focus on
the generation of class models and structure charts from PHP code.

    The user clicks the Reengineer Project button to present a step-by-step dialog that
identifies the source language (like PHP), source code folders and other options.
WinTranslator scans the code and outputs a text file of design information.




                             Scan PHP Code to Extract Design
                              Information with WinTranslator

The output from WinTranslator for a PHP project consists of a Dictionary.rp file in each
code folder. A Dictionary.list file in the designated WinTranslator project folder
references those .rp files.

Within WinA&D, use the New Project dialog to create a new project with Dictionary,
Class Model and Structure Model documents and set the language to PHP. Open the
generated project documents.
From the Dictionary window, import the Dictionary.list file generated by WinTranslator.
The project now has a dictionary populated with design information extracted from the
source code. WinA&D has options to color dictionary entries based on type or to
structure entries hierarchically to more easily identify entries for classes, interfaces, class
attribute and operation members and modules (functions).

From the Class window, use the Generate->Class Model->From Dictionary command to
present the Class Model From Dictionary dialog. From this dialog, a class diagram can
be generated for each logically related cluster of classes. For a smaller project, all classes
can be included on one diagram.




                    Generate Class Model from Dictionary Information

WinTranslator also produces a Child List.rp file in each code folder and a combined list
file named Child List.list in the project folder. That file can be imported into the Design
window in WinA&D to generate structure charts.




                           Generate Structure Charts in WinA&D
                           from PHP Code using WinTranslator
WinA&D has the ability to generate a separate Structure Chart for each thread of
execution from the imported child list information. It can also help a developer locate the
topmost root module for each Structure Chart diagram.

The Prompt for Root Module Name checkbox will analyze the depth of the module-
calling tree under each module to identify candidate root modules. Select one or more
modules, and a structure chart will be generated as a separate diagram for each.
Diagrams are automatically leveled so modules with lots of child modules get pushed to a
child diagram. Several threads of execution may reuse the same branch of a program that
is shown on a shared diagram.

Modules on a Structure Chart diagram or class objects on a Class diagram are linked
directly to the associated PHP code. A developer can click through diagrams to see the
program structure and then click directly to the associated function or class code linked to
a diagram object. Code is presented in the integrated Code or Browse window.

Summary
This paper shows how PHP programs can be represented as UML class models and
structure charts. Each thread of execution in a procedural PHP program yields a separate
structure chart stored in one or more documents. Models can be used as a basis for new
code development or generated from existing code to understand its structure.




                                Excel Software
                                     Ph. 505-771-3719
                                 info@excelsoftware.com
                                 www.excelsoftware.com

Recomendados

IOSR Journals por
IOSR JournalsIOSR Journals
IOSR Journalsiosrjournals
158 vistas6 diapositivas
CS554 � Introduction to Rational Rose por
CS554 � Introduction to Rational RoseCS554 � Introduction to Rational Rose
CS554 � Introduction to Rational RoseJignesh Patel
6.9K vistas30 diapositivas
Design patterns por
Design patternsDesign patterns
Design patternsrevamptechnologies
1.1K vistas34 diapositivas
Introduction to Rational Rose por
Introduction to Rational RoseIntroduction to Rational Rose
Introduction to Rational RoseMunaam Munawar
3K vistas26 diapositivas
Uml introduciton por
Uml introducitonUml introduciton
Uml introducitonDr. C.V. Suresh Babu
318 vistas62 diapositivas
Documenting Software Architectural Component and Connector with UML 2 por
Documenting Software Architectural Component and Connector with UML 2Documenting Software Architectural Component and Connector with UML 2
Documenting Software Architectural Component and Connector with UML 2editor1knowledgecuddle
281 vistas6 diapositivas

Más contenido relacionado

La actualidad más candente

C#Portfolio por
C#PortfolioC#Portfolio
C#PortfolioJeriel_Mikell
399 vistas51 diapositivas
3) web development por
3) web development3) web development
3) web developmenttechbed
1.3K vistas91 diapositivas
Software Portfolio - SetFocus por
Software Portfolio - SetFocusSoftware Portfolio - SetFocus
Software Portfolio - SetFocusAlexander Vogel
356 vistas21 diapositivas
Project Portfolio por
Project PortfolioProject Portfolio
Project Portfolioanaraghi
507 vistas34 diapositivas
I18n por
I18nI18n
I18nbinay21
389 vistas7 diapositivas
508checklist por
508checklist508checklist
508checklistDesarae Veit
165 vistas25 diapositivas

La actualidad más candente(19)

3) web development por techbed
3) web development3) web development
3) web development
techbed1.3K vistas
Project Portfolio por anaraghi
Project PortfolioProject Portfolio
Project Portfolio
anaraghi507 vistas
I18n por binay21
I18nI18n
I18n
binay21389 vistas
Online library management system por Yesu Raj
Online library management systemOnline library management system
Online library management system
Yesu Raj226 vistas
4.o o design tools=uml -_lecture 4 por Warui Maina
4.o o design tools=uml -_lecture 44.o o design tools=uml -_lecture 4
4.o o design tools=uml -_lecture 4
Warui Maina1.9K vistas
Arthur Del Prado .Net Portfolio por artsdp
Arthur Del Prado .Net PortfolioArthur Del Prado .Net Portfolio
Arthur Del Prado .Net Portfolio
artsdp490 vistas
Portfolio por jeanux
PortfolioPortfolio
Portfolio
jeanux240 vistas
7) packaging and deployment por techbed
7) packaging and deployment7) packaging and deployment
7) packaging and deployment
techbed5.1K vistas
SugarCRM Power Hour with Jeff Bickart; Module Builder and Studio a developers... por Jeff Bickart
SugarCRM Power Hour with Jeff Bickart; Module Builder and Studio a developers...SugarCRM Power Hour with Jeff Bickart; Module Builder and Studio a developers...
SugarCRM Power Hour with Jeff Bickart; Module Builder and Studio a developers...
Jeff Bickart740 vistas
Jeff Huber Portfoilio por JeffHuber
Jeff Huber PortfoilioJeff Huber Portfoilio
Jeff Huber Portfoilio
JeffHuber462 vistas
.NET Project Manual por cormacsharpe
.NET Project Manual.NET Project Manual
.NET Project Manual
cormacsharpe1.3K vistas
Speech Application Language Tags (SALT) por Vignaraj Gadvi
Speech Application Language Tags (SALT)Speech Application Language Tags (SALT)
Speech Application Language Tags (SALT)
Vignaraj Gadvi1.1K vistas
SMARCOS CNR Paper Mashups por Smarcos Eu
SMARCOS CNR  Paper MashupsSMARCOS CNR  Paper Mashups
SMARCOS CNR Paper Mashups
Smarcos Eu612 vistas
SMARCOS CNR Paper Supporting Transformations across user interface por Smarcos Eu
SMARCOS CNR Paper Supporting Transformations across user interfaceSMARCOS CNR Paper Supporting Transformations across user interface
SMARCOS CNR Paper Supporting Transformations across user interface
Smarcos Eu661 vistas
MS-Excel por babyparul
MS-ExcelMS-Excel
MS-Excel
babyparul1.1K vistas

Similar a Php models

Typescript design patterns applied to sharepoint framework - Sharepoint Satur... por
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
603 vistas31 diapositivas
Software_Engineering_Presentation (1).pptx por
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxArifaMehreen1
35 vistas50 diapositivas
The Domain Of Modeled Software Development And Engineering por
The Domain Of Modeled Software Development And EngineeringThe Domain Of Modeled Software Development And Engineering
The Domain Of Modeled Software Development And EngineeringJennifer Baker
4 vistas80 diapositivas
Modeling Object Oriented Applications by Using Dynamic Information for the I... por
Modeling Object Oriented Applications by Using Dynamic  Information for the I...Modeling Object Oriented Applications by Using Dynamic  Information for the I...
Modeling Object Oriented Applications by Using Dynamic Information for the I...IOSR Journals
177 vistas6 diapositivas
ModLate: An Innovative Model For The Construction Of Web Templates For CMSs por
ModLate: An Innovative Model For The Construction Of Web Templates For CMSsModLate: An Innovative Model For The Construction Of Web Templates For CMSs
ModLate: An Innovative Model For The Construction Of Web Templates For CMSsPiero Quintavalle
193 vistas25 diapositivas
06 fse design por
06 fse design06 fse design
06 fse designMohesh Chandran
838 vistas46 diapositivas

Similar a Php models(20)

Typescript design patterns applied to sharepoint framework - Sharepoint Satur... por Luis Valencia
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia603 vistas
Software_Engineering_Presentation (1).pptx por ArifaMehreen1
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
ArifaMehreen135 vistas
The Domain Of Modeled Software Development And Engineering por Jennifer Baker
The Domain Of Modeled Software Development And EngineeringThe Domain Of Modeled Software Development And Engineering
The Domain Of Modeled Software Development And Engineering
Jennifer Baker4 vistas
Modeling Object Oriented Applications by Using Dynamic Information for the I... por IOSR Journals
Modeling Object Oriented Applications by Using Dynamic  Information for the I...Modeling Object Oriented Applications by Using Dynamic  Information for the I...
Modeling Object Oriented Applications by Using Dynamic Information for the I...
IOSR Journals177 vistas
ModLate: An Innovative Model For The Construction Of Web Templates For CMSs por Piero Quintavalle
ModLate: An Innovative Model For The Construction Of Web Templates For CMSsModLate: An Innovative Model For The Construction Of Web Templates For CMSs
ModLate: An Innovative Model For The Construction Of Web Templates For CMSs
Piero Quintavalle193 vistas
DOOML: A NEW DATABASE & OBJECT-ORIENTED MODELING LANGUAGE FOR DATABASE-DRIVEN... por ijseajournal
DOOML: A NEW DATABASE & OBJECT-ORIENTED MODELING LANGUAGE FOR DATABASE-DRIVEN...DOOML: A NEW DATABASE & OBJECT-ORIENTED MODELING LANGUAGE FOR DATABASE-DRIVEN...
DOOML: A NEW DATABASE & OBJECT-ORIENTED MODELING LANGUAGE FOR DATABASE-DRIVEN...
ijseajournal1 vista
Mvp pattern por Khuong Vo
Mvp patternMvp pattern
Mvp pattern
Khuong Vo550 vistas
Teaching Case Teaching Software Componentization .docx por joyjonna282
  Teaching Case  Teaching Software Componentization  .docx  Teaching Case  Teaching Software Componentization  .docx
Teaching Case Teaching Software Componentization .docx
joyjonna2823 vistas
(Please I nedd coding, UML diagram and FXML files) pls send me these.pdf por agarvalcollections16
(Please I nedd coding, UML diagram and FXML files) pls send me these.pdf(Please I nedd coding, UML diagram and FXML files) pls send me these.pdf
(Please I nedd coding, UML diagram and FXML files) pls send me these.pdf
Phase 2 - Task 1Task TypeDiscussion BoardDeliverable Length.docx por randymartin91030
Phase 2 - Task 1Task TypeDiscussion BoardDeliverable Length.docxPhase 2 - Task 1Task TypeDiscussion BoardDeliverable Length.docx
Phase 2 - Task 1Task TypeDiscussion BoardDeliverable Length.docx
randymartin910303 vistas
Java Programming And Object Oriented Programming por Courtney Bennett
Java Programming And Object Oriented ProgrammingJava Programming And Object Oriented Programming
Java Programming And Object Oriented Programming
Courtney Bennett4 vistas

Último

Why and How CloudStack at weSystems - Stephan Bienek - weSystems por
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
172 vistas13 diapositivas
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... por
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...ShapeBlue
59 vistas13 diapositivas
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue por
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
191 vistas23 diapositivas
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... por
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...ShapeBlue
113 vistas18 diapositivas
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... por
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...ShapeBlue
114 vistas12 diapositivas
Network Source of Truth and Infrastructure as Code revisited por
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisitedNetwork Automation Forum
49 vistas45 diapositivas

Último(20)

Why and How CloudStack at weSystems - Stephan Bienek - weSystems por ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue172 vistas
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... por ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue59 vistas
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue por ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue191 vistas
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... por ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue113 vistas
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... por ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue114 vistas
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... por The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... por ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue52 vistas
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue por ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue63 vistas
Ransomware is Knocking your Door_Final.pdf por Security Bootcamp
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdf
Security Bootcamp81 vistas
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... por Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 vistas
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... por ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue121 vistas
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... por TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc130 vistas
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue por ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue75 vistas
Data Integrity for Banking and Financial Services por Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely76 vistas
Igniting Next Level Productivity with AI-Infused Data Integration Workflows por Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software373 vistas
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... por ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue69 vistas
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... por ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue105 vistas
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT por ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue138 vistas
Digital Personal Data Protection (DPDP) Practical Approach For CISOs por Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash103 vistas

Php models

  • 1. PHP Code Design PHP is a server-side, open-source, HTML-embedded scripting language used to drive many of the world’s most popular web sites. All major web servers support PHP enabling normal HMTL pages to embed code fragments that get interpreted before being served up to requesting users. PHP is often used with MySQL, a popular open-source database engine. PHP is a modern language for web site development with both procedural and object- oriented programming and integrated database support. It often serves as the glue code to connect web pages to a server-side database. An interactive web site is event driven. Each user click, menu selection or keyboard action can initiate a thread of execution that runs many lines of code. Many web projects start as small code snippets gathered from open source sites. As the web site grows to accommodate new data interfaces, web pages and more user features, new developers are added to the team. Without design and documentation tools, the project often becomes unmanageable, unreliable, insecure and costly to expand. This paper shows techniques used to organize and communicate the structure of existing PHP projects and design new enhancements. Software models provide the framework that enables a development team to work together productively and understand, evaluate integrate or implement new source code for a PHP project. • PHP supports procedural programming where each root module calls functions that in turn call other functions creating a thread of execution that can be represented with a hierarchical Structure Chart diagram. • PHP supports object-oriented programming with classes, attributes and functions. The static structure of object-oriented programs can be represented with a Class diagram using the Unified Modeling Language (UML) notation. • The data structure of a relational database can be represented with a Data Model diagram, also called an Entity-Relation diagram. This paper assumes a working knowledge of PHP. It illustrates object-oriented program design with UML class diagrams and procedural program design with structure charts. Tools can automate the process of generating design information from existing code and generating new code from the design.
  • 2. Modeling Basics MacA&D and WinA&D from Excel Software are software-modeling tools enriched with PHP language specific details used to generate source code. MacTranslator and WinTranslator are reverse engineering tools that scan code to extract design information to a text file. That information yields structure charts and class diagrams within the modeling tool. Models can be drawn from a palette of tools. As objects are placed on the diagram, they are given a name and other properties. Each object, be it a module (function), class or database entity has an associated entry in the global data dictionary for the project. Language specific details like a function’s parameter list can be entered for PHP or other programming languages. MacA&D and WinA&D use this information to generate PHP code from the model with a simple button click. PHP programs tend to be event driven by end-user actions like clicking a button on a web page. An HTML form often presents a user interface where the action script runs the root module (function) of some PHP code that calls an inverted hierarchical tree of modules as illustrated below. Server-Side PHP Threads of Execution for a Web Page As web sites grow, they become large software projects with many threads of executions. The structure of each thread can involve a few PHP functions or sometimes hundreds of functions. Programmers can use Structure Chart diagrams to illustrate module hierarchies to understand, communicate, manage and enhance complex web sites.
  • 3. Structure Charts of Procedural Code Each thread of execution is represented with a Structure Chart diagram. At the top of the diagram, the root module is shown as a named box. Each called module is shown as a named box connected with a line and arrowhead pointing to it. Structure Chart for PHP Thread of Execution In the open source commerce project illustrated below, WinTranslator was used to process PHP code. The output files are imported into WinA&D to automatically generate structure charts. WinA&D has a contents view at the left showing the name of each structure chart diagram. The selected diagram is shown at the right. In the screen shots shown below, you can see that the PHP software can draw graphs daily, monthly, yearly, etc. The structure of the daily and monthly thread is almost identical. Each chart calls a module named html_graph with a small box icon in the bottom right corner of the module. This indicates that the module is linked to a child diagram titled html_graph containing a shared branch of code. A developer can double-click that module to see the child diagram. When little human effort, WinTranslator and WinA&D can scan PHP code to automatically document each thread of execution and identify shared branches of code that it places on a separate child diagram.
  • 4. Structure Chart in WinA&D for Daily Graph Thread Structure Chart in WinA&D for Monthly Graph Thread Shared Diagram for HTML Graph
  • 5. Class Model of Object-Oriented Code Procedural programs define data structures and functions that access and manipulate that data. As a program grows in size and complexity, the structural hierarchy of its modules also grows. It becomes increasing difficult to keep track of which functions or threads of execution are manipulating which data. Seemingly small changes can ripple through the software system with unintended affects. An object-oriented program organizes related data and functions into classes. To reduce the ripple effect of program changes, the actual data structures are often hidden from the other classes or functions that access that data through methods. The physical data structure can change while the interface of the access method and its callers are unaffected. Classes are reusable, self-contained, conceptual units of a program’s code and data. PHP supports object-oriented programming with classes, interfaces, attributes, operations, constructors and destructors. A class can inherit another class, then reuse or override its methods. Attribute and operation members of a class can have public, private and protected access to limit accessibility of class members to other parts of the program. The static structure of object-oriented programs can be represented with class diagrams using the Unified Modeling Language (UML) notation. UML defines graphical notations for describing and designing object-oriented software systems. It’s an open standard controlled by the Object Management Group (OMG). Although UML has many diagram types, class models are highlighted here to show static class structure and relationships. UML Class Diagram for Online File Browser
  • 6. A UML class diagram shows each class as a named box. The name of each class attribute member is displayed in one section of the box, with class operation members shown in another section. A class points to the parent class that it inherits. In WinA&D, a class model can be drawn from a palette of tools. As each class instance is placed on the diagram, it’s named in the Class Properties dialog. Each class has a corresponding entry of the same name in the data dictionary where details of that class are stored. Detailed information about a class is stored once, but can be presented on many diagrams. Diagrams within the class model and in other types of diagram documents share data stored in the global dictionary. For a selected class object on the diagram, the Details button presents the Class Attributes & Operations dialog. This dialog is used to define members of the class. In WinA&D terminology, a class can have Attribute or Operation members. Behind the scenes, WinA&D adds a dictionary entry for each class member with a name of the form Class’Attribute or Class.Operation. Each class member has a details dialog for defining language specific information for that class member. WinA&D supports many programming languages for code generation including PHP. Depending on which language is currently selected, the Attribute or Operation Details dialog will vary slightly based on specific characteristics of the selected language. WinA&D can concurrently store language specific details for multiple languages for each modeling element. The presentation of a class diagram can vary widely based on user-specified criteria. Indications of pubic, private or protected access or function parameters can be shown or hidden from the diagram. WinA&D gives the user a lot of flexibility to control how classes are presented. Class members can be shown or hidden based on member type or specific conditions related to the access or modifiers of each class member. Presentation options can be applied across all diagrams, to specific diagrams or to individual instances of a class. Interface Objects An interface object defines operation members without implementations. An interface provides a contract that can be implemented by other classes. An interface looks similar to a class box on the diagram with the addition of the <<interface>> stereotype at the top. PHP Constants & Variables Constants and variables of a PHP class are represented as class attributes in WinA&D. Details of an attribute like its access, description and qualifications (static, constant and initializer) are entered into the Attribute Details dialog and stored in the dictionary entry for that attribute.
  • 7. PHP Constants & Variables The bottom left corner of a class member detail dialog may have Up and Down arrows enabled. Click these arrow icons to navigate between items in a class member list (attributes, operations, etc.) to quickly make editing changes. PHP Methods, Constructors and Destructors Methods, constructors and destructors of a PHP class are represented as operations in WinA&D. Details of an operation like its access, description, arguments and qualifications (Abstract, Static, Final) are entered into the Operation Details dialog and stored in the dictionary entry for that operation. PHP Methods, Constructors and Destructors
  • 8. A PHP constructor is a method that is executed when an object is instantiated from a class. The constructor name is normally __construct(), but for backwards compatibility the method can have the same name as the class itself. PHP classes have an implicit destructor function. Starting with PHP 5.0, an explicit destructor function named __destruct() can be defined for a class. Namespaces The WinA&D modeling tool has a namespace feature that serves several purposes. Namespaces can partition the models and dictionary information for a large project into different domains like communication, interface, database or control. Many features can be driven by namespace like report generation, import/export and naming conventions. Namespaces are also used to identify the path to code folders that contain the source code for a project. For Java code, namespaces are used to represent packages during the design phase of a project. For the C# language, namespaces represent that language’s namespace construct. PHP code files are typically stored in one or more code folders. When capturing the design structure of PHP code, namespaces can automatically be assigned to generate class and function entries. These namespaces are then used to organize the generated diagrams and link diagram objects to the associated code files. Code Generation PHP code generation in WinA&D uses information from a class model and its associated dictionary entries. The code generation process is similar to that used for other object- oriented and procedural languages. For an object-oriented language, the resulting code includes a declaration for each class, or interface with empty function frames for each method. Textual descriptions in the design can be added as class, attribute and method comments in the code. A checkbox on the customization dialog allows text from the Notes panel of the Operation Details dialog to be inserted into the generated function frame, thus making it easy to include programming comments or source code from the design model into the generated function frames of the PHP code.
  • 9. Customize Code The Generate->Code->Customize command presents a dialog to customize the generated code. Dialog to Customize Generated PHP Code The Customize dialog provides some control over what gets generated. For example, you can include a predefined file header at the beginning of each generated code file and automatically insert fields like the current time stamp, user name, organization, etc. Generate Class and Interface Code from Class Diagram WinA&D has two commands for generating code from a class model, the Batch and Class Unit commands on the Generate->Code submenu. The Generate Code button on the tool bar runs the Batch or Class Unit command. The Class Unit command for a selected class A automatically generates the code file named A.php and prompts for a folder to store the resulting file. The Batch code command generates code for one or more selected class or interface objects and prompts for a file name and location. The customization dialog has options that control how a file is named, where its stored and whether the user is prompted for a file name or location. Generate Function Code from Structure Chart WinA&D can generate a PHP code file that contains selected modules or all modules on a diagram to a new code file or inserted into an existing code file. The generate code frames include arguments, descriptions and implementation notes from the design.
  • 10. Reverse Engineering WinTranslator is a reverse engineering tool that scans source code and extracts design information to a text file. That file is imported into empty project files created in WinA&D where diagrams can be automatically generated. The reengineering process is fully automated to quickly produce accurate diagrams of unfamiliar code. WinTranslator can be used to generate class models from object-oriented code, structure charts from procedural code or data models from SQL. For this discuss, we’ll focus on the generation of class models and structure charts from PHP code. The user clicks the Reengineer Project button to present a step-by-step dialog that identifies the source language (like PHP), source code folders and other options. WinTranslator scans the code and outputs a text file of design information. Scan PHP Code to Extract Design Information with WinTranslator The output from WinTranslator for a PHP project consists of a Dictionary.rp file in each code folder. A Dictionary.list file in the designated WinTranslator project folder references those .rp files. Within WinA&D, use the New Project dialog to create a new project with Dictionary, Class Model and Structure Model documents and set the language to PHP. Open the generated project documents.
  • 11. From the Dictionary window, import the Dictionary.list file generated by WinTranslator. The project now has a dictionary populated with design information extracted from the source code. WinA&D has options to color dictionary entries based on type or to structure entries hierarchically to more easily identify entries for classes, interfaces, class attribute and operation members and modules (functions). From the Class window, use the Generate->Class Model->From Dictionary command to present the Class Model From Dictionary dialog. From this dialog, a class diagram can be generated for each logically related cluster of classes. For a smaller project, all classes can be included on one diagram. Generate Class Model from Dictionary Information WinTranslator also produces a Child List.rp file in each code folder and a combined list file named Child List.list in the project folder. That file can be imported into the Design window in WinA&D to generate structure charts. Generate Structure Charts in WinA&D from PHP Code using WinTranslator
  • 12. WinA&D has the ability to generate a separate Structure Chart for each thread of execution from the imported child list information. It can also help a developer locate the topmost root module for each Structure Chart diagram. The Prompt for Root Module Name checkbox will analyze the depth of the module- calling tree under each module to identify candidate root modules. Select one or more modules, and a structure chart will be generated as a separate diagram for each. Diagrams are automatically leveled so modules with lots of child modules get pushed to a child diagram. Several threads of execution may reuse the same branch of a program that is shown on a shared diagram. Modules on a Structure Chart diagram or class objects on a Class diagram are linked directly to the associated PHP code. A developer can click through diagrams to see the program structure and then click directly to the associated function or class code linked to a diagram object. Code is presented in the integrated Code or Browse window. Summary This paper shows how PHP programs can be represented as UML class models and structure charts. Each thread of execution in a procedural PHP program yields a separate structure chart stored in one or more documents. Models can be used as a basis for new code development or generated from existing code to understand its structure. Excel Software Ph. 505-771-3719 info@excelsoftware.com www.excelsoftware.com