The Artima Developer Community
Sponsored Link

Weblogs Forum
What is good code?

35 replies on 3 pages. Most recent reply: Mar 30, 2005 8:09 PM by Scott Bockelman

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 35 replies on 3 pages [ « | 1 2 3 ]
Dan Perl

Posts: 28
Nickname: nanov
Registered: Sep, 2004

Re: What is good code? Posted: Mar 2, 2005 6:14 AM
Reply to this message Reply
Advertisement
> [...] I realized that there
> were some things that must not be compromised. Honor and
> professionalism in the practice of software craftsmanship
> is one of them.

If you put it that way, I agree that there are values that should not be compromised. It's no excuse to do something unethical or unprofessional, for instance, even if the customer requests it.

It is also your choice whether you want to be a short order cook or a gourmet chef, even if both professions are about making food for paying customers.

Now, I like this analogy so much that I will keep using it (What is good food?). I agree with you that if I end up working in a cheap diner I will do my best to make the best burgers I can make. I will definitely not compromise on keeping a clean kitchen and on buying only fresh meat. However, I will not insist on making fillet mignon just because it's better than burgers and because it's the best food I can make. Customers expect cheap burgers, not fillet mignon.

Dan Perl

Posts: 28
Nickname: nanov
Registered: Sep, 2004

Re: What is good code? Posted: Mar 2, 2005 6:48 AM
Reply to this message Reply
> Now, I like this analogy so much that I will keep using it
> (What is good food?). I agree with you that if I
> end up working in a cheap diner I will do my best to make
> the best burgers I can make. I will definitely not
> compromise on keeping a clean kitchen and on buying only
> fresh meat. However, I will not insist on making fillet
> mignon just because it's better than burgers and because
> it's the best food I can make. Customers expect cheap
> burgers, not fillet mignon.

I'm following up on my own posting and I continue to use the short order cook analogy because I thought of a comment that is more meaningful to our main topic.

Burgers are not healthy because they are full of cholesterol (the bad kind). I will not insist on cooking tofu burgers or only salads because I believe only in healthy food. It is up to the customers to make their own choices. In other words, the values of the customers come first. I will keep the meat fresh so no customer will get food poisoning, even if my customers will slowly get fat and unhealthy anyway.

So yes, there are values that I will not compromise on but there are also values that are there to be compromised because the decision is with the customers.

Getting back to our main subject (What is good code?). If the customers require a product to be delivered right now even if it's going to be more expensive to deliver future releases of the product, I believe that this is one of those decisions that lie with the customer. My "craftsmanship" is a personal value that I will feel bad compromising, but it comes in second.

Isaac Gouy

Posts: 527
Nickname: igouy
Registered: Jul, 2003

Re: What is good code? Posted: Mar 2, 2005 7:12 AM
Reply to this message Reply
> > Eventually, the guy trying harder will surpass the one
> > who isn't putting forth the effort.
> Maybe, maybe not.

Indeed. We know there are huge differences in ability between individual programmers.


> In short, if you have people who aren't pulling to their
> full ability then you (or whoever's managing them) should
> be finding out why, rather than writing them off. But
> that's a whole new thread.

If you have people who aren't pulling to their full ability and always produce code of the highest quality - maybe we'd try and get the others up to their standard.

Anyway - "Motivation Management" Thad Green.

Kirk Knoernschild

Posts: 46
Nickname: kirkk
Registered: Feb, 2004

Re: What is good code? Posted: Mar 2, 2005 6:54 PM
Reply to this message Reply
>>I'm following up on my own posting and I continue to use the
>>short order cook analogy because I thought of a comment that
>>is more meaningful to our main topic.

Given your food analogy, you might find the following by Joel Spolsky interesting:

http://www.joelonsoftware.com/articles/fog0000000024.html

Derek Parnell

Posts: 22
Nickname: derekp
Registered: Feb, 2005

Re: What is good code? Posted: Mar 14, 2005 10:37 PM
Reply to this message Reply

> What exactly is quality code? ... is the best
> code software that:
>
> * can adapt to change
> * performs well
> * is error free
> * is as simple as possible
> * does what my customer needs
>
> At the end of the day, if I've missed the mark on any
> of these, I've failed.


You may well be correct with this list.

I also like to think that good code is that which reduces the cost of things. Cost to the purchaser of the code, cost to the developer of the code, and cost to the community which is effected by the code.

From the purchaser's point of view, the code needs to do (only) what they asked for and is affordable to repair and enhance.

From the developer's point of view, the code needs to be cost-effective to create, repair, and enhance.

From the community's point of view, the use of the code must not burden them more than not using the code. This aspect includes the user interface, but also includes such things as the environment. However, this can encroach on ethics and culture, which is always a minefield and needs careful consideration.

Scott Bockelman

Posts: 7
Nickname: mafjgbs
Registered: Feb, 2003

Re: What is good code? Posted: Mar 30, 2005 8:09 PM
Reply to this message Reply
Good code is code you wouldn't mind...

- maintaining
- enhancing
- having someone know (or believe) is your own creation

Bad code is code that you...

- dread having to change
- cannot understand
- are embarassed to have your name on any of the CVS commits

The quality of the code is NOT the same as the quality of the product or the value of the product, a point often missed and blurred even within these posts.

I believe the measurement of quality is quite subjective, but there are certainly "best practices" and programmers with more and varied experience eventually adopt these one way or another.

Years in the profession do not always amount to experience, especially variety of experience, so you will often find the hardened solo guy whose code is a nightmare, but who would become indignant at the very notion that this could be so. In those cases, lead by example, value the person over the artifacts, and simply do your best to remember the difference between the code and the coder.

Best Practices develop almost in the same way as Patterns; they tend to be reactive solutions to problems previously encountered. As such, the goals of such practices reflect the goals of experienced, sometimes bored, developers. Thus, you find that many practices are aimed at reducing rework, complexity, even novelty, in some cases. These goals are not immediately relevant to novices or eager young developers, who can get very excited when "it works".

I encourage all developers to strive to gain a variety of experiences (working alone, in a small team, in a large team, working on short-term prpjects, long-term projects, on-offs, products, etc.) in a variety of roles using different languages and development tools. I also recommend that all developers keep an open mind about their own creations; fear not the refactoring! And finally, seek the opinions of others regarding these topics; standing on the shoulders of giants...

Flat View: This topic has 35 replies on 3 pages [ « | 1  2  3 ]
Topic: The Vanishing Middle Previous Topic   Next Topic Topic: Hygenic versus Unhygenic macros in Heron

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use