Skip to content

Instantly share code, notes, and snippets.

@drola
Last active June 1, 2016 20:35
Show Gist options
  • Save drola/be8b82675670d667765ea31399e157ef to your computer and use it in GitHub Desktop.
Save drola/be8b82675670d667765ea31399e157ef to your computer and use it in GitHub Desktop.

CI

Continuously merging developer branches into a common one.

Continuous delivery

Any code commit may be released to customers at any moment. Works well with Scrum project managements. At the end of sprint code goes into production.

Continuous deployment

Every successfull build is pushed into production, immediately. Implements Kabnan flow management. Cont. deployment makes releases faster than only with cont. delivery

Exception: Development of a library:

  • workaround by triggering new build of application with new version of library
  • put that library into production

Daily workflow

Branching models:

  • Git Flow master branch = state in production devel branch = working state of app

devel branch -> feature branch -> merge feature into develop branch before release: develop branch -> release branch -> close and merge into master and develop -> TAG on master. Hotfix branches: master->hotfix->merge into master

  • Workflow with pull requests doesn't have develop branch

git-flow has problems...

Semantic versioning

major.minor.patch

Build goals:

  • prepare the app for use in production

Dependencies

System dependencies:

Code dependencies:

  • conf files: should be created during deployment
  • third party libraries: composer.phat: extensions, php version, library dependencies
  • composer hooks are not good for doing stuff
  • Other better build tools: Phing (Ant for PHP). Organize sequences of tasks in form of targets.

Database migrations

Versioning of schema. Up and down.

Unit testing

PHPUnit, phpspec, Atoum

Acceptance testing

Entire use cases / scenarios. We can use external resources (db, etc). We only know input and output -> blackbox test

Very good choice for legacy apps.

Behat

Codeception: tests written in php; based on phpunit

Testing pyramid:

    /GUI tests
  / Acceptance tests
/ Unit tests

Deployment

git+ftp+rsync = russian roulette

Tools

Amazon CodeDeploy

  • Free on AWS, can be installed on self hosted servers, cheap
  • support transitional deployment, rollback, deploy on boot

Zend Deployment

  • Included in Zend Server
  • Support rollback
  • Support transitional deployment
  • Hook support

Composer, Phing for build definitions,

Strategy vs. state pattern

Strategy: all strategies achieve something similar as result State: result can be different

Strategy: caller is in control of flow State: has more control, defined behaviour

Example: payment process is a sequence of state transitions

boomerang: library to measure performance during browsing

  • Perceived performance:

    • time from initiating action to completion
    • bounce, conversion rate -> indicates whether experience was good or bad
  • Learn statics

    • inter quartile range IQR=Q3-Q1 also known as the middle 50

Configuration management

parameters.yml thingy... http://converter.rosstuck.com/

Extending controller

Do it or not, but be consistent.

Using bundles... split or not?

External libraries

Maximize external library usage. Composer is awesome.

Rich text

Markdown instead of html rich text editors

parameters.yml

Must be in .gitignore. It's easy enough to generate it on fly.

Translate from the start

Make code in english at the start, makes life easier.

Log stuff

So easy, so valuable. At least in debug/info modes.

Updating

The real problem are external dependencies because they have outdated composer.json files.

Symfony Forms & Validation

Forms are good for prototyping, but later can be a burden. https://github.com/particle-php/Validator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment