This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about programming style

 
Greg Ferguson
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When creating a gui application or an applet, is there a standard about the best way to set up the code? For example, is it better to layout the code like this?

or like this:
 
Gaurangkumar Khalasi
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know about the standard but prefer this one...

Buenny Fry wrote:
 
dennis deems
Ranch Hand
Posts: 808
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can think of good reasons to prefer either. I'm not aware of a standard though. The important thing is to be consistent.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer the solution that uses a proper layout manager
 
Jordan D. Williams
Ranch Hand
Posts: 51
Android Eclipse IDE Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:I prefer the solution that uses a proper layout manager


What do you mean by that? (A beginner Java guy here...)

Thank you.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html
 
Greg Ferguson
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies. I wasn't sure if there was a standard, but I definitely agree about being consistent with whichever style is chosen. And thanks for that informative link Rob. I've already run into how complex using layout managers can be -- especially when you start combining them -- but that site helped me understand them better.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic