ORIENTAÇÃO A OBJETOS                             ...Thursday, June 14, 2012                    1
PA LEST RA DE                          , MAIS UMA          SIM                    ORIENTAÇÃO A OBJETOSThursday, June 14, 2...
PA LEST RA DE                          , MAIS UMA          SIM                    ORIENTAÇÃO A OBJETOS                    ...
AGENDAThursday, June 14, 2012            4
AGENDA                     CONCEITOSThursday, June 14, 2012                   4
AGENDA                     CONCEITOS                     PARADIGMAS DE PROGRAMAÇÃOThursday, June 14, 2012                 ...
CONCEITOSThursday, June 14, 2012               5
ESTADOThursday, June 14, 2012            6
hardware na maioria das vezes nem sabe o estado                                                            ESTADOThursday,...
hardware na maioria das vezes nem sabe o estado                                                            ESTADO         ...
ESTADOThursday, June 14, 2012            9
TIPAGEMThursday, June 14, 2012             10
TIPAGEMThursday, June 14, 2012             11
REUSOThursday, June 14, 2012           12
REUSOThursday, June 14, 2012           13
FIBONACCIThursday, June 14, 2012               14
SEQUÊNCIA DE FIBONACCIThursday, June 14, 2012                            15
SEQUÊNCIA DE FIBONACCI                                      HTTPS://EN.WIKIPEDIA.ORG/WIKI/FIBONACCI_NUMBERThursday, June 1...
PARADIGMAS DE                          PROGRAMAÇÃOThursday, June 14, 2012                   17
ASSEMBLYThursday, June 14, 2012              18
.data        fibonacci DWORD 100 dup (0)        .code        mov edx,offset fibonacci        mov eax,1        mov ebx,1   ...
.data        fibonacci DWORD 100 dup (0)        .code        mov edx,offset fibonacci        mov eax,1        mov ebx,1   ...
.data        fibonacci DWORD 100 dup (0)        .code        mov edx,offset fibonacci        mov eax,1        mov ebx,1   ...
.data        fibonacci DWORD 100 dup (0)        .code        mov edx,offset fibonacci        mov eax,1        mov ebx,1   ...
.386        .model	  Flat        public	  Fibonacci        include	  iosmacros.inc	  ;	  inclui	  macros	  de	  output	  p...
PROCEDURALThursday, June 14, 2012                24
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1              2              3              5              8              13              21              34             ...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1        <?php                 2        $past     = 0;                 3        $current = 1;                 4        $li...
1 <?php                2         function fibonacci($limit) {                3             $past     = 0;                4...
1 <?php                 2        function fibonacci($iteration) {                 3            $past     = 0;             ...
1 <?php                   2 require fibonacci-func-return.php;                   3                   4 for ($i=1; $i<=20; ...
ORIENTADO A OBJETOSThursday, June 14, 2012                         40
1     <?php                2     require Fibonacci.php;                3                4     $iterator = new Fibonacci(20...
1     <?php                2        INSTÂNCIA                      require Fibonacci.php;                3                ...
1 <?php                                      CLASSE                2 require Fibonacci.php;                3              ...
1     <?php                2     require Fibonacci.php;                3                4     $iterator = new Fibonacci(20...
1     <?php                2     require Fibonacci.php;                3                4     $iterator = new Fibonacci(20...
1     <?php                2     require Fibonacci.php;                3                4     $iterator = new Fibonacci(20...
1    <?php                2    class Fibonacci                3    {                4        // Conteúdo da classe        ...
1     <?php             2     class Fibonacci             3     {             4         /**             5           * Núme...
1      <?php              2      class Fibonacci              3      {              4          // ... (Proriedades)       ...
1      <?php              2      class Fibonacci              3      {              4          // ... (Construtor e Propri...
HTTP://GIT.IO/HAPPYPANDAThursday, June 14, 2012                              51
1      <?php              2      class Fibonacci              3      {              4          // ...              5      ...
1      <?php              2      class Fibonacci              3      {              4          // ...              5      ...
1      <?php              2      class Fibonacci              3      {              4          // ...              5      ...
1      <?php              2      class Fibonacci              3      {              4          // ...              5      ...
DESIGN PATTERNSThursday, June 14, 2012                     56
1    <?php                2    class FibonacciIterator implements Iterator                3    {                4        /...
1 <?php                2 require FibonacciIterator.php;                3                4 foreach ($iterator as $i)       ...
COMPOSIÇÃO                                >                          GENERALIZAÇÃOThursday, June 14, 2012                 ...
AGENDAThursday, June 14, 2012            60
AGENDA                     CONCEITOSThursday, June 14, 2012                   60
AGENDA                     CONCEITOS                          ESTADO, TIPAGEM E REUSOThursday, June 14, 2012              ...
AGENDA                     CONCEITOS                          ESTADO, TIPAGEM E REUSO                          SEQUÊNCIA D...
AGENDA                     CONCEITOS                          ESTADO, TIPAGEM E REUSO                          SEQUÊNCIA D...
AGENDA                     CONCEITOS                          ESTADO, TIPAGEM E REUSO                          SEQUÊNCIA D...
AGENDA                     CONCEITOS                          ESTADO, TIPAGEM E REUSO                          SEQUÊNCIA D...
AGENDA                     CONCEITOS                          ESTADO, TIPAGEM E REUSO                          SEQUÊNCIA D...
PERGUNTAS?Thursday, June 14, 2012                61
OBRIGADO!Thursday, June 14, 2012               62
RECADOS DA PARÓQUIA                                                4 a 8 julho                                      HTTP:/...
Upcoming SlideShare
Loading in …5
×

Orientação a objetos v2

1,044
-1

Published on

Uma breve evolução dos paradigmas de programação até a Orientação a Objetos, assim como apresentação de alguns recursos da mesma dentro do contexto de programação.

Códigos Utilizados: https://github.com/augustohp/palestra-orientacao-objetos
Avaliações:
- VII Congresso Uniararas: https://joind.in/6692

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,044
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
22
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Orientação a objetos v2

  1. 1. ORIENTAÇÃO A OBJETOS ...Thursday, June 14, 2012 1
  2. 2. PA LEST RA DE , MAIS UMA SIM ORIENTAÇÃO A OBJETOSThursday, June 14, 2012 2
  3. 3. PA LEST RA DE , MAIS UMA SIM ORIENTAÇÃO A OBJETOS @AUGUS TOHP @ALGAN ETThursday, June 14, 2012 3
  4. 4. AGENDAThursday, June 14, 2012 4
  5. 5. AGENDA CONCEITOSThursday, June 14, 2012 4
  6. 6. AGENDA CONCEITOS PARADIGMAS DE PROGRAMAÇÃOThursday, June 14, 2012 4
  7. 7. CONCEITOSThursday, June 14, 2012 5
  8. 8. ESTADOThursday, June 14, 2012 6
  9. 9. hardware na maioria das vezes nem sabe o estado ESTADOThursday, June 14, 2012 7
  10. 10. hardware na maioria das vezes nem sabe o estado ESTADO INCADEIRA BRThursday, June 14, 2012 8
  11. 11. ESTADOThursday, June 14, 2012 9
  12. 12. TIPAGEMThursday, June 14, 2012 10
  13. 13. TIPAGEMThursday, June 14, 2012 11
  14. 14. REUSOThursday, June 14, 2012 12
  15. 15. REUSOThursday, June 14, 2012 13
  16. 16. FIBONACCIThursday, June 14, 2012 14
  17. 17. SEQUÊNCIA DE FIBONACCIThursday, June 14, 2012 15
  18. 18. SEQUÊNCIA DE FIBONACCI HTTPS://EN.WIKIPEDIA.ORG/WIKI/FIBONACCI_NUMBERThursday, June 14, 2012 16
  19. 19. PARADIGMAS DE PROGRAMAÇÃOThursday, June 14, 2012 17
  20. 20. ASSEMBLYThursday, June 14, 2012 18
  21. 21. .data fibonacci DWORD 100 dup (0) .code mov edx,offset fibonacci mov eax,1 mov ebx,1 mov ecx,49 @@: mov DWORD PTR [edx],eax mov DWORD PTR [edx+4],ebx add eax,ebx add ebx,eax add edx,8 sub ecx,1 jnz @B HTTP://WWW.CODECODEX.COM/WIKI/FIBONACCI_SEQUENCE#80386.2B_ASSEMBLYThursday, June 14, 2012 19
  22. 22. .data fibonacci DWORD 100 dup (0) .code mov edx,offset fibonacci mov eax,1 mov ebx,1 mov ecx,49 @@: mov DWORD PTR [edx],eax mov DWORD PTR [edx+4],ebx add eax,ebx add ebx,eax add edx,8 sub ecx,1 jnz @B HTTP://WWW.CODECODEX.COM/WIKI/FIBONACCI_SEQUENCE#80386.2B_ASSEMBLYThursday, June 14, 2012 20
  23. 23. .data fibonacci DWORD 100 dup (0) .code mov edx,offset fibonacci mov eax,1 mov ebx,1 mov ecx,49 @@: mov DWORD PTR [edx],eax mov DWORD PTR [edx+4],ebx add eax,ebx add ebx,eax add edx,8 sub ecx,1 jnz @B HTTP://WWW.CODECODEX.COM/WIKI/FIBONACCI_SEQUENCE#80386.2B_ASSEMBLYThursday, June 14, 2012 21
  24. 24. .data fibonacci DWORD 100 dup (0) .code mov edx,offset fibonacci mov eax,1 mov ebx,1 mov ecx,49 @@: mov DWORD PTR [edx],eax mov DWORD PTR [edx+4],ebx add eax,ebx add ebx,eax add edx,8 sub ecx,1 jnz @B HTTP://WWW.CODECODEX.COM/WIKI/FIBONACCI_SEQUENCE#80386.2B_ASSEMBLYThursday, June 14, 2012 22
  25. 25. .386 .model  Flat public  Fibonacci include  iosmacros.inc  ;  inclui  macros  de  output  para  tela .code Fibonacci  proc        MOV  EAX,  [ESP+4]        CMP  EAX,  1        JA  Recurse        MOV  EAX,  1                ;  retorna  o  valor  de  eax        JMP  exit Recurse:        PUSH  EBX                    ;  preserva  o  valor  de  ebx        DEC  EAX        PUSH  EAX        CALL  Fibonacci        MOV  EBX,  EAX            ;  ebx  preservado,  seguro  de  usar        DEC  [ESP]                  ;  decrementa  o  valor  no  stack        CALL  Fibonacci        ADD  EAX,  EBX            ;  retorna  o  valor  em  eax        ADD  ESP,  4                ;  remove  o  valor  do  stack        POP  EBX                      ;  restaura  o  valor  antigo  de  ebx exit: ret Fibonacci  endp HTTP://STACKOVERFLOW.COM/QUESTIONS/5616684/RECURSIVE-FIBONACCI-IN-ASSEMBLYThursday, June 14, 2012 23
  26. 26. PROCEDURALThursday, June 14, 2012 24
  27. 27. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 25
  28. 28. 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765Thursday, June 14, 2012 26
  29. 29. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 27
  30. 30. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 28
  31. 31. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 29
  32. 32. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 30
  33. 33. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 31
  34. 34. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 32
  35. 35. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 33
  36. 36. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 34
  37. 37. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 35
  38. 38. 1 <?php 2 $past = 0; 3 $current = 1; 4 $limit = 20; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } HTTP://WWW.DREAMINCODE.NET/CODE/SNIPPET920.HTMThursday, June 14, 2012 36
  39. 39. 1 <?php 2 function fibonacci($limit) { 3 $past = 0; 4 $current = 1; 5 for($i=1; $i<$limit; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 echo $final . PHP_EOL; 10 } 11 } 12 fibonacci(20);Thursday, June 14, 2012 37
  40. 40. 1 <?php 2 function fibonacci($iteration) { 3 $past = 0; 4 $current = 1; 5 for($i=1; $i<$iteration; $i++) { 6 $final = $past + $current; 7 $past = $current; 8 $current = $final; 9 } 10 return $current; 11 } 12 echo fibonacci(20) . PHP_EOL; // 6765Thursday, June 14, 2012 38
  41. 41. 1 <?php 2 require fibonacci-func-return.php; 3 4 for ($i=1; $i<=20; $i++) 5 echo fibonacci($i) . PHP_EOL;Thursday, June 14, 2012 39
  42. 42. ORIENTADO A OBJETOSThursday, June 14, 2012 40
  43. 43. 1 <?php 2 require Fibonacci.php; 3 4 $iterator = new Fibonacci(20); 5 while ($iterator->valid()) { 6 echo $iterator->current() . PHP_EOL; 7 $iterator->next(); 8 }Thursday, June 14, 2012 41
  44. 44. 1 <?php 2 INSTÂNCIA require Fibonacci.php; 3 4 $iterator = new Fibonacci(20); 5 while ($iterator->valid()) { 6 echo $iterator->current() . PHP_EOL; 7 $iterator->next(); 8 }Thursday, June 14, 2012 42
  45. 45. 1 <?php CLASSE 2 require Fibonacci.php; 3 4 $iterator = new Fibonacci(20); 5 while ($iterator->valid()) { 6 echo $iterator->current() . PHP_EOL; 7 $iterator->next(); 8 }Thursday, June 14, 2012 43
  46. 46. 1 <?php 2 require Fibonacci.php; 3 4 $iterator = new Fibonacci(20); 5 while ($iterator->valid()) { 6 echo $iterator->current() . PHP_EOL; 7 $iterator->next(); 8 }Thursday, June 14, 2012 44
  47. 47. 1 <?php 2 require Fibonacci.php; 3 4 $iterator = new Fibonacci(20); 5 while ($iterator->valid()) { 6 echo $iterator->current() . PHP_EOL; 7 $iterator->next(); 8 }Thursday, June 14, 2012 45
  48. 48. 1 <?php 2 require Fibonacci.php; 3 4 $iterator = new Fibonacci(20); 5 while ($iterator->valid()) { 6 echo $iterator->current() . PHP_EOL; 7 $iterator->next(); 8 }Thursday, June 14, 2012 46
  49. 49. 1 <?php 2 class Fibonacci 3 { 4 // Conteúdo da classe 5 }Thursday, June 14, 2012 47
  50. 50. 1 <?php 2 class Fibonacci 3 { 4 /** 5 * Número anterior, o primeiro na sequência é o 0 (zero). 6 * 7 * @var integer 8 */ 9 protected $previous = 0; 10 /** 11 * Número atual, o segundo na sequência é o 1 (um). 12 * 13 * @var integer 14 */ 15 protected $current = 1; 16 /** 17 * Número da iteração. 18 * 19 * @var integer 20 */ 21 protected $iteration = 0; 22 /** 23 * Qual o limite de iterações a executar. 24 * 25 * @var integer 26 */ 27 protected $limit; 28 }Thursday, June 14, 2012 48
  51. 51. 1 <?php 2 class Fibonacci 3 { 4 // ... (Proriedades) 5 6 /** 7 * Construtor. 8 * 9 * @example $i = new Fibonacci(25); 10 * @param integer $n=25 Limite de iterações 11 */ 12 public function __construct($n=25) 13 { 14 $this->limit = $n; 15 } 16 17 // ... (outros métodos) 18 }Thursday, June 14, 2012 49
  52. 52. 1 <?php 2 class Fibonacci 3 { 4 // ... (Construtor e Propriedades) 5 6 /** 7 * Retorna o elemento atual da sequência. 8 * 9 * @return integer 10 */ 11 public function current() 12 { 13 return $this->current; 14 } 15 16 // ... (outros métodos) 17 }Thursday, June 14, 2012 50
  53. 53. HTTP://GIT.IO/HAPPYPANDAThursday, June 14, 2012 51
  54. 54. 1 <?php 2 class Fibonacci 3 { 4 // ... 5 6 /** 7 * Retorna o número da iteração atual. 8 * 9 * @return integer 10 */ 11 public function key() 12 { 13 return $this->iteration; 14 } 15 16 // ... (outros métodos) 17 }Thursday, June 14, 2012 52
  55. 55. 1 <?php 2 class Fibonacci 3 { 4 // ... 5 6 /** 7 * Vai para próxima iteração. 8 * 9 * @return void 10 */ 11 public function next() 12 { 13 $final = $this->current + $this->previous; 14 $this->previous = $this->current; 15 $this->current = $final; 16 $this->iteration++; 17 } 18 19 // ... (outros métodos) 20 }Thursday, June 14, 2012 53
  56. 56. 1 <?php 2 class Fibonacci 3 { 4 // ... 5 6 /** 7 * Volta para primeira iteração. 8 * 9 * @return void 10 */ 11 public function rewind() 12 { 13 $this->previous = $this->iteration = 0; 14 $this->current = 1; 15 } 16 17 // ... (outros métodos) 18 }Thursday, June 14, 2012 54
  57. 57. 1 <?php 2 class Fibonacci 3 { 4 // ... 5 6 /** 7 * Retorna se existe uma próxima iteração válida. 8 * Caso não existe, executa Fibonacci::rewind(). 9 * 10 * @see Fibanacci::rewind() 11 * @return boolean 12 */ 13 public function valid() 14 { 15 if ($this->iteration < $this->limit) 16 return true; 17 18 $this->rewind(); 19 return false; 20 } 21 }Thursday, June 14, 2012 55
  58. 58. DESIGN PATTERNSThursday, June 14, 2012 56
  59. 59. 1 <?php 2 class FibonacciIterator implements Iterator 3 { 4 // ... 5 }Thursday, June 14, 2012 57
  60. 60. 1 <?php 2 require FibonacciIterator.php; 3 4 foreach ($iterator as $i) 5 echo $i . PHP_EOL; HTTP://PHP.NET/ITERATORThursday, June 14, 2012 58
  61. 61. COMPOSIÇÃO > GENERALIZAÇÃOThursday, June 14, 2012 59
  62. 62. AGENDAThursday, June 14, 2012 60
  63. 63. AGENDA CONCEITOSThursday, June 14, 2012 60
  64. 64. AGENDA CONCEITOS ESTADO, TIPAGEM E REUSOThursday, June 14, 2012 60
  65. 65. AGENDA CONCEITOS ESTADO, TIPAGEM E REUSO SEQUÊNCIA DE FIBONACCIThursday, June 14, 2012 60
  66. 66. AGENDA CONCEITOS ESTADO, TIPAGEM E REUSO SEQUÊNCIA DE FIBONACCI PARADIGMAS DE PROGRAMAÇÃOThursday, June 14, 2012 60
  67. 67. AGENDA CONCEITOS ESTADO, TIPAGEM E REUSO SEQUÊNCIA DE FIBONACCI PARADIGMAS DE PROGRAMAÇÃO ASSEMBLYThursday, June 14, 2012 60
  68. 68. AGENDA CONCEITOS ESTADO, TIPAGEM E REUSO SEQUÊNCIA DE FIBONACCI PARADIGMAS DE PROGRAMAÇÃO ASSEMBLY PROCEDURALThursday, June 14, 2012 60
  69. 69. AGENDA CONCEITOS ESTADO, TIPAGEM E REUSO SEQUÊNCIA DE FIBONACCI PARADIGMAS DE PROGRAMAÇÃO ASSEMBLY PROCEDURAL ORIENTAÇÃO A OBJETOSThursday, June 14, 2012 60
  70. 70. PERGUNTAS?Thursday, June 14, 2012 61
  71. 71. OBRIGADO!Thursday, June 14, 2012 62
  72. 72. RECADOS DA PARÓQUIA 4 a 8 julho HTTP://WWW.THEDEVELOPERSCONFERENCE.COM.BRThursday, June 14, 2012 63
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×