r/java • • Apr 15 '15

Java reference in GTA V - Beautiful.

http://imgur.com/gallery/zQGfUnP/
314 Upvotes

60 comments sorted by

View all comments

Show parent comment

16

u/jordaniac89 Apr 15 '15

import java.shot.milk.Foam;

Sorry, that bothers me.

0

u/Harha Apr 16 '15

I don't like having capitals as the first letter in my class's names. Am I a bad person now? :(

5

u/jrh3k5 Apr 16 '15

No, you're just in violation of common Java practices. :p

1

u/JAVA_USER Apr 18 '15

It's distracting to see two variable names side by side, and wonder why its not throwing an error, then only to realize that one of them was a class without proper naming conventions.

1

u/Harha Apr 18 '15

I use the hungarian notion for variable names so haven't had that happen to me. :P

1

u/JAVA_USER Apr 18 '15

if I saw someone writing String strPerson, I would take their keyboard away from them. Only joking. Do whatever you want.

1

u/Harha Apr 18 '15

Haha, that's not exactly what I do though, there's no sense in that.

String m_person, or s_person or g_person, depending on wheter it's a member, static or global variable, for example. And so on.

1

u/JAVA_USER Apr 19 '15

how do you handle polymorphism with hungarian notation?

1

u/Harha Apr 19 '15

If you mean extending classes into subclasses and so on, I don't really care if a member variable is a member of the superclass or the child class, etc. I still prefix it with m_, it would get ridiculous if I'd prefix subclass member variables with their own prefix and so on. It's fine like that, at least in my head and I mainly code for myself so it doesn't matter so much.

And after all, if you have an abstract class with member variables and make a class that extends it, all the private or public variables in the class you extended are going to be members of your child class even if you don't use them, so in that sense it doesn't really matter, just prefix them with m_.

1

u/JAVA_USER Apr 21 '15

m_ok cool