Skip to Content
4
Jul 02, 2020 at 05:08 PM

So, how would you go if you were to eliminate the hungarian notation?

164 Views Last edit Jul 02, 2020 at 05:11 PM 2 rev

Going away from the discussion of best practices, and why people think naving convention belongs to best practice documents, I would like to know what would be your approach as a developer to something that still feels weird to me on the way I have practiced not using the hungarian in a personal project.

Recap from wikipedia

Hungarian notation is an identifier naming convention in computer programming, in which the name of a variable or function indicates its intention or kind, and in some dialects its type.

So iv, it, rt, gc,lv...those things.

Continuing

Perhaps because I can't visualize both method definition and implementation at the same instant (Eclipse, at least), I have to navigate sometimes to understand what is what, justifying the hungarian again. My issue example:

methods:
  do_something
    importing
       item_list type <something>.

data:
   items type <something>
endclass.
...
method do_something.
   items = item_list.
endmethod.

Sure, we have cleancode to keeps things small and improve my reading of it. But still, once I felt in my own trap of assuming item was a member attribute and item_list was an importing paremeter, while both were member attributes and the importing parameter was something else. I will accept you saying that then it "is a code smell, refactor", and it is what I did but I still lost time to figure "Who's who". And I'm used to write parameters with importing and returning only, so I'm don't even consider "is this a changing, exporting"?

What I have tried and see as option:

1) Really old stuff, and seems like a negation operator like in javascript:

methods:
  do_something
    !item_list type <something>.

method do_something.
   item_list = !item_list. 
endmethod.

2) Using me, allowing even exact same name...but people don't invite me to dinners anymore when I use me:

methods:
  do_something
    importing
       item_list type <something>.

data:
   item_list type <something>
endclass.
...
method do_something.
   me->item_list = item_list.
endmethod.

3) ...yes, the Hungarian for import, (I always just give result as a name to returning).

method do_something.
   item_list = i_item_list.
endmethod.

Should I keep without any prefix? Will this feeling go away if I keep practicing? I've practiced for 3 days and feeling is still there.

Thanks for chipping in!