1 mac 413/5715 – seminário prof. fabio kon self: the power of simplicity david ungar and randall...
TRANSCRIPT
![Page 1: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/1.jpg)
1
MAC 413/5715 – SeminárioProf. Fabio Kon
Self: The Power of SimplicityDavid Ungar and Randall B. Smith
OOPSLA 1987
Cristina Fang Eduardo Miyoshi Kasa
![Page 2: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/2.jpg)
2
MAC 413/5715 – SeminárioProf. Fabio Kon
O problema
![Page 3: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/3.jpg)
3
MAC 413/5715 – SeminárioProf. Fabio Kon
![Page 4: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/4.jpg)
4
MAC 413/5715 – SeminárioProf. Fabio Kon
![Page 5: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/5.jpg)
5
Self: The Power of Simplicit
A solução?
![Page 6: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/6.jpg)
6
Self: The Power of Simplicit
Self
![Page 7: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/7.jpg)
7
Self: The Power of Simplicity
● Linguagem Orientada a Objetos Tudo é objeto (herdado de Smalltalk)
● Idéias utilizadas no desenho: Protótipos Slots Comportamento
![Page 8: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/8.jpg)
8
Self: The Power of Simplicity
● Protótipos: Objetos base que serão clonados Não utiliza classes Mais simples e flexível do que a maioria das
linguagens orientada a objetos
![Page 9: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/9.jpg)
9
Self: The Power of Simplicity
● Slots Protótipos contêm Slots Slots podem conter qualquer coisa (objetos,
procedures ou closures)
● Comportamento Não existe diferença entre comportamento e
estado.
![Page 10: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/10.jpg)
10
Self: The Power of Simplicity
![Page 11: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/11.jpg)
11
Self: The Power of Simplicity
Protótipos vs. Classes
![Page 12: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/12.jpg)
12
Self: The Power of Simplicity
Desvantagens de Linguagens OO baseada em classes:
- É necessário criar uma nova classe para criarmos um novo tipo de objeto
- Para alterar a estrutura do objeto precisamos alterar a classe.
![Page 13: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/13.jpg)
13
Self: The Power of Simplicity
Self combina herança, protótipos e objetos para eliminar a necessidade de
classes
![Page 14: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/14.jpg)
14
Self: The Power of Simplicity
• Classes– Contém comportamento– Herda de outra classe– Pode ser instanciada
• Objetos– Contém estado– São instâncias de Classes
• Protótipos– Contém comportamento– Delega a outros objetos– Pode ser clonado– Contém estados
![Page 15: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/15.jpg)
15
Self: The Power of Simplicity
![Page 16: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/16.jpg)
16
Self: The Power of Simplicity
Simples
![Page 17: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/17.jpg)
17
Self: The Power of Simplicity
● Relações simples "is a" e "kind of" são substituídos por
"inherits from" Fica mais fácil de entender a linguagem e
criar hierarquia de herança● Criação por cópia
Criar novos objetos é fácil: basta clonar
![Page 18: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/18.jpg)
18
Self: The Power of Simplicity
● Exemplos de módulos já existentes Protótipos são mais concretos que classes Exemplos (protótipos) são mais fáceis de
entender do que descrições (classes)
● Objetos únicos (one-of-a-kind) Objetos do tipo Singleton são mais fáceis de
se criar, pois cada objeto tem suas próprias características
![Page 19: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/19.jpg)
19
Self: The Power of Simplicity
● Meta-regressão Baseada em classes
● Nenhum objeto é auto-suficiente● Classes são necessárias para expressar sua
estrutura e comportamento
Baseada em protótipos● O objeto pode incluir o seu próprio
comportamento● Não tem meta-regressão
![Page 20: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/20.jpg)
20
Self: The Power of Simplicity
● Princípios no desenho de Self Messages-at-the-bottom Occam's Razor Concreto
![Page 21: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/21.jpg)
21
Self: The Power of Simplicity
● Messages-at-the-bottom Mensagens são a operação fundamental da
linguagem Acessos são feitos através de mensagens Não existem variáveis, apenas objetos que se
devolvem
![Page 22: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/22.jpg)
22
Self: The Power of Simplicity
● Occam's razor Self omite Classes e Variáveis Não existe diferença entre acessar variáveis ou
enviar uma mensagem.
● Concreto Os elementos são o mais concreto possível Para um objeto ser criado, ele é clonado Qualquer objeto pode ser clonado
![Page 23: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/23.jpg)
23
Self: The Power of Simplicity
Poderoso
![Page 24: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/24.jpg)
24
Self: The Power of Simplicity
● Herança dinâmica● Objetos Singleton● Adicionar/remover métodos em tempo de
execução● Compartilha estados entre objetos● Herança múltipla
![Page 25: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/25.jpg)
25
Self: The Power of Simplicity
Conclusão:
- Novo paradigma para linguagens OO
- Simplicidade por não precisar de classes e variáveis (eliminando meta-regressão)
- Em Self é possível criar estruturas com Classes e variáveis através de protótipos.
![Page 26: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/26.jpg)
26
Self: The Power of Simplicity
http://research.sun.com/self/
![Page 27: 1 MAC 413/5715 – Seminário Prof. Fabio Kon Self: The Power of Simplicity David Ungar and Randall B. Smith OOPSLA 1987 Cristina Fang Eduardo Miyoshi Kasa](https://reader036.vdocument.in/reader036/viewer/2022062512/552fc113497959413d8c709e/html5/thumbnails/27.jpg)
27
Self: The Power of Simplicity
Dúvidas?