Upgrade to Pro — share decks privately, control downloads, hide ads and more …

mHungarianNotation and sAndroid

mHungarianNotation and sAndroid

Hungarian notations in an Android world.

Links:
Original Sinomyi topic - https://msdn.microsoft.com/en-us/library/aa260976(v=vs.60).aspx
Jake Wharton blog post about Hungarian notation and android http://jakewharton.com/just-say-no-to-hungarian-notation/
Wiki - https://en.wikipedia.org/wiki/Hungarian_notation
Joel Spolsky blog post about a Hungarian notation = https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/

Michael

March 25, 2017
Tweet

More Decks by Michael

Other Decks in Programming

Transcript

  1. p r i v a t e S h m

    o b j e c t m S o m e t h i n g p r i v a t e I t e r n a l S i n g l e t o n s S o m e t h i n g p r i v a t e S h m o b j e c t m S o m e t h i n g p r i v a t e I t e r n a l S i n g l e t o n s S o m e t h i n g
  2. Actually, you can find our checkstyle config on Stanfy GitHub

    Actually, you can find our checkstyle config on Stanfy GitHub
  3. But people say that this is just a Hungarian notation

    But people say that this is just a Hungarian notation
  4. Interesting fact: Simonyi has been in space twice (!) as

    a tourist Interesting fact: Simonyi has been in space twice (!) as a tourist
  5. He worked in Xerox PARC on first GUI (in 1972-1981)

    He worked in Xerox PARC on first GUI (in 1972-1981)
  6. After this he worked Microsoft (the main architect in Word

    team) After this he worked Microsoft (the main architect in Word team)
  7. In document each pixel has two coordinates: • relatively to

    a window • relatively to a document (page) In document each pixel has two coordinates: • relatively to a window • relatively to a document (page)
  8. w X , w Y / / w i n

    d o w c o o r d i n a t e s p X , p Y / / p a g e c o o r d i n a t e s w X , w Y / / w i n d o w c o o r d i n a t e s p X , p Y / / p a g e c o o r d i n a t e s
  9. Hungarian because: a) Simonyi is from Hungary b) Words in

    Hungarian language contains many consequent consonants Hungarian because: a) Simonyi is from Hungary b) Words in Hungarian language contains many consequent consonants
  10. They were adding prefixes to show a var type They

    were adding prefixes to show a var type
  11. b F l a g / / b o o

    l e a n f l a g u 1 6 S i z e / / u n s i g n e d 1 6 - b i t i n t e g e r s i z e s t T i m e / / c l o c k t i m e s t r u c t u r e b F l a g / / b o o l e a n f l a g u 1 6 S i z e / / u n s i g n e d 1 6 - b i t i n t e g e r s i z e s t T i m e / / c l o c k t i m e s t r u c t u r e
  12. This was a misunderstanding of an initial idea This was

    a misunderstanding of an initial idea
  13. But became de facto standard for Windows programming in 90s

    But became de facto standard for Windows programming in 90s
  14. Such naming has some advantages for languages with a "loose"

    typing Such naming has some advantages for languages with a "loose" typing
  15. For Android world this approach is a bit outdated For

    Android world this approach is a bit outdated
  16. In languages with "strong" typing you always know a variable

    type In languages with "strong" typing you always know a variable type
  17. field/local variables might be distinguished by a syntax highlighting field/local

    variables might be distinguished by a syntax highlighting
  18. Even Microsoft doesn't recommend use HN in .NET code Even

    Microsoft doesn't recommend use HN in .NET code
  19. Maybe, it's because this samples are written by old-school C

    programmers :) Maybe, it's because this samples are written by old-school C programmers :)
  20. In Android world with Android Studio and Java (with strong

    typing) we definitely can live without HN In Android world with Android Studio and Java (with strong typing) we definitely can live without HN
  21. Google explicitly and actively forbids Hungarian notation in their Java

    style guide Google explicitly and actively forbids Hungarian notation in their Java style guide
  22. Linus Torvalds and Jake Wharton strongly recommend don't use it

    Linus Torvalds and Jake Wharton strongly recommend don't use it
  23. You can find links to resources in description You can

    find links to resources in description