Hacker News new | ask | show | jobs
No, You are not Dumb. Programmers do spend a lot of time Understanding Code… (blog.architexa.com)
7 points by abhirakshit 5882 days ago
2 comments

Part of the problem is how much "infrastructure" you need to learn too. What I like about Python is that a lot of the infrastructure is common and so all Python coders know it. In C and C++ every team seems to use a different set of tools, libraries and debug macros which makes it harder to dive into a project quickly.

On another note: is there any decent open source code study tool? I only know of Source Navigator but it always felt bloated to me and the UI was always quite tedious.

I agree that the current code study tools are hard to use and we need something more intuitive. Many tools show too much information and are hard to learn. Is this what you meant when you said that the UI was tedious and bloated?
It seemed to take too many clicks and concentration to do the common things. I'd like to be able to browse through source without the navigator getting in the way, and it felt like I was fighting the UI all the time. The use of a strange GUI toolkit (Tk?) didn't help. I don't mind learning a few keystrokes if it means that I can do the basic things like navigating the call graph without taking my eyes off the code.
Yeah, developers on Open Source projects often don't spend as much time on Design or UI Polish.
What would you want in a code study tool?
There is some academic work on the topic. Watch our blog - I am going to tease out some of the highlights.
Making your code open source is also a great way to make sure your code is easy to understand.
Some open source code is shockingly bad and difficult to understand. Some is rather good and a joy to work in (eg: Samba). I'm not sure the open source -ness makes a difference. Perhaps it is just that the successful open source projects that you've heard about or seen have easy to understand code, and that is the reason for their success (sampling bias)?
That's a good point. Bad code can definitely appear anywhere. I like to think that open source motivates good practices, like abhirakshit said, but I have no statistics to back up that belief.

This would be a very interesting research topic though. If I had more time, I'd attempt it. Anyone else know of such research, or want to try it? ;-)

Although there are open source projects which are quite bad, I still think being open source does motivate one to write better code. Regardless, having tools at your disposal to quickly understand/ document code for yourself and maybe relay your ideas to others can be really helpful.
Having anyone review your code is a good way to make sure it is easy to understand.
Very true. I didn't mean open source is the only way.

Code reviews, extreme/paired programming, personal discipline, and lots of experience on development teams are also great ways. I'm sure there are others too.

These all are very good points but well written code is not easy to find and tools which help one to quickly understand code become really important in such cases.
In my experience, I've found that processes that influence the desired behavior (through the use of incentives) have been more effective than tools. But I'm certainly no expert and am always looking for better ways to do things.

Have you used any tools that you've found to encourage well written code? I'd really love to give them a try.

I agree to your point that that we need to write more understandable code(whatever the influences may be). By tools I meant some application which would help me understand already available code (well written or otherwise). Something which would quickly let me jump into the code and start working even when I do not have any background information about the code base.
Please expand?
Most good programmers I know have some measure of Larry Wall's three great virtues: laziness, impatience, and hubris.[1]

Hubris is defined by Larry as:

"Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won’t want to say bad things about. Hence, the third great virtue of a programmer."

When your code is open source, anyone can see it. A prideful programmer isn't going to want to hear others badmouthing his/her code. Thus, the hubris this open source programmer feels will compel him/her to write code that is easy to understand and easy to maintain.

At least, hopefully :-)

[1] http://en.wikipedia.org/wiki/Larry_Wall#Virtues_of_a_program...

In an ideal world the tools programmers use would enable them to write easily understandable/maintainable code; no matter what their virtues are. The best tools should take these traits into account.
> In an ideal world the tools programmers use would enable them to write easily understandable/maintainable code;

Yes. And you chose the right word "enable". Your tools can make it easier to write good code, but you still have to put in the effort.

I suppose the same effect would happen in a organization, perhaps even more because the ones reviewing have power over you...