 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Vinícius Krolow: Some tips to improve your codes readability
by Chris Cornutt January 25, 2013 @ 09:53:55
In this new post to his site Vinícius Krolow shares some tips he thinks will help to make your PHP code more readable in the long run.
What about code readability, from my point of view is one of the most important thing in the code. Who writes code that is easy to read, writes good code. Probably reading code is where you spent most part of your time, and not only your code, probably code of your team mates, or maybe code from the open source community, so write code that is simple and is easy to understand it's really important.
His tips (seven of them) are:
- Comment before write your code (DocBlock)
- Return frequently, Return early
- Break, Continue
- Code Standard / Name conventions
- Throw Exception
- Comment often, but not write stupid comments
- Methods can be always smaller than they are
It's a little difficult to read as the English isn't the speaker's native tongue, but it gets the point across. He also recommends reading this if you'd like more information about writing better OOP code that's easier to read.
voice your opinion now!
code readability recommendations structure comments conventions
PHPMaster.com: Practical Code Refactoring, Part 2 - Readability
by Chris Cornutt October 22, 2012 @ 10:16:03
PHPMaster.com has returned with the second part of their guide to code refactoring. In this second part they pick up where they left off and focus on code readability this time.
In part one of this series I introduced what constitutes good code. As the series on code refactoring continues we'll dive into each of the three aspects and see how to refactor for each of them in order: readability, extensibility, and efficiency. In this part, the focus is on refactoring your code for better readability. Recall the definition of readability: readable code follows some well-known style and documentation practices. To help you start refactoring your code for readability, I've prepared this list of questions you should ask yourself throughout the development, testing, and review process.
There's a few different types of things that contribute to readable code, so he breaks the article up into a few sections:
- General things like coding style guides, header comments and a reduction of global code
- Naming conventions, well-named variables and methods
- Simplified and easy to use expressions
- Blocks of code, their average size and complexity.
voice your opinion now!
readability code refactor guide tutorial series
Matthew Weier O'Phinney's Blog: Why PHP Namespaces Matter
by Chris Cornutt February 04, 2011 @ 13:23:22
Matthew Weier O'Phinney has a new post today talking about why namespaces in PHP matter and why he thinks they're a valuable contribution to the language.
You've heard about PHP namespaces by now. Most likely, you've heard about -- and likely participated in -- the bikeshedding surrounding the selection of the namespace separator. Regardless of your thoughts on the namespace separator, or how namespaces may or may not work in other languages, I submit to you several reasons for why I think namespaces in PHP are a positive addition to the language.
He breaks down his reasons into four different categories - the code organization benefits that come with namespace "containers", simplified interface structure, improved readability (no more huge class names) and a simpler method for identifying dependencies
voice your opinion now!
namespace opinion organization interface readability dependencies
Shawn Stratton's Blog: Code Readability, Part 1
by Chris Cornutt January 13, 2009 @ 10:20:28
Shawn Stratton has posted the first part of his series looking at "Code Readability". This part focuses on something that is often woefully forgotten by many developers - proper code commenting.
The simplicity of PHP can sometimes be overwhelming, with so many different ways and approaches to creating solutions for our problems we sometimes lose the ability to think past the current problem and into the future. [...] Today I'm going to try to address some quick ideas that most of you will already be familiar with, things that will aide in the general readability of code for future generations.
He looks at the difference between useful and non-useful comments: DocBlocks, putting them near decisions, listing array parameters, recording TODOs and how it can all help you generate API documentation quickly and easily.
voice your opinion now!
readability docblock comment useful series
|
Community Events
Don't see your event here? Let us know!
|