The moose likes Java in General and the fly likes What attributes make programming code 'good'? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What attributes make programming code Watch "What attributes make programming code New topic

What attributes make programming code 'good'?

Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
I got Two below questions in interview :
1. What attributes make programming code 'good'?
2. What would you change about Java if you alone had the ability to improve it in any way?
Can any one plz guide me what will be the exact answer.
[ November 26, 2003: Message edited by: Bikash Paul ]
James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190
Patterns are the key to good java.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Patterns are nothing if the code is unreadable.
Patterns are worse than nothing if abused or otherwise used incorrectly.
Good code is self-documenting. It should be a pleasure to read, easy to understand for someone who knows the language and has some knowledge of what the program is meant to do.
THAT is good code, not code that slavishly follows a set of standardised practices just because they're the standard!

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Good code is
- easy to understand
- robust; if you change one part, other parts don't break surprisingly
- moveable; it's easy to exchange and/or reuse small parts of it
- supple; it makes it easy to do things the right way
"Agile Software Development - Principles, Patterns and Practices" by Robert Martin is a very good book on the topic.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Bikash Paul:
2. What would you change about Java if you alone had the ability to improve it in any way?

I would pay more attention to bug reports than Sun does.
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
I wouldn't discount the value of a small set of metrics also. In particular:
(1) Methods should be small to make the readable, maintainable, and probably more reusable.
(2) Classes should be small for nearly the same reasons.
(3) Watch the number of method parameters on any method closely.
(4) Be wary of very deep inheritance hierarchies. Also be wary of no inheritance at all in an entire program.
I generally keep an eye out for those in my code reviews and use these metrics (which Kent Beck would call "Code Smells") as a guide to understand what should be refactored.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: What attributes make programming code 'good'?
jQuery in Action, 3rd edition