7 Replies - 5177 Views - Last Post: 11 May 2010 - 09:53 AM

#1 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Time Spent Understanding Code

Post icon  Posted 06 May 2010 - 09:08 PM

*
POPULAR

I came across this post through Dzone.

Great read. I find I spend more time reading then writing. If I may extend this argument, this concept applies to all code-bases, APIs, and libraries, even if you have no hand in writing it.

The article is a clear illustration of why the following are important:

  • self documenting code
  • comments (the why, not the how)
  • modularity
  • code readability


What do you all think?


Abstract:

While working on a codebase, developers spend a lot of time understanding code. We might be unwilling to admit it for fear of sounding dumb but the huge amount of time spent on making sense of code is staggering.


Is This A Good Question/Topic? 6
  • +

Replies To: Time Spent Understanding Code

#2 KingCuddles  Icon User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: Time Spent Understanding Code

Posted 07 May 2010 - 01:55 AM

A very valid, and well written blog, although it is not the first I have read on the topic, it is by far the best.

As some one who is fairly new to programming I know how annoying it can be understanding new code, especially when dealing with new concepts, or different ways of doing things, my nemesis is OO, I struggle to hell trying to understand most OO written scripts so I totally get how much time can be spent working out what does what before you can actually fix problems or add new features.

Thanks KYA
Was This Post Helpful? 0
  • +
  • -

#3 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Time Spent Understanding Code

Posted 07 May 2010 - 08:08 AM

It was brought to my attention via twitter that the article does not cover testing as a means of code discovery/comprehension. Throwing a module/function some test data and observing the output is a very good way to "wrap one's head" around some code. Especially if you conjure a hypothesis before hand based on earlier study of the code in question. Hey, we're computer scientists!

I felt the article let the reader determine which methods of comprehension were best for them, hence the lack of explicit methodology on how to accomplish the task.
Was This Post Helpful? 0
  • +
  • -

#4 xTorvos  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 61
  • View blog
  • Posts: 271
  • Joined: 23-October 09

Re: Time Spent Understanding Code

Posted 07 May 2010 - 09:23 AM

I find myself chuckling as I read sentences like this . . .

Quote

Another study in 1997 at the National Research Council in Canada lead by Singer et al. found developers spending over 25% of their time either searching for or looking at code.


Coders looking at code?! What an amazing concept! :)
Was This Post Helpful? 1
  • +
  • -

#5 Topher84  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 113
  • View blog
  • Posts: 359
  • Joined: 04-June 07

Re: Time Spent Understanding Code

Posted 07 May 2010 - 09:34 AM

If the correct documentation was being done, there should be no need to look at the code that long. Especially if the UML exists. The relationships, methods, and attributes should all be clearly laid out. It would appear from the article (and to no surprise) that Microsoft has no documentation.
Was This Post Helpful? 0
  • +
  • -

#6 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2651
  • View blog
  • Posts: 15,673
  • Joined: 24-September 08

Re: Time Spent Understanding Code

Posted 09 May 2010 - 05:21 PM

Didn't read it, but I must say that I spend more time researching methods and API's than actually coding. That's why I tried to do my Class of the Month thing, but never got it launched (too busy). D:
Was This Post Helpful? 0
  • +
  • -

#7 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Re: Time Spent Understanding Code

Posted 09 May 2010 - 07:46 PM

UML Diagrams should theorecticaly be helpful, from my experience a lot of time is spent understanding code. But I wonder if a plugin for VS or other editors that would create UML Diagrams of your project is plausible?
Was This Post Helpful? 0
  • +
  • -

#8 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1954
  • View blog
  • Posts: 4,053
  • Joined: 11-December 07

Re: Time Spent Understanding Code

Posted 11 May 2010 - 09:53 AM

I imagine that would often end up with a lot of arrows all over the place. Even if a project starts with a nice clean design, deadlines and quick fixes can erode that.

Though I would find something like that useful in Eclipse, if only to make sure my packages are actually talking to each other in the way I intended!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1