Ask Slashdot: What Makes Some Code Particularly Good?
itwbennett writes: When developers talk about what makes some source code particularly 'good,' a handful of qualities tend to get mentioned frequently (functional, readable, testable). What would you add to this list?
Doesn't every self important developer think that their own code is the best?
How many managers does it take to reach a decision to begin a study to determine whether a light bulb should be replaced?
I'll see your senator, and I'll raise you two judges.
Code needs to fail in an easy to understand and predictable way. If possible and practical provide descriptive and easy to follow details through logging or return values...
And say "thank you, my past self for making this so easy to understand and versatile!".
Good code feels obvious and self-evident, as though its design springs directly from the problem, rather than from the cleverness of the developer.
Good code is free of regret; regardless of how much it's been modified and refactored, it feels as though it was written in a single sitting, by a developer who somehow knew the right way to do it already.
Good code is not just readable, but inviting. It feels as though there is no wrong place to start reading it.
Good code doesn't have a single goddamn class named "Manager".
The opinions stated herein do not necessarily represent those of anybody at all. Deal with it.
That it works.
What makes an article a click whoring waste of time? I don't know, I didn't read past the first for 9 impression generating lazily written dreck, but being posted on slashdot is becoming a good indication.
It communicates clearly what it is trying to do.
It doesn't, actually. Looking at that as someone who doesn't know what a CRC32 is I have no idea why it's doing what it's doing. Some actual useful comments might be nice.
After 5 years you can still read it and understand what it was supposed to accomplish, and it does so.
I would definitely add "simple". Everybody can write complex code but it takes experience and great knowledge to be able to choose the best fit for the implementation. More experience and knowledge you have more options to choose from. Beginner will usually go with the first hunch that will get complex sooner or later as he will meet challenges he didn't expect...
So yeah, simple, readable, documented, functional, consistent...
Well, I've got to get back to work. When I stop rowing, the slave ship just goes in circles.
I am all over the place, I guess many programmers are.
Being a programmer is a trade in some parts, and you can get by with good craftsmanship.
In other parts it's a creative art, and you can't force creativity.
To write really good code, you need to both have the craftsmanship and the creativity.
"Total destruction the only solution" - Bob Marley
FACT: The PC to Server ratio is MILLIONS to 1 alone
This does not stand to even 5 ms of thinking. I am living in a country with 5 million people. You are claiming we have 5 servers or something like that.
Or if you are an american: How many cities do you have with more than 5 million people? How many cities with more than 5 servers? ...
Or ... there are about 7 billion people on the earth. Lets assume that each have a PC (many don't). You are claiming there are only 7000 servers on earth.
The door wings both ways though. Sometimes six-months-ago-me is a pretty cool guy.
Like that time I was searching for an answer to a problem on Stack Overflow. At first I thought "Ha, what a coincidence, the top rated answerer has the same name as me." It was not a coincidence... it was me.
I'm a good cook. I'm a fantastic eater. - Steven Brust