O documento discute como reduzir repetição de código em aplicações usando o framework Zend. Ele introduz o conceito de "Skeleton" como um exemplo inicial e tutorial e discute problemas como inconsistência, código molhado e relacionamentos. Apresenta abordagens como usar relacionamentos e princípios DRY para tornar o código mais coerente e reutilizável.
DRYing the Skeleton: Reducing code repetition in ZF2
1. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 1 / 26
DRYing the Skeleton www.galvao.eti.br
DRYing
the Skeleton:
Reducing
code repetition
in
applications
2. Presidente da ABRAPHP – Associação Brasileira de Profissionais PHP
Diretor da PHP Conference Brasil
Contribui para a tradução da documentação oficial
Atua como Zend Framework Evangelist para o ZTeam, da Zend.
20+ anos desenvolvendo sistemas e aplicações com interface web
15+ destes com PHP
7+ com Zend Framework
Palestrante em eventos nacionais e internacionais
Instrutor de cursos presenciais e a distância
Fundador e líder do GU PHPBR
Fundador* e membro do GU PHPRS
Site: http://www.galvao.eti.br/
http://people.php.net/galvao
Twitter: @galvao
Slides e Documentos: http://slideshare.net/ergalvao
https://speakerdeck.com/galvao
Github: http://github.com/galvao
Posts: https://medium.com/@galvao
Quem?!
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 2 / 26
www.galvao.eti.brDRYing the Skeleton
3. Objetivo
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 3 / 26
www.galvao.eti.brDRYing the Skeleton
DRY > WET
ZF pode ser DRY
6. Disclaimer!
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 6 / 26
www.galvao.eti.brDRYing the Skeleton
!
A Skeleton
um erro
um mau exemplo
é
7. Disclaimer!
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 7 / 26
www.galvao.eti.brDRYing the Skeleton
!
A Skeleton
um erro
um mau exemplo
um código mal escrito
é
8. Disclaimer!
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 8 / 26
www.galvao.eti.brDRYing the Skeleton
!
A Skeleton
um erro
um mau exemplo
um código mal escrito
um código para todos governaré
9. Fato!
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 9 / 26
www.galvao.eti.brDRYing the Skeleton
A Skeleton
é
é
é
é
10. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 10 / 26
www.galvao.eti.brDRYing the Skeleton
A Skeleton
uma introdução
é
é
é
é
Fato!
11. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 11 / 26
www.galvao.eti.brDRYing the Skeleton
A Skeleton
uma introdução
um exemplo de uso
é
é
é
é
Fato!
12. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 12 / 26
www.galvao.eti.brDRYing the Skeleton
A Skeleton
uma introdução
um exemplo de uso
um tutorial
é
é
é
é
Fato!
13. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 13 / 26
www.galvao.eti.brDRYing the Skeleton
A Skeleton
uma introdução
um exemplo de uso
um tutorial
um começoé
é
é
é
Fato!
14. Problemas...
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 14 / 26
www.galvao.eti.brDRYing the Skeleton
x “Incoerência”
x WET – WETWET – WETTT
x Relacionamentos?!
15. Incoerência
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 15 / 26
www.galvao.eti.brDRYing the Skeleton
http://framework.zend.com/manual/current/en/user-guide/database-and-models.html
17. WETWET
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 17 / 26
www.galvao.eti.brDRYing the Skeleton
http://framework.zend.com/manual/current/en/user-guide/database-and-models.html
18. WETWET
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 18 / 26
www.galvao.eti.brDRYing the Skeleton
http://framework.zend.com/manual/current/en/user-guide/database-and-models.html
11 Linhas de código-fonte x Entidade
19. WETWET
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 19 / 26
www.galvao.eti.brDRYing the Skeleton
http://framework.zend.com/manual/current/en/user-guide/database-and-models.html
11 Linhas de código-fonte x Entidade
Além de find/save/erase/etc… por Gateway...
20. Existem “programadores”...
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 20 / 26
www.galvao.eti.brDRYing the Skeleton
x “Incoerência”
x WET – WETWET – WETTT
x Relacionamentos?!
21. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/15 - 21 / 26
… e PROGRAMADORES!
x “Incoerência”
x WET – WETWET – WETTT
x Relacionamentos?!
www.galvao.eti.brDRYing the Skeleton