What would your application look like if it were written by the people who write the testing frameworks? If unit tests make classes more modular, by forcing you to test it in isolation, then what is the effect of expanding this to a less granular level, the acceptance and functional test. The more modern application architecture evolves, the more we hear the very old patterns being rediscovered and re-adopted. 1979 Trygve's MVC is a classic example, so are the SOLID principles. In this talk we will look on how Symfony allows for a really decoupled, easy to test application, by following on the footsteps of Alistair Cockburn's hexagonal architecture.
10. @_md @everzet
a SensioLabsEvent
A framework is“convenient”
when it makes choices for you
BookController extends Controller
AuthorsController extends ContainerAwareController
27. @_md @everzet
a SensioLabsEvent
Howmanydependenciescanyouspot?
public function updateAction($id)
{
$em = $this->getDoctrine()->getManager();
$product = $em->getRepository('AcmeStoreBundle:Product')->find($id);
if (!$product) {
throw $this->createNotFoundException(
'No product found for id '.$id
);
}
$product->setName('New product name!');
$em->flush();
return $this->redirect($this->generateUrl('homepage'));
}
28. @_md @everzet
a SensioLabsEvent
Howmanydependenciescanyouspot?
public function updateAction($id)
{
$em = $this->getDoctrine()->getManager();
$product = $em->getRepository('AcmeStoreBundle:Product')->find($id);
if (!$product) {
throw $this->createNotFoundException(
'No product found for id '.$id
);
}
$product->setName('New product name!');
$em->flush();
return $this->redirect($this->generateUrl('homepage'));
}
Doctrine
Redirect
Router
Model
29. @_md @everzet
a SensioLabsEvent
HexagonalArchitecture
“The hexagon is not a hexagon because the number six is
important, but rather to allow the people doing the drawing
to have room to insert ports and adapters as they need”
:)
[Cockburn 08]