• Luvon@beehaw.org
    link
    fedilink
    English
    arrow-up
    11
    ·
    1 year ago

    Character limits and a stupid badly used Hungarian notation to waste limited characters to tell use what the ide already knows.

    If you have a table, (that’s an array for sane programmers) name the variable as a plural and we will know it’s a table.

    Don’t name two variables the same stupid abbreviation with different Hungarian notation characters stuck to the front

    • I’ve worked with the Windows API and “things the IDE already knows” isn’t something you should rely on. Everything is an LPVOID if you cast and recast long enough. In Windows various longs returned by the system are actually secretly pointers or handles, and using them as if they’re the type the IDE derives can lead to very annoying bugs.

      Using plurals for lists and tables isn’t very clear, unless you have explicit naming guidelines about them. Plenty of people use plurals to indicate counts, and neither are good uses of them in my opinion. itemCount and itemList solve everything here.

      • Luvon@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        But that is a typing weakness of that language. I just prefer using languages where the compiler actually does know what the types are at all time and thus can inform me instead of me trying to make sure that types align correctly.

        That is tedious work that has been proven to be a terrible idea to shift onto humans. Strong type systems make much more robust code.

        Abap only has one collection type, and its tables. Contextually it’s not hard to read what a collection of things are and what a single thing is.

        If I am looping through comments and do something with comment, it’s contextually clear what ma going on. The exact type can be easily checked for when it’s actually needed.

        Naming a count of something the plural seems like a much less intuitive thing. Especially sense generally the count is gotten from the collection.