The Artima Developer Community
Sponsored Link

Weblogs Forum
Pardon My French, But This Code Is C.R.A.P.

61 replies on 5 pages. Most recent reply: Jul 20, 2007 6:03 AM by James Watson

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 61 replies on 5 pages [ « | 1 2 3 4 5 | » ]
Alex Fabijanic

Posts: 71
Nickname: aleksf
Registered: Aug, 2006

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 7:15 AM
Reply to this message Reply
Advertisement
> What do you think is the root cause of crap code?

I agree with Stroustrup's answer in the above mentioned interview:

"... the real problem is that "we" (that is, we software developers) are in a permanent state of emergency, grasping at straws to get our work done. We perform many minor miracles through trial and error, excessive use of brute force, and lots and lots of testing, but--so often--it's not enough."

I also agree with his solution to the problem:

" ... educate our software developers better, use more-appropriate design methods, and design for flexibility and for the long haul. Reward correct, solid, and safe systems. Punish sloppiness."

as well as his view on impossibility to solve it, given the current circumstances:

"In reality, that's impossible. People reward developers who deliver software that is cheap, buggy, and first. That's because people want fancy new gadgets now. They don't want inconvenience, don't want to learn new ways of interacting with their computers, don't want delays in delivery, and don't want to pay extra for quality (unless it's obvious up front--and often not even then). And without real changes in user behavior, software suppliers are unlikely to change."

So, as it turns out, in the end it is the user's fault we are making crappy code - you get what you paid for. It takes time, people and money to make good software. If the market was willing to bear the cost of good software, there would be plenty of it all over the place.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 8:43 AM
Reply to this message Reply
> I think the often-quoted "research" about differences in
> programmer productivity/effectiveness isn't really valid.
> What was actually measured? Was it based on production
> code, or a toy problem. Was maintenance, documentation,
> flexibility etc considered? In other words, you have to
> come up with a comprehensive definition of programmer
> "goodness" and measure it.

I often wonder if this is an intractable problem, at least for the time being. How can you measure how easy something is to maintain without having to maintain it first? And even with a maintenance history, you'd need a fairly large set of distinct projects that used similar methodologies to get a meaningful answer. I have never even seen a non-trivial production system that used one single methodology over a significant period of time. I just don't think we have the tools to analyze code with the required level of sophistication.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 8:50 AM
Reply to this message Reply
> > What do you think is the root cause of crap code?
>
> I agree with Stroustrup's answer in the above mentioned
> interview:
>
> "... the real problem is that "we" (that is, we software
> developers) are in a permanent state of emergency,
> grasping at straws to get our work done. We perform many
> minor miracles through trial and error, excessive use of
> brute force, and lots and lots of testing, but--so
> often--it's not enough."

I agree that that is why some developers (I call these good developers) sometimes create crap code but I don't think this is universally the reason. There are many people who don't see any value in good code. I can't count the number of times that I've read or heard statements that amount to "what difference does it make if it works?" and arguments about how all working solutions are equivalent. You can find them all over the Artima forums. There are many of these developers in our midst and they produce crap code at an astounding rate. The worst of these are primadonnas and contractors who never have to maintain the code they write.

nes

Posts: 137
Nickname: nn
Registered: Jul, 2004

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 9:12 AM
Reply to this message Reply
There is crappy code because there is crappy thinking. Good thinking requires practice and effort. In the same way that somebody might enjoy a game of Golf by Tiger Woods and cringe when seeing a rookie take 20 hits to get the ball in the hole, programmers enjoy good code and suffer the bad one. Businesses on the other hand usually don’t care much about the code. They don’t care how it is done, just how much the golfer gets paid and how long it takes him to get all to agree on where the hole is.

Alex Fabijanic

Posts: 71
Nickname: aleksf
Registered: Aug, 2006

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 9:16 AM
Reply to this message Reply
> There are many
> people who don't see any value in good code. I can't
> count the number of times that I've read or heard
> statements that amount to "what difference does it make if
> it works?" and arguments about how all working solutions
> are equivalent. You can find them all over the Artima
> forums. There are many of these developers in our midst
> and they produce crap code at an astounding rate. The
> worst of these are primadonnas and contractors who never
> have to maintain the code they write.

This really falls into ethics - a portion of any certification is (if not, it should be) dedicated to the ethics of the trade. While this can not enforce a morality of a certified person, it can at least make the defense of "I wasn't aware" type non-viable.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 9:26 AM
Reply to this message Reply
> > There are many
> > people who don't see any value in good code. I can't
> > count the number of times that I've read or heard
> > statements that amount to "what difference does it make
> if
> > it works?" and arguments about how all working
> solutions
> > are equivalent. You can find them all over the Artima
> > forums. There are many of these developers in our
> midst
> > and they produce crap code at an astounding rate. The
> > worst of these are primadonnas and contractors who
> never
> > have to maintain the code they write.
>
> This really falls into ethics - a portion of any
> certification is (if not, it should be) dedicated to the
> ethics of the trade. While this can not enforce a morality
> of a certified person, it can at least make the defense of
> "I wasn't aware" type non-viable.

But it's not necessarily that these people are unethical. They just don't see any value in 'good' code. Moreover they don't see what is good about good code.

I really don't see how good code can be certified. It's kind of like being a certified writer. Other than grammatical mistakes or use of things like passive voice, what non-subjective criteria can you use to gauge the quality of a piece of literature? If you don't think this is a valid analogy, could you explain in what way?

The one example of this that I can think of was the push for structured programming. It was very successful. So successful that we take it for granted as it's baked into modern languages. But we still have bad code.

It's easy to say we will certify programmers but how will that certification resolve this issue?

Personally, I think treating programming as a trade with apprentices, journeymen, and master developers would be more effective. The problem is that masters are few and far between.

Alex Fabijanic

Posts: 71
Nickname: aleksf
Registered: Aug, 2006

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 10:34 AM
Reply to this message Reply
> But it's not necessarily that these people are unethical.
> They just don't see any value in 'good' code. Moreover
> r they don't see what is good about good code.

Sure they are unethical. Just like littering the highway is unethical. Your neighbors have to live in a polluted world and someone has to come behind you to clean your mess while you don't see any value in being tidy? That is unethical.

> I really don't see how good code can be certified. It's
> kind of like being a certified writer. Other than
> grammatical mistakes or use of things like passive voice,
> what non-subjective criteria can you use to gauge the
> quality of a piece of literature? If you don't think this
> is a valid analogy, could you explain in what way?

There are multiple ways how the quality of code can be improved and certification is one that IMO should contribute to it. there are other ways, such as education, coding style standards etc...

Alex Fabijanic

Posts: 71
Nickname: aleksf
Registered: Aug, 2006

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 10:50 AM
Reply to this message Reply
> Let's look a this with less a
> human-as-center-of-the-universe point of view. If one
> wanted to understand basic truths about animal kingdom,
> would it make sense to ignore actual animal behavior or
> label it as "out of touch"?

We are out of touch as a society because we have become circus animals, rather than the ones living freely. Since the circus master dictates it (money makes the world go 'round) to us, we must have air-conditioned living rooms and hundreds of TV channels even if we can only watch one at a time (a Seinfeld says, we don't want to know what's on the TV, we want to know what else is on the TV) and even if it means ruining a building of historic value. The sad part is that the examples I gave above are benign - nearby the place I mentioned, about 30 years ago, someone decided to bulldoze ruins of an ancient Roman city in order to build a chemical plant. If that is not "out of touch" I don't know what is.

> If, in practice, architecture
> doesn't resonate with the majority of people living with
> it, it has failed its mission. It's essentially not
> fulfilling its customer requirements.

Yes, I definitely agree with that.

Bill Pyne

Posts: 165
Nickname: billpyne
Registered: Jan, 2007

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 10:53 AM
Reply to this message Reply
> I agree that that is why some developers (I call these
> good developers) sometimes create crap code but I don't
> think this is universally the reason. There are many
> people who don't see any value in good code. I can't
> count the number of times that I've read or heard
> statements that amount to "what difference does it make if
> it works?" and arguments about how all working solutions
> are equivalent. You can find them all over the Artima
> forums. There are many of these developers in our midst
> and they produce crap code at an astounding rate. The
> worst of these are primadonnas and contractors who never
> have to maintain the code they write.

Hey, watch the contractor comments! :-) (Actually, I'm in my last 2 days as a contractor. On 7/30 I go back in-house and am looking forward to it.) Although I agree that contractors tend to be mouse cowboys, there's plenty of crap code written on both sides of that divide.

It's more than just individuals though. Individuals write the code, true, but the mentality of 80% is good enough is social. I've heard of one large retailer who puts code into production when it meets 80% of the requirements. We accept everyday products not of the highest quality but at a cost we like. Does anyone buy their kitchen tables from a local woodworker anymore? Shoes from a cobbler? It seems like there's some sweet spot between cost and acceptable levels of shoddiness modern culture has tapped into. Tapping into this sweet spot is what allowed several software empires to form.

I'm playing "Devil's Advocate" here. Everytime I get stuck with indecphirable code I get upset too. My point is that it's not just our field. It's social and I don't have the foggiest idea how to change it.

Bill Pyne

Posts: 165
Nickname: billpyne
Registered: Jan, 2007

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 10:57 AM
Reply to this message Reply
> Personally, I think treating programming as a trade with
> apprentices, journeymen, and master developers would be
> more effective. The problem is that masters are few and
> far between.

Wasn't there a book written by Peter McBreen about this?

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 11:03 AM
Reply to this message Reply
> Sure they are unethical. Just like littering the highway
> is unethical. Your neighbors have to live in a polluted
> world and someone has to come behind you to clean your
> mess while you don't see any value in being tidy? That is
> unethical.

It's only unethical if you know that what you are doing is wrong. Personally I think that this is the majority of the problem. There are probably a good portion who realize it but rationalize it but I believe that most developers, once they understand the cost, will clean up their act, if you'll forgive the pun.

> There are multiple ways how the quality of code can be
> improved and certification is one that IMO should
> contribute to it. there are other ways, such as education,
> coding style standards etc...

I'm not against certification. I'm just not sure it will resolve all code quality issues. There are a lot of really adequate and even excellent developers that know exactly how to make things work but don't see any value in organization and making things easier for maintenance. They see this is as a waste of time that's driven by people with OCD.

Alex Fabijanic

Posts: 71
Nickname: aleksf
Registered: Aug, 2006

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 11:09 AM
Reply to this message Reply
> I'm playing "Devil's Advocate" here. Everytime I get stuck
> with indecphirable code I get upset too. My point is that
> it's not just our field. It's social and I don't have the
> foggiest idea how to change it.

As Lou Holtz said: If it's worth doing at all, it's worth doing well. Changing yourself is hard (but doable). Changing other people is impossible. So, the only thing anybody can do is change your ways if they are no good. That will influence the people around you.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 11:18 AM
Reply to this message Reply
> Hey, watch the contractor comments! :-) (Actually, I'm in
> my last 2 days as a contractor. On 7/30 I go back in-house
> and am looking forward to it.) Although I agree that
> contractors tend to be mouse cowboys, there's plenty of
> crap code written on both sides of that divide.

I don't want to paint with too broad of a brush but I've dealt with a lot of contractors who think their poop doesn't stink. But I've seen this attitude with anyone who doesn't have to work with existing code. Basically, my theory is that developers who think that maintaining code is easier than writing code from scratch are more likely to not get the value of well-written code.

> It's more than just individuals though. Individuals write
> the code, true, but the mentality of 80% is good enough is
> social. I've heard of one large retailer who puts code
> into production when it meets 80% of the requirements. We
> accept everyday products not of the highest quality but at
> a cost we like. Does anyone buy their kitchen tables from
> a local woodworker anymore?

Surprisingly, yes. Woodworking is a fairly lucrative venture. There's a lot of automation, though. I think you'd be hard pressed to find a professional workworker that doesn't have a lot of expensive power tools.

On a side note, my father was telling me something rather interesting about manufacturing. He was saying that right now, the cheapest place in the world for them to outsource machining is Italy. And the places that they are outsourcing to are mom-and-pop shops where the mother does the accounting and the father and son(s) do the machining. This is possible because of high level of automation they use.

Sue Kunz

Posts: 1
Nickname: suekunz
Registered: Jul, 2007

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 5:08 PM
Reply to this message Reply
Great blog, Alberto.
I had to blog about it:
http://www.solidw.com/blog/
Anxious to follow the dialog further.

Note, in a perfect world, I think crappy code should smell bad. It's would provide a real incentive to fix it. :-)
Sue

Alberto Savoia

Posts: 95
Nickname: agitator
Registered: Aug, 2004

Re: Pardon My French, But This Code Is C.R.A.P. Posted: Jul 19, 2007 5:24 PM
Reply to this message Reply
> Great blog, Alberto.
> I had to blog about it:
> http://www.solidw.com/blog/
> Anxious to follow the dialog further.


Hi Sue,

Thank you for the kind words and for the mention in your blog.


> Note, in a perfect world, I think crappy code should smell
> bad. It's would provide a real incentive to fix it. :-)
> Sue

Don't give me any ideas. I am semi-infamous for eXtreme Feedback methods.

Alberto

Flat View: This topic has 61 replies on 5 pages [ « | 1  2  3  4  5 | » ]
Topic: Pardon My French, But This Code Is C.R.A.P. Previous Topic   Next Topic Topic: The RIA Summit

Sponsored Links



Google
  Web Artima.com   

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