more clean code tips, mostly about functions

This commit is contained in:
Morgan 2017-11-06 11:37:24 +01:00 committed by GitHub
parent ef56ca7b2e
commit 1f7a99686f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,9 @@
* Names : Names should be at least pronounceable. Don't abbreviate ! Unless it's a basic business concept, like VAT
* Names : should be consistent and unique (synonyms confuse).
* Names should have meaningful context. eg: order.customerFirstName. But don't repeat yourself (DRY) : Order.~~order~~CreationDate
* Functions should be small : 5-10 lines, ... or at least should be understandable in 5 sec no more.
* Functions do one thing
* Functions have max 2-3 parameters
## personal thoughts
* [MorganGeek](https://twitter.com/MorganGeek/statuses/420907517934178304) - Problem solving / Productivity : Good programmers write code after they found the solution. Un bon programmeur ne commence à coder qu'après avoir trouvé une solution.