views:

186

answers:

4

I have noticed when people post example code illustrating some issue that they are having often they will gather a number of comments addressing the quality of the code they presented and not the actual problem asked. This is very helpful--if not well directed. Often, this is wasted effort since the asker is not receptive and the code is regularly chopped down to something small to post leaving lots of rough edges.

In the old days you would see people asking questions like this on comp.lang.lisp and other parts of the comp.lang hierarchy. But that bit of the net kind of sank into the sewers of neglect. Is there a comparable one-stop-shop today?

I am partially asking for selfish reasons, I know how to write good idiomatic C, Lisp, O'Caml, and Java code. But I learned C++ pre-template and STL, those rusty skills are not really applicable to today's C++. I have picked up languages like Scala in a vacuum and get by, but am I really doing it correctly?

There are so many ways you can abuse a language, I am currently working against a codebase of Fortran written in C, and I recognize and loathe the "that guy" who wrote it. I don't want to be someone else's "that guy" if I can help it. Just because it works does not mean that one did not totally miss the boat on how it should have been done.

Do you seek out this type of critique? If so how, where and why? What types of benefits do you derive from it? How about abuse and trolls?

Edit: Removed atrocious overuse of the word often, that is what I get for jumping back between compiles ;-)

+11  A: 

How about http://refactormycode.com/ ?

nc3b
Nice link......
Justin Ethier
+1 Damn!!! How am I only seeing this site now!!!!!!!!!!!!!!
David Relihan
I found about it on SO :-)
nc3b
Is it only to me that the site seems reeeeeeeeeally slow?
devoured elysium
The performance of this site is bad for me; I'm in WI
eschneider
+4  A: 

You could always try posting the code here, as long as you make it clear that the intent of the question is for people to analyze the style and quality of your code.

As I type that, I realize that perhaps meta would probably be a better place to discuss this...

Justin Ethier
+1  A: 

http://govnokod.ru/ shows a lot of examples of really bad code, which in many ways is as helpful as great code. IMO we all learn from both the good and the bad in life and in work...

There also site like

I personally find most helpful discussing a snippet of code shared somewhere live in some of the programming IRC channels in freenode.

Bozhidar Batsov
+1  A: 

Well, these days you cannot post anything in comp.lang.javascript without being bashed to death ;-)

I also follow the Python groups -- where programming style and the use of idiomatic forms helps a lot in writing cleaner and faster code.

Likewise, in comp.databases, any suggestion of reworking one's queries or schemas should be given due weight, people there know the kind of problems I'll have when my data grows 1000x.

I appreciate this type of critique but also take it with a grain of salt -- after all I am the only one to know all of the constraints under which my software is being built... and very often, a UI expert or a DBA is not aware of the kind of problems there may be at the other end of the spectrum.

Marco Mariani
and for examples of the worst code in the world, there's www.thedailywtf.com
Marco Mariani
www.thedailywtf.com rocks!
nc3b
I forgot about thedailywtf.com but I have to admit that I think it has gone down hill. There are too many petty examples of late, but they have to work with what the get so I cannot really fault them.
Ukko
As to the bashing, in the old days people some people used to provide access to their kill files to help people totally avoid the abrasive side of the group. It is hard but so helpful to be able to separate your ego from this sort of discussion.
Ukko