Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hungarian notation is bad practice #1

Open
LievenDeFoor opened this issue Sep 21, 2017 · 2 comments
Open

Hungarian notation is bad practice #1

LievenDeFoor opened this issue Sep 21, 2017 · 2 comments

Comments

@LievenDeFoor
Copy link

In your guidelines you're using Hungarian notation (adding a prefix to variables to indicate their type).
This is a practice that has long been rendered obsolete and counter productive.
Why should you have a cDescription or iNumberOfOrders instead of description or numberOfOrders?
What could description possibly be other than a string? And why should you care?
A good name for a variable is enough to know what you're dealing with, if you need to know this at all...

@bitwombat
Copy link

Your examples are, apparently, a bastardization of a pretty reasonable idea. See https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/

tl;dr You're supposed to prefix with the kind of thing it is, not its type. Is it unserialized? Unsafe?

@alextrs
Copy link
Owner

alextrs commented Sep 2, 2018

Like @LievenDeFoor said, it's Hungarian notation. Idea here is actually prefix type and in few cases kind (global vs parameter vs local) of variable to make code more readable. Not everybody moved to OE Development Studio (it helps there too), some people still use Progress Editor, some people make changes using mpro and it actually helps a lot to see what type/kind of variable you work with without scrolling back and forth. In most cases good variable name is all you need, but when you work with large teams it helps to keep code cleaner (and code review simpler) as everybody know how to prefix variable, not everybody can come up with good, short and meaningful variable name (as example lastModifiedDate is it DATE, DATETIME or DATETIME-TZ or formatted string?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants