Last active
May 10, 2016 11:02
-
-
Save iamlucianojr/3a640d3c589a8dc175b3 to your computer and use it in GitHub Desktop.
Wake up reading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOLID: | |
- Single responsability principle | |
- Open/Closed principle | |
- Liskov substituition principle | |
- Interface segregation principle | |
- Dependence inversion principle | |
Object Calisthenics: | |
- Only One Level Of Indentation Per Method | |
- Don't Use The ELSE Keyword | |
- Wrap All Primitives And Strings (When it has a behavior) | |
- First Class Collections | |
- One Dot Per Line | |
- Don't Abbreviate | |
- Keep All Entities Small | |
- No Classes With More Than Two ~ Five Instance Variables | |
- No Getters/Setters/Properties, No set, change, tell, don't aks | |
Tell, don't ask: | |
- AskMonitor am = new AskMonitor("Time Vortex Hocus", 2, alarm); | |
am.setValue(3); | |
if (am.getValue() > am.getLimit()) | |
am.getAlarm().warn(am.getName() + " too high"); | |
- TellMonitor tm = new TellMonitor("Time Vortex Hocus", 2, alarm); | |
tm.setValue(3); | |
Agregação > Derivação | |
Programe para inteface, não para implementação | |
Os requisitos mudam | |
DRY: Don't repeat yourself | |
KISS: Keep it stupid simple | |
Inversion of control | |
Try don't use static method | |
Design Patterns: | |
- Creational: | |
- Factory Method: | |
- Retardar a criação de um produto, delega para um subtipo criar o objeto | |
- Abstract Factory | |
- Cria factory, crie "Button" e então a fabric WinFactory cria um botão de Windows, a UnixFactory criaria de Linux. | |
- Builder | |
- Objetos complexos, incapsular um construtor concreto "new something($name, $idade, $other, $other2)" | |
- Object Pool | |
- Prototype | |
- Reusar uma instancia de objeto para criar novos (clonar), reduzindo custos de construnção, não precisar ficar setando atributos (Ex: Objeto criado em servidores externos ou objetos complexos). Também permite em uma injeção de dependencia criação de novas instancias sem conhecer a interface | |
- Structural | |
- Adapter | |
- Criar um "tradutor" de interface para utilizar certo objeto que possui uma interface diferente da necessário. Exempo: "Livro {Open, NextPage} e EReader {On, ButtonNextPage} > EReaderAdpter{Opne {On()}, NextPage{ButtonNe xtPage()}}"; | |
- Bridge | |
- | |
- Composite | |
- Decorator | |
- Facade | |
- Behavioral | |
- Command | |
- Chain of Responsability | |
- Criar uma serie sequencia de chamadas para metodos ligados, recursivamente cada participante trata o request e posteriormente o delega para o próximo na cadeia | |
- Mediator | |
- Template Method: | |
- Generalizar um método na classe base para ser comum as classes derivadas e possibilita um placeholde da operação, deixando apenas a alteração do que é variável para os produtos filhos. | |
Ex:"Abstract class Worker{work)()} FireFight extends Worker {work(){ throwWater();} Então $worker = new FireFight()->work();" | |
- Strategy | |
- Encapsula uma familia de objeto e então permite trocar de familia facilmente. Mesmo caso do Template Method, porém agora com familias de objetos e nao objetos | |
BD: | |
- ACID: | |
- Atomicity | |
- Consistency | |
- Isolation | |
- Durability | |
noSQL: | |
- Not Only SQL | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment