code.talks commerce 19/20.04.2016
2016 Spryker Systems GmbH / code.talks commerce 2016 2
About me
2
Fabian Wesner CTO Spryker Systems Twi-er hAps://twiAer.com/FabianWesner Spryker Techblog hAps://tech.spryker.com This presentaHon is available on Slideshare: hAp://de.slideshare.net/FabianWesner
2016 Spryker Systems GmbH / code.talks commerce 2016 3
MoHvaHon Why do we need an (e)commerce framework?
Shop system usage
2016 Spryker Systems GmbH / code.talks commerce 2016 4
StaHsta
askhivemind
Although there are lots of shop systems, many merchants decide to build their own? Why?
Standard Shop-‐soQware
2016 Spryker Systems GmbH / code.talks commerce 2016 5
Standard shop soQware offer many features that can be configured and some hooks for extensions.
è Enough for the long tail of merchants.
But …
Framework vs Shop-‐soQware
2016 Spryker Systems GmbH / code.talks commerce 2016 6
Standardized shop soQware offer many features that can be configured and some hooks for extensions.
è Enough for the long tail of merchants.
But that doesn’t fit for ambi1ous projects! If your business model is not standardized, a standard shop so=ware does not help you!
The framework approach
2016 Spryker Systems GmbH / code.talks commerce 2016 7
Instead an out-‐of-‐the-‐box shop soQware ambiHous projects need a framework, that op8mizes the developers’ produc8vity.
How?
Increased developer’s producHvity
2016 Spryker Systems GmbH / code.talks commerce 2016 8
✔ Clean and SOLID code ✔ Consistent soQware design ✔ Strict modularizaHon
✔ Generic set of features (like state machines)
✔ High performance and scalability
✔ DeterminisHc behavior
✔ Tested and measured code
✔ Avoidance of bad pracHces Like full page cache, EAV, event-‐dispatcher, AOP, code configuraHon in database, dependency-‐container magic, …
2016 Spryker Systems GmbH / code.talks commerce 2016 9
IntroducHon
Spryker Bird’s eye view
2016 Spryker Systems GmbH / code.talks commerce 2016 10
Performance & Scalability
2016 Spryker Systems GmbH / code.talks commerce 2016 11
Lightweight shop frontend Yves executes in 30 -‐ 100ms • No full page cache needed!
• Redis and ElasHcsearch are easily scalable • No direct access to SQL database from frontend (to avoid the boAleneck)
Code principles and quality
2016 Spryker Systems GmbH / code.talks commerce 2016 12
Spryker follows the SOLID-‐ and Packaging-‐Principles.
Spryker implements Clean Code!
Project boilerplate
Core -‐ Bundles
2016 Spryker Systems GmbH / code.talks commerce 2016 13
SoQware design
First sketch
2016 Spryker Systems GmbH / code.talks commerce 2016 14
Architectural thinking
2016 Spryker Systems GmbH / code.talks commerce 2016 15
Single applica8on approach • Runs on every laptop
• “Just a PHP applicaHon”
• Quick and simple deployment
Service approach • High producHvity with large teams with big
projects
• Update, replace or extend parts of the applicaHon
Architectural thinking
2016 Spryker Systems GmbH / code.talks commerce 2016 16
Single applica8on approach • Runs on every laptop
• “Just a PHP applicaHon”
• Quick and simple deployment
Service approach • High producHvity with large teams with big
projects
• Update, replace or extend parts of the applicaHon
Not required/wanted: • Technology zoo
• Overhead of distribuHon and asynchronous communicaHon
• MulHple database without transacHons and consistency
Monolith?
2016 Spryker Systems GmbH / code.talks commerce 2016 17
Modular ApplicaHon
2016 Spryker Systems GmbH / code.talks commerce 2016 18
Bundles which have a single responsibility with well-‐defined relaHonships.
Each bundle consists of (up to) 4 layers
2016 Spryker Systems GmbH / code.talks commerce 2016 19
ApplicaHons, bundles and layers
2016 Spryker Systems GmbH / code.talks commerce 2016 20
Each bundle has an internal API (~ Facade)
2016 Spryker Systems GmbH / code.talks commerce 2016 21
Bundle to Bundle communicaHon
2016 Spryker Systems GmbH / code.talks commerce 2016 22
Strict modularizaHon
2016 Spryker Systems GmbH / code.talks commerce 2016 23
A bundle is a “funcHonal unit”.
Bundles are loose coupled, coherent and have explicit dependencies.
They follow the packaging principles!
Currently there are > 100 bundles.
Main benefit: Code keeps well-‐structured even in big projects with large development teams.
Atomic Releases
2016 Spryker Systems GmbH / code.talks commerce 2016 24
Each bundle has it’s own (semanHc) version number and own (split) repository.
We know: Migra8on to a new version can be painful! That’s why: all releases only affect one or some bundles (Isolated changes).
Spryker offers a con8nuous delivery of Atomic Releases.
2016 Spryker Systems GmbH / code.talks commerce 2016 25
Programming with Spryker
Dependency injecHon with factories
2016 Spryker Systems GmbH / code.talks commerce 2016 26
+ Explicit injecHon without background magic. IDE-‐friendly + Separated factories per bundle/layer. No big DI-‐container.
Extension with plugins
2016 Spryker Systems GmbH / code.talks commerce 2016 27
Project extension via object composiHon
2016 Spryker Systems GmbH / code.talks commerce 2016 28
+ You can extend every class by composiHon (recommended) or inheritance.
Transfer objects
2016 Spryker Systems GmbH / code.talks commerce 2016 29
+ Internal data transfer with objects, not anonymous arrays. + Clear separaHon of data and logic
Usage
Defi
niHo
n
State machines
2016 Spryker Systems GmbH / code.talks commerce 2016 30
Visual programming with state machines • Graph in XML • Commands and
CondiHons in PHP
Perfect use case Automated processing of orders. Avoid bulky ERP as much as possible.
2016 Spryker Systems GmbH / code.talks commerce 2016 31
Run Spryker – Now Installa8on guide: hAp://start.spryker.com InstallaHon with Vagrant VM
takes 20-‐30 minutes
All Github repositories are public: hAps://github.com/spryker
More Spryker links
2016 Spryker Systems GmbH / code.talks commerce 2016 32
Documenta8on – Spryker has comprehensive documentaHon hAp://spryker.github.io Forum – Ask any quesHon to the Spryker team
hAp://discuss.spryker.com
Techblog – Get deep insights from the core team
hAps://tech.spryker.com
Scru8nizer (Yves) – Check the code quality metrics hAps://scruHnizer-‐ci.com/g/spryker/demoshop
2016 Spryker Systems GmbH / code.talks commerce 2016 33
A proven technology built in real-‐world projects for ambiHous and non-‐standard business models.
Spryker Systems GmbH Julie-‐WolQhorn-‐Strasse 1
10115 Berlin Germany
[email protected] Phone: +49 40 328 929 631
Fax: +49 40 328 929 699
www.spryker.com tech.spryker.com
github.com/spryker
34 2016 Spryker Systems GmbH / code.talks commerce 2016
Recommended