The Artima Developer Community
Sponsored Link

Weblogs Forum
Why Your Code Sucks

21 replies on 2 pages. Most recent reply: May 17, 2012 1:07 PM 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: 56
Nickname: mouse
Registered: Dec, 2002

Re: Why Your Code Sucks Posted: Oct 12, 2004 9:30 PM
Reply to this message Reply
Advertisement
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: 1127
Nickname: dehora
Registered: May, 2003

Re: Why Your Code Sucks Posted: Jan 1, 2005 8: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: 140
Nickname: cbeust
Registered: Feb, 2004

Re: Why Your Code Sucks Posted: Feb 27, 2006 12:55 PM
Reply to this message Reply
> Alan Holub had a great article in JavaWorld a while ago
> (http://www.javaworld.com/javawold/jw-09-2003/jw-0905-tool
> box.html) that discussed this. Here are a couple of
> significant quotes:

Certainly not a great article, here is why:

http://tinyurl.com/a6g43

--
Cedric

Miguel de Sousa

Posts: 1
Nickname: miguels
Registered: Sep, 2007

Re: Why Your Code Sucks Posted: Sep 4, 2007 11: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 3, 2008 12:48 AM
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 7: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 1:07 PM
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



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us