+ All Categories
Home > Software > InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Date post: 16-Jul-2015
Category:
Upload: mhelmich
View: 579 times
Download: 0 times
Share this document with a friend
57
CC BY-SA, James Hammond https://www.flickr.com/photos/jameshammond/8732132809 Bringing TYPO3 Legacy Applications into the Flow Martin Helmich [email protected] @martin-helmich Inspiring Conference 2015, Kolbermoor March 28th, 2015
Transcript
Page 1: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY-SA, James Hammond https://www.flickr.com/photos/jameshammond/8732132809

Bringing TYPO3 Legacy Applications into the Flow

Martin Helmich [email protected] @martin-helmich

Inspiring Conference 2015, Kolbermoor March 28th, 2015

Page 2: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Martin Helmich Software Architect at Mittwald

@martin-helmich @mittwald

CC BY-SA, Wolfgang Wagner https://www.flickr.com/photos/wolfgang-wagner/16958684785

Page 3: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Legacy Applications

Page 4: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY-SA, Photones http://commons.wikimedia.org/wiki/File:Heureka_(Plastik).jpg

Page 5: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY-SA, Gerwin Sturm https://www.flickr.com/photos/scarygami/5518831238

Page 6: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
Page 7: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY, Dude of Lego https://www.flickr.com/photos/dudeoflego/5105352800

Page 8: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Option #1

Rewrite From Scratch

Page 9: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY-SA, D464-Darren Hall http://commons.wikimedia.org/wiki/File:Demolition_in_Ballymun_-_Flickr_-_D464-Darren_Hall.jpg

Page 10: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Option #2

Migrate Existing Code

Page 11: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY-SA, Wolfe House & Building Movers http://en.wikipedia.org/wiki/File:Hydrolic_dollies_relocate_house_in_Newark,_Delaware.jpg

Page 12: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 FLOW

TYPO3 NEOS

?

TYPO3 CMS

Page 13: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 FLOW

TYPO3 NEOS

?

TYPO3 CMS

TYPO3 Extbase

Page 14: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Extbase

pibase

3rd party Frameworks

TYPO3 FLOW

TYPO3 CMS

Page 15: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Extbase

pibase

3rd party Frameworks

TYPO3 FLOW

TYPO3 CMS

Page 16: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Extbase

pibase

3rd party Frameworks

TYPO3 FLOW

TYPO3 CMS

Page 17: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Extbase

pibase

3rd party Frameworks

TYPO3 FLOW

TYPO3 CMS

Page 18: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

When

NOT to migrate from CMS

to Flow

Page 19: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Public Domain (both) http://pixabay.com/de/roter-apfel-apple-lecker-di%C3%A4t-83085/ and http://commons.wikimedia.org/wiki/File:Citrus_reticulata.jpg

Page 20: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

namespace  My\Ext\Domain\Model;  use  TYPO3\Flow\Annotations  as  Flow;  use  Doctrine\ORM\Mapping  as  ORM;  

/**    *  @Flow\Entity    */  class  Car  {  

   /**        *  @var  string        *  @Flow\Validate('NotEmpty')        */      protected  $licenseNumber;  

   /**        *  @var  Manufacturer        *  @ORM\ManyToOne        */      protected  $manufacturer;  }

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

TYPO3 CMS (Extbase)

TYPO3 Flow

Page 21: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

namespace  My\Ext\Domain\Model;  use  TYPO3\Flow\Annotations  as  Flow;  use  Doctrine\ORM\Mapping  as  ORM;  

/**    *  @Flow\Entity    */  class  Car  {  

   /**        *  @var  string        *  @Flow\Validate('NotEmpty')        */      protected  $licenseNumber;  

   /**        *  @var  Manufacturer        *  @ORM\ManyToOne        */      protected  $manufacturer;  }

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

TYPO3 CMS (Extbase)

TYPO3 Flow

Page 22: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

namespace  My\Ext\Domain\Model;  use  TYPO3\Flow\Annotations  as  Flow;  use  Doctrine\ORM\Mapping  as  ORM;  

/**    *  @Flow\Entity    */  class  Car  {  

   /**        *  @var  string        *  @Flow\Validate('NotEmpty')        */      protected  $licenseNumber;  

   /**        *  @var  Manufacturer        *  @ORM\ManyToOne        */      protected  $manufacturer;  }

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

TYPO3 CMS (Extbase)

TYPO3 Flow

Page 23: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

namespace  My\Ext\Domain\Model;  use  TYPO3\Flow\Annotations  as  Flow;  use  Doctrine\ORM\Mapping  as  ORM;  

/**    *  @Flow\Entity    */  class  Car  {  

   /**        *  @var  string        *  @Flow\Validate('NotEmpty')        */      protected  $licenseNumber;  

   /**        *  @var  Manufacturer        *  @ORM\ManyToOne        */      protected  $manufacturer;  }

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

TYPO3 CMS (Extbase)

TYPO3 Flow

Page 24: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS

Manual Migration

TYPO3 Flow

Page 25: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS

Manual Migration

TYPO3 Flow

Largely unusable

Page 26: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS TYPO3 Flow

Double maintenance

Page 27: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS TYPO3 Flow

Page 28: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS TYPO3 Flow

Dependencies between packages

Page 29: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY, Mirko-Tobias Schäfer https://www.flickr.com/photos/gastev/2174504149

Automation

Page 30: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

https://github.com/mittwald/flow-metamorph

Page 31: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

composer require mittwald-typo3/flow-metamorph composer require mittwald-typo3/flow-metamorph-pibase

Installation

Page 32: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

Page 33: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

Parser

Page 34: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

Parser

Abstract Syntax Tree

Page 35: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

Source Code

Page 36: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

class

name=Tx_..._Car abstract=false final=false

extends

name=Tx_..._AbstractEntity

stmts

property

name=licenseNumber docComment="/**\n..."

property

name=manufacturer docComment="/**\n..."

Source Code Syntax Tree

Page 37: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

Parser

Abstract Syntax Tree

Page 38: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

ParserTransformation

Rules

Trans- former

Abstract Syntax Tree

Page 39: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

ParserTransformation

Rules

Trans- former

Printer

<?php  namespace  Foo;  class  FooTastic  {      /**  @Flow\Inject  */      protected  $greeter;      public  function  hello($who)  {          $this-­‐>greeter-­‐>greet($who);      }

hello_improved.php

output Source File(s)

Abstract Syntax Tree

Page 40: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

<?php  

class  FooTastic  {      public  function  hello($who)  {          echo  "Hello  $who!";      }  }  

hello.php

Input Source

File

Parser

class  FooTastic:      def  hello(who):          print  "Hello  %s"\                                  %  who  

hello.py

Transformation Rules

Trans- former

Printer

<?php  namespace  Foo;  class  FooTastic  {      /**  @Flow\Inject  */      protected  $greeter;      public  function  hello($who)  {          $this-­‐>greeter-­‐>greet($who);      }

hello_improved.php

output Source File(s)

Abstract Syntax Tree

Page 41: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

namespace  My\Ext\Domain\Model;  use  TYPO3\Flow\Annotations  as  Flow;  use  Doctrine\ORM\Mapping  as  ORM;  

/**    *  @Flow\Entity    */  class  Car  {  

   /**        *  @var  string        *  @Flow\Validate('NotEmpty')        */      protected  $licenseNumber;  

   /**        *  @var  Manufacturer        *  @ORM\ManyToOne        */      protected  $manufacturer;  }

class  Tx_MyExt_Domain_Model_Car  extends        Tx_Extbase_DomainObject_AbstractEntity  {  

   /**        *  @var  string        *  @validate  notempty        */      protected  $licenseNumber;  

   /**        *  @var  Tx_MyExt_Domain_Model_Manufacturer        */      protected  $manufacturer;  }

TYPO3 CMS (Extbase)

TYPO3 Flow

Page 42: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

namespace

name=Mw\MyExt\Domain\Model

uses

use

name=Mw\...\AbstractVehicle alias=AbstractVehicle

stmts

class

name=Car abstract=false final=false

extends

name=AbstractVehicle

stmts

BEFORE

AFTER

„Rename Tx_MyExt_Domain_Model_Car

to Mw\MyExt\Domain\Model\Car“

class

name=Tx_..._Car abstract=false final=false

extends

name=Tx_..._AbstractVehicle

stmts

property name=licenseNumber docComment="/**\n..."

property name=manufacturer docComment="/**\n..."

Page 43: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
Page 44: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow
Page 45: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS TYPO3 Flow

Compatibility

Automated Migration

Page 46: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 CMS

Old Code, but Feature Complete

TYPO3 Flow

Compatibility

Automated Migration

Page 47: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 Flow

Compatibility

TYPO3 CMS

Rewrite iteratively

Page 48: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 Flow

Compatibility

TYPO3 CMS

Rewrite iteratively New

features

Page 49: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Compatibility

TYPO3 CMS

Rewrite iteratively

Decomission the old Application

TYPO3 Flow

Page 50: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

TYPO3 Flow

Compatibility

TYPO3 CMS

Rewrite iteratively

Migrate continuouslyContinue to maintain

old Application

Page 51: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Automated Code Transformation Merge

Manual correction

Page 52: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Open Problems

Proof of correctness

„How do I know that the auto-generated code is

correct?“

Page 53: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Open Problems

Ease of Extensibility

„I want to migrate from Zend to Flow, but writing new

transformation rules is just too complex!“

Page 54: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Open Problems

Efficiency

„Wouldn’t it be easier to just migrate all my code by hand?“

Page 55: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

CC BY-SA, Max Mustermann http://mustermann.de

Page 56: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

http://slideshare.net/mhelmich/migrating-from-typo3-cms-to-typo3-flow

https://speakerdeck.com/kdambekalns/migrating-from-typo3-cms-to-typo3-neos

Resources

Page 57: InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

Thank you

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

[email protected] @martin-helmich https://github.com/martin-helmich https://github.com/mittwald/flow-metamorph


Recommended