Click here to Skip to main content
15,914,924 members

Survey Results

What's easier to read: Code or Text?

Survey period: 14 Apr 2014 to 21 Apr 2014

Given a code sample and an accurate well-written textual description of the code, what's easier for you to read?

OptionVotes% 
Code57128.14
Depends on the code and the text1,30264.17
Text1587.79



 
GeneralRe: Text lies Pin
mikepwilson15-Apr-14 3:52
mikepwilson15-Apr-14 3:52 
GeneralCode lies to. Pin
CPallini15-Apr-14 21:31
mveCPallini15-Apr-14 21:31 
GeneralDocumentation Pin
PIEBALDconsult14-Apr-14 4:02
mvePIEBALDconsult14-Apr-14 4:02 
GeneralRe: Documentation Pin
kalberts15-Apr-14 1:15
kalberts15-Apr-14 1:15 
GeneralIs there a difference? Pin
lucanor14-Apr-14 0:39
lucanor14-Apr-14 0:39 
GeneralSome system code is inherently not intuitive .. Pin
AndersonChau13-Apr-14 23:49
AndersonChau13-Apr-14 23:49 
GeneralRead? Pin
Duncan Edwards Jones13-Apr-14 23:23
professionalDuncan Edwards Jones13-Apr-14 23:23 
GeneralThese surveys are getting very poor Pin
musefan13-Apr-14 23:22
musefan13-Apr-14 23:22 
GeneralRe: These surveys are getting very poor Pin
Dan Neely14-Apr-14 3:36
Dan Neely14-Apr-14 3:36 
GeneralRe: These surveys are getting very poor Pin
Gary Wheeler14-Apr-14 4:55
Gary Wheeler14-Apr-14 4:55 
GeneralRe: These surveys are getting very poor Pin
musefan14-Apr-14 23:58
musefan14-Apr-14 23:58 
GeneralRe: These surveys are getting very poor Pin
David Cunningham15-Apr-14 7:40
cofounderDavid Cunningham15-Apr-14 7:40 
GeneralRe: These surveys are getting very poor Pin
Paul M Watt15-Apr-14 13:16
mentorPaul M Watt15-Apr-14 13:16 
GeneralText is always easier to read Pin
sellinger13-Apr-14 23:15
sellinger13-Apr-14 23:15 
GeneralRe: Text is always easier to read Pin
musefan13-Apr-14 23:31
musefan13-Apr-14 23:31 
GeneralRe: Text is always easier to read Pin
AlexCode14-Apr-14 1:22
professionalAlexCode14-Apr-14 1:22 
GeneralRe: Text is always easier to read Pin
kalberts15-Apr-14 1:24
kalberts15-Apr-14 1:24 
GeneralRe: Text is always easier to read Pin
Jorge Lalinde15-Apr-14 3:14
Jorge Lalinde15-Apr-14 3:14 
GeneralRe: Text is always easier to read Pin
Rob Grainger16-Apr-14 5:06
Rob Grainger16-Apr-14 5:06 
GeneralRe: Text is always easier to read Pin
Rob Grainger16-Apr-14 22:12
Rob Grainger16-Apr-14 22:12 
Generalwell written code doesn't need explanation Pin
AlexCode13-Apr-14 22:20
professionalAlexCode13-Apr-14 22:20 
GeneralRe: well written code doesn't need explanation Pin
Kevin McFarlane14-Apr-14 4:12
Kevin McFarlane14-Apr-14 4:12 
AlexCode wrote:
I like commenting my methods and classes but no comments are usually found inside methods.


My philosophy too. Occasionally, I do have inline comments (usually of the why variety) but my ideal is to have none.

AlexCode wrote:
All names should be self-explanatory.

Fix/avoid typos in your names.

Use camel-case to separate words in your names.


Yep.


AlexCode wrote:
A method comment is one line long.

If it takes too much time (or text) to explain, chances are the complexity is too high and it's time to Refactor!


Yes. An XML summary comment, say, should just be one line. Put anything else in the remarks section.


AlexCode wrote:
No comments inside methods.

Code inside methods should be simple enough to be easily readable.


Yep.

AlexCode wrote:
Avoid more than 3 indentations inside your methods.

If you're indenting too much, chances are you're doing too many things inside you're method. Refactor!


Yep. However, I use a dynamic code complexity tool (number displayed next to method as I type) as a guide and strive for cyclomatic complexity < 10. Indentation will then take care of itself, as complexity is likely to break this rule if indentation is too great.


AlexCode wrote:
Although it's a huge effort, too expensive and even useless to refactor an existing project, my approach is to refactor and write tests as I touch the code.

If there's a bug somewhere, I try to write some tests for the functionality, refactor and fix the code.

If you wrote your tests well, refactoring is much more relaxing because you're sure that is the tests pass you didn't break anything


That would be my approach. In the absence of unit tests on the project (which appears to be the norm in practice) then refactoring at least to the extent of extracting methods is generally safe enough. Sometimes, depending on the fix/extension required, you actually have to do this in order to make the change cleanly.
Kevin

GeneralRe: well written code doesn't need explanation Pin
Rob Grainger16-Apr-14 22:17
Rob Grainger16-Apr-14 22:17 
GeneralRe: well written code doesn't need explanation Pin
Kevin McFarlane16-Apr-14 23:53
Kevin McFarlane16-Apr-14 23:53 
GeneralRe: well written code doesn't need explanation Pin
snorkie14-Apr-14 7:24
professionalsnorkie14-Apr-14 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.