60
What frameworks can do (and what not) Robert Lemke - TechDivision GmbH

What frameworks can do for you – and what not (IPC14 SE)

Embed Size (px)

DESCRIPTION

Companies often choose frameworks by the same criteria – which is popularity, documentation and matureness. And speed of course. Or only speed. But even if you found the "perfect" framework, what can you actually expect from it? And what are marketing promises even the best framework won't be able to deliver? From the perspective of someone who started an open source framework years ago I'll share my idea of where frameworks differ, where frameworks can help you and why engaging with one is unlike just buying a product.

Citation preview

Page 1: What frameworks can do for you – and what not (IPC14 SE)

What frameworks can do (and what not)

Robert Lemke - TechDivision GmbH

Page 2: What frameworks can do for you – and what not (IPC14 SE)

TEXT HERE

Robert Lemke !

38 years old lives in Lübeck, Germany software architect at TechDivision TYPO3 Association co-founder TYPO3 Flow & TYPO3 Neos project founder 1 wife, 2 daughters, 1 espresso machine

Page 3: What frameworks can do for you – and what not (IPC14 SE)

Expectations. Promises. Features. Long Term Relationships.

Page 4: What frameworks can do for you – and what not (IPC14 SE)

What do you expect from your IDE?

Page 5: What frameworks can do for you – and what not (IPC14 SE)

What do you expect from a framework?

Page 6: What frameworks can do for you – and what not (IPC14 SE)

„Implement our company website. It must be based on TYPO3 CMS.”

Page 7: What frameworks can do for you – and what not (IPC14 SE)

A frameworkis no architecture.

Page 8: What frameworks can do for you – and what not (IPC14 SE)

A framework alonewon’t make a great application.

Page 9: What frameworks can do for you – and what not (IPC14 SE)

Promises

Page 10: What frameworks can do for you – and what not (IPC14 SE)

„enterprise ready”

Page 11: What frameworks can do for you – and what not (IPC14 SE)

„a great community”

Page 12: What frameworks can do for you – and what not (IPC14 SE)

„extensible”

Page 13: What frameworks can do for you – and what not (IPC14 SE)

„secure”

Page 14: What frameworks can do for you – and what not (IPC14 SE)

„PHP is fun again”

Page 15: What frameworks can do for you – and what not (IPC14 SE)

„ready for tomorrow”

Page 16: What frameworks can do for you – and what not (IPC14 SE)

„based on another cool framework”

Page 17: What frameworks can do for you – and what not (IPC14 SE)

„batteries included”

Page 18: What frameworks can do for you – and what not (IPC14 SE)

„… is right for you if you want to spend more time away from your computer”

Page 19: What frameworks can do for you – and what not (IPC14 SE)

Features

Page 20: What frameworks can do for you – and what not (IPC14 SE)

Speed

Page 21: What frameworks can do for you – and what not (IPC14 SE)

Frameworks add more layers of abstraction.

Page 22: What frameworks can do for you – and what not (IPC14 SE)

Abstraction layers slow down your application.

Page 23: What frameworks can do for you – and what not (IPC14 SE)

Without a framework,most likely, you will add these layers yourself.

Page 24: What frameworks can do for you – and what not (IPC14 SE)

Abstraction layers speed up your application.

Page 25: What frameworks can do for you – and what not (IPC14 SE)

your applicationstarts here

Page 26: What frameworks can do for you – and what not (IPC14 SE)
Page 27: What frameworks can do for you – and what not (IPC14 SE)
Page 28: What frameworks can do for you – and what not (IPC14 SE)
Page 29: What frameworks can do for you – and what not (IPC14 SE)
Page 30: What frameworks can do for you – and what not (IPC14 SE)

speed doesn’t come for free.

Page 31: What frameworks can do for you – and what not (IPC14 SE)

Persistence

Page 32: What frameworks can do for you – and what not (IPC14 SE)

An ORM layer slows down your application and is less flexible.

Page 33: What frameworks can do for you – and what not (IPC14 SE)

An ORM layer can make your application less complex and respond faster.

Page 34: What frameworks can do for you – and what not (IPC14 SE)

keeps your domain model clean.

Page 35: What frameworks can do for you – and what not (IPC14 SE)

great caching opportunities.

Page 36: What frameworks can do for you – and what not (IPC14 SE)

Don’t implement an ORM – it’s way too complex to get it right.

Page 37: What frameworks can do for you – and what not (IPC14 SE)

Do implement an ORM – you need to know the inner works.

Page 38: What frameworks can do for you – and what not (IPC14 SE)

Do you need an ORM?

Page 39: What frameworks can do for you – and what not (IPC14 SE)

A DBAL makes your application more portable.

Page 40: What frameworks can do for you – and what not (IPC14 SE)

Do you need a DBAL?

Page 41: What frameworks can do for you – and what not (IPC14 SE)

Used correctly, ORMs can be a blessing.

Page 42: What frameworks can do for you – and what not (IPC14 SE)

Security

Page 43: What frameworks can do for you – and what not (IPC14 SE)

A framework can make your application more secure.

Page 44: What frameworks can do for you – and what not (IPC14 SE)

Implementing cryptography algorithms on your own iswantonly negligent!

Page 45: What frameworks can do for you – and what not (IPC14 SE)

Implementing authentication and authorisation adapters is a whole project on its own.

Page 46: What frameworks can do for you – and what not (IPC14 SE)

Do you have themanpower and expertise?

Page 47: What frameworks can do for you – and what not (IPC14 SE)

Still, you are responsible for security.

Page 48: What frameworks can do for you – and what not (IPC14 SE)

You need to learn about security, no matter what.

Page 49: What frameworks can do for you – and what not (IPC14 SE)

Guidance

Page 50: What frameworks can do for you – and what not (IPC14 SE)

TYPO3 Flow Coding Guidelines on one page

<?phpnamespace Acme\TestPackage;

/* * * This script belongs to the TYPO3 Flow package "Acme.TestPackage". * * * * It is free software; you can redistribute it and/or modify it under * * the terms of the GNU General Public License, either version 3 of the * * License, or (at your option) any later version. * * * * The TYPO3 project - inspiring people to share! * * */

use Acme\TestPackage\Service\FooGenerator;use TYPO3\Flow\Annotations as Flow;

/** * Here goes the description of the class. It should explain what the main * purpose of this class is... * * @Flow\Scope(”singleton”) */class UniverseAnalyzer extends BaseClass implements SomeInterface {

/** * Some injected dependency * * @Flow\Inject * @var FooGenerator */protected $someDependency = NULL;

/** * Shows if you are addicted to TYPO3 Flow * * @var boolean */static protected $addictedToFlow = TRUE;

/** * Shows if you are a fan of TYPO3 Flow * * @var boolean */protected $fanOfFlow;

/** * A great method which shows how to indent control structures. * * @param MyClass $object An instance of MyClass * @param array $someArray Some array * @return void * @throws \Exception */public function analyzeUniverse(MyClass $object, array $someArray = array()) {

$subObjects = $object->getSubObjects();foreach ($subObjects as $subObject){

/** @var $subObject MySubClass */$subObject->doSomethingCool();

}if (isset($someArray['question'])

&& $this->answerToEverything === 42|| count($someArray) > 3) {

$this->fanOfTYPO3Flow = TRUE;} else {

throw new \Exception('We cannot tolerate that.', 1223391710);}

}

/** * This is a setter for the fanOfFlow property. * * @param boolean $isFan Pass TRUE to mark a fan, FALSE for a Zend follower * @return mixed */public function setFanOfFlow($isFan) {

$this->fanOfFlow = $isFan;}

/** * As simple as it gets – a boolean getter. * * @return boolean Whether a foo was detected (TRUE) or not (FALSE) * @api */static public function isAddictedToFlow() {

return self::$addictedToFlow;}

}?>

Also check out the latest documentation: http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartV/CodingGuideLines/Index.html

Description of the class. Make it as long as needed, feel free to explain how to use it.

Namespace starts with vendor name followed by package key (name) and subparts as needed

UpperCamelCase class name. Class names should be nouns.In other packages, import \Acme\TestPackage\UniverseAnalyzer and refer to it as UniverseAnalyer.

Opening brace on same line with opening token. One space before.

Use @var tag. Optional description goes in the first comment line followed by a blank comment line.

Indent with tabs.

Multiline conditions:Indent them and add a extra indent to following code. Put the boolean operators at beginning of line.

Write what went wrong, give helpful details and give a hint for a possible solution.

UNIX timestamp at time of writing the throw clause.

Description of the method. Make it as long as needed.

Use type hinting

Methods returning boolean values should start with “has” or “is”. Other getters should start with “get“.

Setter methods should start with “set”.

Method names should be verbs.

@return tag with type, even if it is “void”. Only __construct() has no return tag.

static and abstract keywords before the visibility modifier

@api tag defines public API

One use statement per line.One use statement per namespace.Order statements alphabetically.Don't import namespaces unless you use them.

No empty line between DocComment and class, member var or method.

Prefer relative namespaces, unless Fully Qualified Namespace is more readable

Param tag: type, name, description.

Only use inline @var annotations when type can't be derived (like in an array of objects) to increase readability and trigger IDE auto-completion.

List @Flow\* before other tags: @var, @param, @return, @throws, @api, @since, @deprecated

Capture the joy of coding as you create excellent web solutions.Enjoy coding. Enjoy Flow.

http://rlmk.me/flowcgl

Page 51: What frameworks can do for you – and what not (IPC14 SE)
Page 52: What frameworks can do for you – and what not (IPC14 SE)

0 75 150 225 300

Security Speed MVC HTTP Templating i18n

You will have to learn a lot …

start working on business logic

Page 53: What frameworks can do for you – and what not (IPC14 SE)

… the question is: in which order?

0 100 200 300 400

Framework Security Speed MVC HTTP Templating i18n C64 E.

start working on business logic

Page 54: What frameworks can do for you – and what not (IPC14 SE)

But hey, what about Agile?

Page 55: What frameworks can do for you – and what not (IPC14 SE)

Bottomline?

Page 56: What frameworks can do for you – and what not (IPC14 SE)

Frameworks offer a shortcut and many features right away.

Page 57: What frameworks can do for you – and what not (IPC14 SE)

Going framework-less gives you more flexibility.

Page 58: What frameworks can do for you – and what not (IPC14 SE)

Non-trivial applications will need a framework sooner or later.

Page 59: What frameworks can do for you – and what not (IPC14 SE)

Only start creating your own application-specific framework if you have the experience and resources.

Page 60: What frameworks can do for you – and what not (IPC14 SE)

TEXT HERE

@robertlemke !

robertlemke.com flow.typo3.org techdivision.com