• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What attributes make programming code 'good'?

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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.
Regards
Bikash
[ November 26, 2003: Message edited by: Bikash Paul ]
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Patterns are the key to good java.
see:
http://www.javaworld.com/columns/jw-java-design-patterns-index.shtml
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic