The Artima Developer Community
Sponsored Link

Weblogs Forum
Why Your Code Sucks

21 replies on 2 pages. Most recent reply: May 17, 2012 10:07 AM by elaine morrison

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 21 replies on 2 pages [ « | 1 2 ]
Chris Dailey

Posts: 0
Nickname: mouse
Registered: Dec, 2002

Re: Why Your Code Sucks Posted: Oct 12, 2004 6:30 PM
Reply to this message Reply
If you put the behaviour where it belongs you won't need nearly as many getters/setters.

A friend of mine goes to a writing class. At one point, the teacher showed the class a paragraph that had problems, and went through how to fix it. My friend wrote:

Just looking at a well-written paragraph doesn't necessarily teach me anything- I want to see what not to do. By the same token, showing me something bad and not telling me *how* it could be improved is useless.

On her first point ... I think there is a lot of focus on showing how to do things right as opposed to fixing problematic designs and implementations. AntiPatterns tend to try to teach this, but the books tend to be boring (a catalog as opposed to a tutorial) or painful to read (I've seen this train wreck, and this one, etc., too depressing).

On her second point ... At one job, I was in a relatively senior position, and I was able to point out deficiencies and actually have something done about them. One coworker noted that I was able to point out problems, but not the solutions. I had hoped that bringing up the problems would lead us all to talk about them and find solutions together, but the solutions didn't always come and coworkers would sometimes get frustrated.

Bill de hÓra

Posts: 0
Nickname: dehora
Registered: May, 2003

Re: Why Your Code Sucks Posted: Jan 1, 2005 5:08 AM
Reply to this message Reply
> I don't accept that as an excuse anymore.. with tools like
> Eclipse & IDEA. They can find references to the vars..
> and often even do the switch to a getter/setter for you.

Sure, but you have to assume the only callers are within the scope of your IDE. I see this assumption break from time to time once the code escapes outside a modern IDE. If you've already released code, a versioning policy needs to be taken into account (we've got a versioning policy, right...? ;)

> "Getter/setter methods often make their way in code
> because the coder was thinking procedurally. The best way
> to break out of that procedural mindset is to think in
> terms of a conversation between objects that have
> well-defined responsibilities."

> What's needed is a solid understanding of OO. I'm
> constantly amazed that, after 37 years, that's still
> mostly absent!

I liked Holub's article (though he's gotten a lot of flack for that viewpoint) Ok... so you mentioned really good OO code elsewhere in this thread. Can you point to 1) a really good reference and 2) some really good OO code for people to study?

Cedric Beust

Posts: 0
Nickname: cbeust
Registered: Feb, 2004

Re: Why Your Code Sucks Posted: Feb 27, 2006 9:55 AM
Reply to this message Reply
> Alan Holub had a great article in JavaWorld a while ago
> (
> box.html) that discussed this. Here are a couple of
> significant quotes:

Certainly not a great article, here is why:


Miguel de Sousa

Posts: 1
Nickname: miguels
Registered: Sep, 2007

Re: Why Your Code Sucks Posted: Sep 4, 2007 8:19 AM
Reply to this message Reply
how can one test his code?i can't understand! Please help me :)

Gopi Reddy

Posts: 1
Nickname: gz
Registered: Jan, 2008

The code I inherited sucks... Posted: Jan 2, 2008 9:48 PM
Reply to this message Reply
It's always easy to blame others' code but in many cases, like in mine, we are also forced to continue the trend and write more bad code. The code we inherited uses interfaces indiscriminately in the name of facilitating unit testing, not just to model "can do" relationships. The code does use the spring framework but I have an issue with any framework that makes static analysis (incl. reading) harder. My major complaint is that every other line forces me to pause and wonder which object's method is going to be invoked next.

bug not

Posts: 16
Nickname: bugmenot2
Registered: May, 2005

Re: Why Your Code Sucks Posted: Sep 10, 2009 4:42 AM
Reply to this message Reply
OH SHI~! My code sux!

elaine morrison

Posts: 1
Nickname: elainemorr
Registered: May, 2012

Re: Why Your Code Sucks Posted: May 17, 2012 10:07 AM
Reply to this message Reply
Although this article is old, why didn't the writer/editor/SOMEONE run the language (even copy and paste onto any computer textedit) through spellcheck?

Flat View: This topic has 21 replies on 2 pages [ « | 1  2 ]
Topic: The Management Myth Previous Topic   Next Topic Topic: Revisiting: Why salary bonus and other incentives fail to meet their object

Sponsored Links


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