• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I use literals for the captions inside the source?

 
Zafer Abu saeed
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Is it too bad to insert the captions of the menus and buttons inside the source code?
Should I use a ResourceBundle to include the constant Strings that are used as captions for the menus and the window?
(ResourceBundle will help in future if the client GUI is to be localized..)

Those who passed the exam, did you used constants inside the source?

Please help. I cannot continue my work..
 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

I used lots of constants, and no data files of any kind (not even images for buttons). I got only 24 / 40 for the GUI, but 100 % for the rest (total 96 %).

Conan
 
Zafer Abu saeed
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one who passed the exam can help... please!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zafer,

I also used constants in my GUI, and in my design decisions document I clearly explained the various options I had considered, and why I had decided to go with the constants. I also explained how I had developed my GUI such that it would be easy to change from constants to resource bundles at a later date.

I did not loose marks for this.

Regards, Andrew
 
Zafer Abu saeed
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Conan and Andrew,

Unlike Andrew, I cannot explain why using constants could be better than
using a ResourceBundle, so I decided to use ResourceBundles, particularly PropertyResourceBundle, although this will make my GUI code longer and more
complex.

:roll:
 
Adam Cl
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"I cannot explain why using constants could be better than using a ResourceBundle..."

"...although this will make my GUI code longer and more complex."

Yes you can
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Adam.

It is common for people to go overboard in trying to justify why they chose one option over another. But often there is nothing wrong with a simple reason. Even the choice between RMI and Sockets can come down down to as simple a question as "which am I more comfortable with?"

Don't over think things.

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic