3 ms·
Making your code open source is also a great way to make sure your code is easy to understand.
by mikeleeorg 16y ago
Making your code open source is also a great way to make sure your code is easy to understand.
- swah 16y agoPlease expand?
- mikeleeorg 16y agoMost 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_programmer http://en.wikipedia.org/wiki/Larry_Wall#Virtues_of_a_program...
- swah 16y agoI suppose the same effect would happen in a organization, perhaps even more because the ones reviewing have power over you...
- sethrq 16y agoIn 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.
- eru 16y ago> 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.
- jared314 16y agoHaving anyone review your code is a good way to make sure it is easy to understand.
- mikeleeorg 16y agoVery 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.
- abhirakshit 16y agoThese 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.
- mikeleeorg 16y agoIn 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.
- abhirakshit 16y agoI 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.
- mikeleeorg 16y agoDoes something like JavaDoc, PHPDoc, JSDoc help? That would be an awesome tool though. Sounds like a great startup idea if someone can figure out how to build something like that :-)
- rlpb 16y agoSome 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)?
- abhirakshit 16y agoAlthough 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.
- mikeleeorg 16y agoThat'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? ;-)