2. Matheus Gontijo
Y-E-E-A-A-H-H, we have a #Brazilian in the house, folks!
So ware Engineer at
Over 6 years of experience with Magento platform
Speaker and attendee to conferences all over the world
on twitter - ping me there ;- D
Crimson Agility
MCD & MCD+
@mhgontijo
7. Poorly written code equals...
💩💩💩
countless hours of energy being drained
HUGE amount of time wasted === MONEY wasted
...it's unpleseant... it discourages the entire team to work
with that mess
13. Cal • is • then • ics
/ˌkaləsˈTHeniks/
Greek word that means
gymnastic exercises.
14. The concept was created by Jeff Bay in his
book The ThoughtWorks Anthology
A collection of exercises to focus on
maintainability, readability, testability, and
comprehensibility of your code.
15. PHP Community?
Rafael Dohms -
Keynode Speaker, Evangelist, and founder of PHPSP &
PHPAmsterdam... which are awesome!
Guilherme Blanco -
Core Committer at Doctrine, Symfony and Zend Framework
@rdohms
@guilhermeblanco
19. BUT don't follow them blindly....
It's NOT binary: RIGHT or WRONG
There is not one-size-fits-all
No Silver Bullet
Don't take what I'm saying as absolute truth :- P
the main goal is to challenge yourself...
to make you RE-think the way you code...
20. 30 minutes only
just going through quickly ; )
the examples are very simple just for the sake of easy
understanding
32. Example:
Let's create a class in order to
subscribe emails to a newsletter
group called VIP.
33. Rules:
It has to be a valid email.
The email can not be registered again, if it already is.
The email has to have a customer assigned the same email.
The customer assigned to that email needs to be assigned
to VIP Group also.
46. When?
When your type needs validations, business rules or
behaviors
Email
Zipcode
Phone Number
IP Address
IBAN, ISBN
URL
List of status as Pending, Denied, Approved
...
106. Recap
1. Only One Level Of Indentation Per Method
2. Don't Use The ELSE Keyword
3. Wrap All Primitives Types And Strings, If It Has Behavior
4. First Class Collections
5. One Dot "->" Per Line
6. Don't Abbreviate
7. Keep All Entities Small
8. No Classes With More Than Two Five Instance Variables
9. No Getters and Setters!