If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Naming Conventions

Hello,
I'm teaching myself Java using one of Sam's 'Teach Yourself" books. Coming
from a VB background, I normally practice a strict form of Hungarian notation.
However, I've noticed that none of the Java code I have seen uses Hungarian.
Do Java programmers not use Hungarian? Is there any resource explaining
or recommending naming conventions in Java?

Re: Naming Conventions

"Jim Pragit" <James.Pragit@BakerNet.com> wrote:
>
>Hello,
> I'm teaching myself Java using one of Sam's 'Teach Yourself" books. Coming
>from a VB background, I normally practice a strict form of Hungarian notation.
> However, I've noticed that none of the Java code I have seen uses Hungarian.
> Do Java programmers not use Hungarian? Is there any resource explaining
>or recommending naming conventions in Java?
>
>- Jim

Re: Naming Conventions

The "Hungarian" notation is the one where you prefix a variable's name with
a code indicating the type of variable, e.g. iCounter for an integer and
sName for a string, right? How would you extend this to cover the several
hundred (thousands of) classes that exist in Java2? I guess you could have
the prefix f for float and fi for File and fr for FileReader and fos for
FileOutputStream and... you see what I mean? I have used this type of
notation when writing in VB and I ended up using the prefix obj for any
object that wasn't a primitive type. That's OK in VB where you don't have
too many types of object but pointless in Java. So that's why I don't use
the Hungarian notation in Java. Of course you can choose any notation you
think is helpful to you and other readers of your program.

Jim Pragit <James.Pragit@BakerNet.com> wrote in message
news:393fc2ce$1@news.devx.com...
>
> Hello,
> I'm teaching myself Java using one of Sam's 'Teach Yourself" books.
Coming
> from a VB background, I normally practice a strict form of Hungarian
notation.
> However, I've noticed that none of the Java code I have seen uses
Hungarian.
> Do Java programmers not use Hungarian? Is there any resource explaining
> or recommending naming conventions in Java?
>
> - Jim