1. 3

    Any variable that holds a scalar value must have the units in the name. In other words, you should never have a variable named timeout. You always need to know the units, and you’re going to get it wrong if it’s not right in your face. Even if you think it’s obvious from the context, it won’t be. Naming it timeoutSeconds is going to save you hours of debugging.

    (Possibly, this doesn’t apply to languages that can embed that information in the type system. Although even then I’m not sure…)

    1. 8

      Advent of Code day 1.

      1. 1

        Me too! My test this year is to write it in Pharo Smalltalk

        1. 1

          Me too! Day one is done, now i need to learn how to check Smalltalk code into git. The alien environment takes getting used to, but you get glimpses of why people love it.

          1. 1

            I’m still stuck on problem two. I have one method day1p2 and make heavy use of lambda blocks. I hope it’s idiomatic enough.

            Are temporary vars in the traditional railroad tracks of python idiomatic? I don’t think so…

            Edit! Found a solution! I hope it’s idiomatic…

      1. 16

        If you like awk and sed (and other unix tools designed to be inserted into a pipeline), the best tool for json isn’t jq, it’s gron (https://github.com/TomNomNom/gron). gron turns tree-structured json into the line structured data that unix tools expect and allows you to search and edit it using familiar tools like sed, rather than having to learn jq’s mini-language (that I have to look up every time I need it).

        It creates a one-per-line entry for each field with a dot-separated hierarchical key.

        $ echo '{"name": "mark", "age": 49}' | gron
        json = {};
        json.age = 49;
        json.name = "mark";

        gron -u undo’s gron-formatted data back into json, so you can make pipelines like <json source> | gron | <commands in pipeline> | gron -u.

        For example:

        $ echo '{"name": "mark", "age": 49}' | gron | grep age | gron -u
          "age": 49
        1. 2

          I do prefer it over jq, but the = and ; in the output are annoying.

          1. 2
        1. 3

          Most of these I install via Chocolatey. It’s not clear to me if that’s something you’ll be able to do, though. This is my standard Windows toolset and with it I don’t really miss *nix that much.

          Gvim (plus exuberant ctags) - of course

          ConsoleZ - a better Windows console. It can get confused by resizes, but it’s otherwise great. I prefer it to conemu because it has “copy on select” and “copy word on double click”

          Clink - This gives me vi mode in a command prompt and usable tab-completion.

          UnxUtils - I prefer this to cygwin or WSL because it does things the Windows way - in particular, it understands backslashes for directory separators and drive letters - so it works better with the rest of the Windows ecosystem, which isn’t going to understand filenames that start with /mnt/d.

          I usually install a Windows gawk too - it’s not part of UnxUtils. And I use the ssh/scp from Window Git or WSL if I need it.

          1. 2


            “Test source folders will be preselected in the New JUnit Test Case-Wizard”

            YAAY!!! This has been a (minor) annoyance for a long time. Eclipse defaulted to putting my tests in src/main/java instead of src/test/java for maven projects, and fixing it required me to tab back through a good dozen controls or switch to the mouse. Every time I made a new test case.

            This is going to save me many, many seconds.

            1. 10

              This feels spot on. Whenever I get inspired to try to fix something I don’t like about Eclipse, I spend a few hours hacking and then get so discouraged fighting the complexity that I give up. The only good documentation is for the deprecated 3.x API. The 4.x API is much more complex and I can’t see any advantage to it.

              It’s really a shame, because Eclipse seems like a better Java editor than IntelliJ to me, which is why I still use it. Writing Java in Eclipse feels totally different than any other language/editor experience - I’m manipulating Java syntactic elements rather than editing text. The shift-alt-arrow “select java syntactic element” operation is the best example. Instead of selecting by text-editor concepts like “word” or “line”, it’s selecting by Java concepts, like block or method call. I couldn’t find the equivalent operation in IntelliJ

              There’s a quote by someone like Martin Fowler where he says that he’d like an editor that works exclusively by ADT transforms (I couldn’t find the exact quote). At it’s best, Eclipse feels like that. I assume that’s what Lisp people feel like when using paredit.

              But wow, is the rest of the experience janky as hell. I’ve maintained RCP apps before, I’ve been writing Java since the 90s, and it’s open source, so in theory I should be able to fix the problems I see. If it weren’t so complex underneath, I’m sure it would still be winning.