Reasoning: Hungarian Notation, which specifies type as part of the identifier, violates OO abstraction. Scope identification specifies scope as part of the identifier, which also violates OO abstraction.
SCJP
Visit my download page
Wendy Gibbons wrote:in which way is including this information in variable names breaking abstraction, as none of this information will make it outside the interface/ getters.
Data abstraction enforces a clear separation between the abstract properties of a data type and the concrete details of its implementation.
Stephan van Hulst wrote:Let's say we have a String that represents a phone number. We call it sPhoneNumber. What if somebody writes a really awesome PhoneNumber class that works universally, and it gets included in the standard API? If we refactor our code, we have all these variables with an s in front of it, which really doesn't make sense any more. This should be enough illustration to show you that a data type is not part of a variable name, and never should be
Tim Moores wrote:I'd agree that Hungarian Nototian was most useful for C/C++ which was not really strongly typed. It should be noted that there were two different forms of the notation which specified different things of different usefulness; some detail about that can be found at http://www.joelonsoftware.com/articles/Wrong.html
SCJP
Visit my download page
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:Actually, what brief love I did have for Hungarian notation died when I was most heavily involved with C++, precisely because of the data typing. Just because you can freely cast in C/C++ doesn't mean that they aren't strongly-typed.
But I got fed up with names that lied as their underlying datatypes shifted from integers to iterators to strings and back as I tweaked class details and threw up my hands over the whole concept.
Bear Bibeault wrote:Meh, I don't like either variant. Just makes for messy-looking names. Good choice of names in the first place should make it clear what the variable is representing. Just my 2¢.
Consider Paul's rocket mass heater. |