200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf;...

24
PHP meets UML Marcus Börger LinuxTag 2004

Upload: others

Post on 06-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

PHP meets UML

Marcus Börger

LinuxTag 2004

Page 2: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 2

Overview

PHP 5 vs. PHP 4

PHP 5 OO

PHP and UML

Page 3: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 3

PHP 4 and OO ?

Poor Object modelMethods

No visibilityNo abstracts, No finalStatic without declaration

PropertiesNo default valuesNo static properties

InheritanceNo abstract, final inheritance, no interfaces

Object handlingCopied by valueNo destructors

Page 4: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 4

PHP 5's revamped OO Model

PHP 5 has really good OO

Better code reuse

Better for team development

Easier to refactor

Some patterns lead to much more efficient code

Fits better in marketing scenarios

Page 5: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 5

Completely new XML support

PHP 4's XML was patheticSAX was OKDOM was crappy, DOM was fakeThere was nothing else

PHP 5's XML is brilliantSAX is OKDOM is functionalSimpleXML is the solution to all your problemsNative SOAP support

Page 6: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 6

Reflection API

Can reflect nearly all aspects of your PHP codeFunctionsClasses, Methods, PropertiesExtensions

<?phpclass Foo {

public $prop;function Func($name) {

echo "Hello $name";}

}ReflectionClass::export('Foo');ReflectionObject::export(new Foo);ReflectionMethod::export('Foo', 'Func');ReflectionProperty::export('Foo', 'prop');ReflectionExtension::export('standard');?>

Page 7: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 7

Reflection API

Can be used to generate XMI

Can be used to reverse engineer PHP

Page 8: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 8

Unified Database API

PHP 5.1 will come with PDO

Unified object oriented API

Support for MSSql, MySQL, Oracle, Postgres, ...

Support for transactions

Support for LOBs

Support for iterators

Page 9: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 9

Why UML

Improve CommunicationWith customerWith managementBetween developers

Visualize ConceptsImprove documentationModel verification

Mistakes during design are cheapMistakes during implementation are expensive

Automatic code generation

Page 10: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 10

PHP and UML

Support for OO syntax/semantic

Support through open source toolsDoxygenUmbrelloArgoUML

Support through commercial/proprietary toolsPoseidonWaterproof UMLBITPlan smartGENERATORSybase PowerDesigner

Page 11: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 11

Doxygen

Doxygen is a documentation system Code comments to documentationCreates UML like graphs automaticallyGenerates html, chm, TEX, PostScript, PDF, man pagesRuns on Linux/Windows

Page 12: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 12

Umbrello

Most of UML 1 diagram typesCode generation for

C++, Java, PHP, Perl, Python, SQL, ADA, AS, JavaScript, IDL, XML Schema

Export to PNG and XMIRuns on Linux/KDEManual in English and German

Page 13: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 13

ArgoUML

Runs on any platform with Java 1.3+ Exports GIF, PS, EPS, PGML and SVGXMI Support OCL SupportCode generation

C++Java PHP

Support throughcommercial versionPoseidon

Page 14: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 14

BITPlan smartGENERATOR

Code generation from XMI

This allows to use all XMI compliant UML toolsRational Rose Poseidon GentlewaremicroTOOL objectivFTogether Soft Together/J oder C++ Object Domain from Object Domain Systems JDBC-Quellen and other Repositories

At the moment only a prototype

Page 15: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 15

Sybase PowerDesignerComplete UML 1.3 supportProcess Execution

Service Oriented Architecture supportebXML, BPEL4WS

Data ModelingConceptual, Logical, Physical and Warehouse DataRoundtrip engineering for databases

Enterprise ModelingModel Driven ArchitectureObject/Relational, XML to Database and Warehouse Source mapping TechniquesRoundtrip engineering for C#, C++, Java, VBA, XML, ...

Documentation generation Highly Extensible and Customizable

Page 16: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 16

Sybase PowerDesigner

Working with class diagrams

Page 17: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 17

Sybase PowerDesigner

Teaching PHP

Page 18: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 18

Sybase PowerDesigner

Teaching PHP

Page 19: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 19

Sybase PowerDesigner

Teaching PHP

Page 20: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 20

Sybase PowerDesigner

Generating PHP scripts from UML

Page 21: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 21

Sybase PowerDesigner

Generating PHP code for constants

Page 22: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 22

What to do nextAutomatically generate data query classes

Extending PHP’s reflection API to write XMI

Typehints for properties and return values

Implement roundtrip engineering

Implement a script packaging extension

Extend PHP with the keyword ‘package’

Page 23: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 23

What else?

Using PHP to script UML tools

Generate PHP code from Activity Diagrams

Validating generated PHP code

Page 24: 200406 linuxtag php meets uml - somabo.desomabo.de/talks/talks/200406_linuxtag_php_meets_uml.pdf; Extending PHP’s reflection API to write XMI; Typehints for properties and return

Marcus Börger PHP meets UML 24

LinksThis slides

http://somabo.de/talksPHP

http://php.netDoxygen

http://doxygen.orgArgoUML

http://argouml.tigris.orgPoseidon

http://www.gentleware.comUmbrello

http://uml.sourceforge.netWaterproof

http://www.waterproof-software.com/uml/PowerDesigner

http://www.sybase.com/products/enterprisemodeling