Click here to Skip to main content
15,891,473 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



 
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 
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 
GeneralRe: well written code doesn't need explanation Pin
AlexCode14-Apr-14 20:04
professionalAlexCode14-Apr-14 20:04 
GeneralRe: well written code doesn't need explanation Pin
snorkie15-Apr-14 3:59
professionalsnorkie15-Apr-14 3:59 
GeneralRe: well written code doesn't need explanation Pin
AlexCode19-Apr-14 9:56
professionalAlexCode19-Apr-14 9:56 
I agree with you in the sense that we should always comment.
The thing I don't agree is the comments inside the methods.

Comment the classes describing the purpose of it. You can go crazy here and detail everything that this class is meant to do.
Comment the methods when the name is not self explanatory.

Now, after this, if you feel the complexity of a method is such that it needs inner explanation maybe it's time for a refactoring. Most likely that method is doing a lot of stuff and if you think about making some unit tests on it you won't be able to test a single thing but a whole complex behavior.

Usually the argument for not doing this is that you'll end up with several methods that are only called once...
Ok, I agree, it's not pretty but it's testable and very easy to maintain.

It's the difference between that new guy in the team facing a very complex method with 250 lines of code or the same thing split between 10 methods of 25 lines each.
Or between an IF with 2 ELSE conditions, each with 20 lines of code or each calling a different function.

What I'm saying here is that if we split the code it will be much easier to read making it redundant to comment.

P.S.: This is a guide line not a religion. Keeping this in mind will hopefully put you somewhere in between Smile | :)

Cheers!!
GeneralDidn't think was about commenting Pin
CHill6013-Apr-14 22:02
mveCHill6013-Apr-14 22:02 
GeneralCode with Syntax colors Pin
Sampath Lokuge13-Apr-14 21:58
Sampath Lokuge13-Apr-14 21:58 
GeneralCode does not lie... PinPopular
Sander Rossel13-Apr-14 21:06
professionalSander Rossel13-Apr-14 21:06 
GeneralRe: Code does not lie... Pin
Marco Bertschi13-Apr-14 21:47
protectorMarco Bertschi13-Apr-14 21:47 
GeneralRe: Code does not lie... Pin
Kevin McFarlane14-Apr-14 6:33
Kevin McFarlane14-Apr-14 6:33 
GeneralDepends on the author. Pin
OriginalGriff13-Apr-14 21:05
mveOriginalGriff13-Apr-14 21:05 
GeneralText Pin
Mohamad M. Mohamad13-Apr-14 21:04
Mohamad M. Mohamad13-Apr-14 21:04 
GeneralSilly question... Pin
Mehdi Gholam13-Apr-14 20:19
Mehdi Gholam13-Apr-14 20:19 
GeneralTechnical person always like to read code first. Pin
koolprasad200313-Apr-14 20:16
professionalkoolprasad200313-Apr-14 20:16 
GeneralRe: Technical person always like to read code first. Pin
DJ van Wyk13-Apr-14 20:41
professionalDJ van Wyk13-Apr-14 20:41 
GeneralRe: Technical person always like to read code first. Pin
Manoj Kumar Choubey14-Apr-14 1:18
professionalManoj Kumar Choubey14-Apr-14 1:18 
GeneralWhat does textual "description of the code" contains ? Pin
Davide Zaccanti13-Apr-14 19:40
Davide Zaccanti13-Apr-14 19:40 
GeneralRe: What does textual "description of the code" contains ? Pin
Peter Leow13-Apr-14 19:59
professionalPeter Leow13-Apr-14 19:59 
GeneralLike this? Pin
thatraja13-Apr-14 21:06
professionalthatraja13-Apr-14 21:06 

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.