variable conventions?

is there a standard way of declaring variables?

say ;[codeJTextFiled txtMyTextFiled, JPanel pnlDisplay, JFrame frmMain][/code]

are there a standard list of Prefixes of components, data types.... or is just the personal choice of the programmer to give prefixes on such?

thanks!

[302 byte] By [paoa] at [2007-11-26 13:15:07]
# 1

> are there a standard list of Prefixes of components,

> data types....

The standard is either "what the customer or company you work for defines as standard", or the Java coding guidelines (which IIRC only suggests the is- prefixes for booleans), or whatever you feel you need to do.

http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

CeciNEstPasUnProgrammeura at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 2
how about for components? are there any prefixes?
paoa at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 3
no. Read the official code standards. You should NOT use hungarian notation or anything of the kind.If your boss tells you to that's another thing, but normally you should NOT.It's very bad practice and should be stamped out.
jwentinga at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 4
No standard for prefixes exist. It is at the developers discretion to find out how lucid it is.
praveenrva at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 5

> no. Read the official code standards. You should NOT

> use hungarian notation or anything of the kind.

> If your boss tells you to that's another thing, but

> normally you should NOT.

>

> It's very bad practice and should be stamped out.

my old boss' insistence on hungarian notation contributed quite heavily to me leaving the job after a few weeks :-) seriously, I think any organization that imposes something so inappropriate on developers doesn't understand the nature of the technology they're using. I strongly suspect this particular company moved over to java simply because it was The Done Thing, rather than for reasons of suitability. a warning sign in my book

georgemca at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 6
I remember that I actually have seen coding conventions / UI guidelines from Sun, and those conventions said that prefixes should be used in UI programming (chkSomething for JCheckBox, txtSomething for JTextArea and JTextField and so on)Kaj
kajbja at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 7
where can i find the list? i asume it has some kind of prefixes for developers to easily identify particular declarations.
paoa at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 8
> where can i find the list? i asume it has some kind> of prefixes for developers to easily identify> particular declarations.Im pretty sure it doesnt. Someone also gave you a link earlier.
CaptainMorgan08a at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 9

> > where can i find the list? i asume it has some

> kind

> > of prefixes for developers to easily identify

> > particular declarations.

>

> Im pretty sure it doesnt.

I know that they used to have one which was only related to UI components, but I can't find it now. The last time that I read it was in 2000 (I think). I found some other documents that I read at the same time, and they contain broken links to "Guidelines Home Page" which not can't be found. They used to have many different types of guidelines there.

Here's an really old but good one on UI design :

http://java.sun.com/products/jlf/ed1/dg/index.htm

(It talks about JFC which was what Swing used to be called)

Here's a guideline which is on naming conventions for Enterprise Applications:

http://java.sun.com/blueprints/code/namingconventions.html

Sun does not just have one coding convention, they do actually have lots of them.

Kaj

kajbja at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...
# 10
thanks a lot for the effort guys!
paoa at 2007-7-7 17:35:29 > top of Java-index,Java Essentials,New To Java...