Yves & Zed @ Developer Conference 2013

Preview:

DESCRIPTION

Yves & Zed is the e-commerce platform of Project A Ventures.

Citation preview

Introduction

Who?

Fabian Wesner$year >= 2012 CTO @ Project A Ventures

$year == 2011 CTO @ Rocket Internet$year == 2010 Lead developer @ Zalando

$year <= 2009 Entrepreneur and Freelancer

Project A VenturesBuilding successful companies.

Company Builder with focus on Internet, advertising technology and mobile.

www.project-a.com

Powered by Yves & Zed

Architecture

Bird‘s eye view

Layered architecture

Structured code with Bundles and Packages

Dependency management with composer

- Code is structured in packages

- Packages may require each other

- We use composer to manage dependencies

How to update Yves & Zed?(1) add a new version to a composer.json(2) run php composer.phar install

composer.json of dwh-package

{    "name": "project-a/dwh-package",    "autoload": {        "psr-0": { "ProjectA": "/src" }    },    "require": {        "php": ">=5.4.0",        "project-a/auth-package": ">=0.0.10",        "project-a/library-package": ">=0.0.27"    }}

Dependency validation

Zed GUI

Zed user interface

Kendo UI + Bootstrap + jQueryminified and merged with Grunt

Cronjobs

Scalable job management with Jenkins

deployment

/* subscribe users for newsletters */ $jobs[] = array( 'name' => 'send_newsletter_subscription_queue', 'command' => '$PHP_BIN $CLI_PATH/ index.php --module=newsletter --controller=cronjob --action=sendsubscriptionqueue', 'schedule' => '*/2 * * * *', 'enable' => true, 'stores' => $all_stores, );

/* -- MAIL QUEUE -- */ $jobs[] = array( 'name' => 'send_queued_mails', 'command' => '$PHP_BIN $CLI_PATH/ index.php --module=mail -- controller=cronjob --action=send-queued-mails', 'schedule' => '* * * * *', 'enable' => true, 'stores' => $all_stores, );

/* -- DUMP DB -- */ $jobs[] = array( 'name' => 'generate_database_dump', 'command' => '$PHP_BIN $CLI_PATH/ index.php --module=dbdump --controller=cronjob --action=execute', 'schedule' => '0 0 * * *', 'enable' => true,

Logging

Logging with Lumberjack

Yves & Zed‘s Big Data infrastructure

Automated processing of orders

Visualization of business logic

Graph

protected function addTransitions(){ $this->setup->addTransition( self::STATE_NEW, self::STATE_PREAUTHORIZED, self::EVENT_START_PAYMENT, self::RULE_PAYMENT_TRANSACTION_APPROVED); $this->setup->addTransition( self::STATE_NEW, self::STATE_INVALID, self::EVENT_START_PAYMENT);}

protected function addCommands(){ $preAuthorizeCommand = $this->factory ->getModelOrderprocessCommandPaymentPreAuthorization(); $this->setup->addCommand( self::STATE_NEW, self::EVENT_START_PAYMENT, $preAuthorizeCommand);}

protected function addDefinitions(){ $subProcess = $this->factory ->getModelOrderprocessDefinitionSubProcessCancellation()

$this->setup->addDefinition($subProcess);}

PHP

Automatic processing of thousands of orders per day

Trigger eventsUsed in several controllers to start the state machine

$this->facadeSales->triggerEvent(„start payment“,items);

$this->facadeSales->triggerEventBulk($eventName,items);

Check conditionsDecision which way to go

Commands Classes with logic which are triggered from the state machine

+++ More details: Talk of Oliver Tischlinger tomorrow „Statemachine – Das Mittel gegen Flags!“ +++

class \Sao\Zed\Payment\Component\Condition\TransactionApproved{ /** @return bool */ public function check($orderItem, $context) { ... }}

class \Sao\Zed\Payment\Component\Command\PreAuthorization{ public function __invoke ($orderEntity, $context) { ... }}

Data-Warehouse

ETL / job scheduler

<job id="load-order-item-status"> <description>Copies the order item status table into the tmp table </description> <commands> <run-sql-file file-name="order-statuses/create-order-item-status-tmp-table.sql" echo-queries="false"/> <load-from-mysql mysql-database="zed" file-name="order-statuses/load-order-item-status.sql" target-table="tmp.order_item_status"/> </commands></job>

<job id="transform-order-item-status"> <description>Copies the order item status table into the dim schema </description> <dependencies> <dependency job="load-order-item-status"/> <dependency job="load-order-item-status-mapping"/> </dependencies> <commands> <run-sql-file file-name="order-statuses/transform-order-item-status.sql" echo-queries="false"/> </commands></job>

Order status mappingEvery color has a simple meaning!

Not paidItem returned

Paidetc.

<perspective name="Sales">

<status-group name="Not paid" description="The items are not yet paid" color="#557799"> <status ref="shipped"/> <status ref="waiting for payment"/> <status ref="capture"/> </status-group>

<status-group name="Paid" description="The items are paid" color="#559955"> <status ref="paid in money collect"/> <status ref="clarify refund overpayment"/> <status ref="closed"/> </status-group> </perspective> </status-mapping>

Entity–relationship model

DWH architecture

ETL DWH Cubes Reports

Thank you!