Aside from language-specific constructs, for someone who is programming in PHP, javascript, java, and python, what are the top 10 clean coding must-do's? I would like to keep my code as clean as possible and as readable as possible. For example, what's the take on placing the function body opening bracket on the same line as the function declaration vs a new line? Also, what's the take on spacing between things for example (x==10) vs ( x == 10 )? Any helpful hints for clean coding will be appreciated!
相关问题
- Using @string resource inside a style definition
- TCPDF page borders?
- Powershell verb for destroying a resource
- Scala style: for vs foreach, filter, map and other
- Naming conventions for function parameter variable
相关文章
- Python relative import with more than two dots
- Bind a char to an enum type
- Should I keep bad naming conventions?
- In OOP, what is the best practice in regards to us
- Why do some users quote classnames in Perl?
- If 'else' is about to happen anyway should
- Export Visual Studio's 'Code Style setting
- Using explicit del in python on local variables
Here's a few that may help:
I am sure there are a lot more but I believe these can be useful in any language
Reference:
http://misko.hevery.com/code-reviewers-guide/
http://misko.hevery.com/attachments/Guide-Writing%20Testable%20Code.pdf
And check the links from this response:
https://stackoverflow.com/a/10359288/1268570
Watch the clean code talks from Misko Hevery (given to the Google people)
http://www.youtube.com/watch?v=wEhu57pih5w&feature=player_embedded
http://www.youtube.com/watch?v=RlfLCWKxHJ0&feature=player_embedded
http://www.youtube.com/watch?v=-FRm3VPhseI&feature=player_embedded
http://www.youtube.com/watch?v=4F72VULWFvc&feature=player_embedded
Theses are warning signs that you should avoid: (From Misko Hevery)
This is a great book about writing clean code:
http://books.google.com.mx/books/about/Clean_Code.html?id=dwSfGQAACAAJ&redir_esc=y
The answer in my opinion is that there is no real answer. A good rule is to stick to a convention, which usually is a reasonable convention that the community is already familiar with. I would rather suggest you a couple of books to have an idea.
For Java/C++/C#/VisualBasic you should read
Code Complete: a practical handbook of software construction
On the Java-heavy side, you would get useful insight from
Clean Code: a handbook of agile software craftmanship
Consider that the concepts in those two books are of general validity and should not be bound to a specific language.