Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #873

Re: Hungarian Notation and Java

From lewbloch <lewbloch@gmail.com>
Newsgroups comp.lang.java.help
Subject Re: Hungarian Notation and Java
Date 2011-07-14 17:30 -0700
Organization http://groups.google.com
Message-ID <dd997653-1bbf-4f9c-aec1-aa1ef61b699c@r5g2000prf.googlegroups.com> (permalink)
References <b4d806bc-4f94-4655-8699-5e1c32e111ed@q1g2000vbj.googlegroups.com> <1cwmuo587hrfb.dlg@kimmeringer.de>

Show all headers | View raw


On Jul 14, 9:45 am, Lothar Kimmeringer <news200...@kimmeringer.de>
wrote:
> Steve wrote:
> > Is there any reason left to use Hungarian notation with Java?
>
> I asked that myself - 10 years ago - and the first time I changed
> the type of a variable from int to double I answered it to myself
> with a simple: no
>
> Regards, Lothar
> --
> Lothar Kimmeringer                E-Mail: spamf...@kimmeringer.de
>                PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
>
> Always remember: The answer is forty-two, there can only be wrong
>                  questions!

Same here, only Java wasn't in the marketplace yet, and I didn't wait
to try it to conceive of that scenario.

It's a fundamental mistake to name anything in terms of implementation
type rather than domain type.  For example, a bunch of invoices stored
as a 'List<String>' named 'slInvoices' is obscure, uninformative and
trenchantly stupid since the 'sl' tells nothing about the role of the
variable in the algorithm.  A much better name is 'invoices', and it
can be a 'List<String>' or 'Set<Invoice>' as the implementation
demands.  (The latter most likely is better.)  The name reflects its
purpose, not its irrelevant implementation type.

One of the core principles of object-oriented programming is to *hide*
implementation.  Hungarian notation (as commonly practiced) is the
stupid antithesis of that.

This is a very, very old debate and the winner was decided a looong
time ago.
<http://lmgtfy.com/?q=Hungarian+notation+usefulness>

--
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hungarian Notation and Java Steve <tinker123@gmail.com> - 2011-07-13 07:46 -0700
  Re: Hungarian Notation and Java lewbloch <lewbloch@gmail.com> - 2011-07-13 08:47 -0700
  Re: Hungarian Notation and Java markspace <-@.> - 2011-07-13 09:23 -0700
  Re: Hungarian Notation and Java Roedy Green <see_website@mindprod.com.invalid> - 2011-07-13 15:33 -0700
  Re: Hungarian Notation and Java Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-07-14 18:45 +0200
    Re: Hungarian Notation and Java lewbloch <lewbloch@gmail.com> - 2011-07-14 17:30 -0700
  Re: Hungarian Notation and Java Travers Naran <tnaran@gmail.com> - 2011-07-17 22:06 -0700

csiph-web