Diamond dependencies are everywhere, from dll dependency hell to running an upgradable linux distro to your node stack to figuring out your #include order.  Check out Titus’s perspective, it’s pretty tight.

I hate it when I find myself Java bashing. It’s just a language, it has its uses. But I pretty much did a Julia Louis-Dreyfus when I read this reddit post….

Operator overloading? You might abuse it… chop. Multiple inheritance? You might abuse it… chop. Creating a new object? You’d best type the type of the object three or four times before we’ll believe that you got it right. You want access to internals, subclass the compiler objects, closures, iterators, lazy evaluation, the list goes on chop chop chop
It’s often hard to point to a language’s philosophy because it is embodied in a long sequence of little decisions that are easy to dismiss in isolation, but that’s how I see the philosophy of Java.
Of course, that didn’t work, so a large aftermarket in prostheses has sprung up, and lately the language has been sort of growing some of the power features it previously rejected, although they pretty are much bolted on. Many people have even forgotten that there is a whole world full of people who don’t get around in powered wheelchairs and don’t need machines to help them chew, and argue passionately about how much they love their Chewing Completion and Integrated Mobility Environments and how easy it is to sort of slowly shamble up stairs on these prosthetic legs (which sounds impressive after you’ve spent five years in a wheelchair), endlessly haranguing those who choose to run on their own two feet about what they are missing by not getting their legs chopped off.

Of course none of this covers the fact that Java was THE ONLY SANE WAY to write portable code for about 15 minutes during its greatest fame…

I don’t think anyone in good faith can discount the navigation benefits of a modern IDE.  Yes my favorite is still written in C++, as is my favorite editor (put that vim and emacs shit down, son, it’s time to code…I KID), nothing beats speed when you just want to type code.  But JetBrains has shown how they can provide amazing IDE features for all kinds of code: C++, Python, Scala, etc. with their Java library stack.  Yes you pay a performance price and yes we’ve been burned by slow Java IDEs before, haven’t we, Eclipse… but JetBrains has really hit a critical mass of solid IDE functionality,  and I’m going to give it another good try.  Here are some rolling notes, made in cronological order…

  • the soggy keylag is KILLING me… but I love the navigation power… hrmph…
  • it’s not THAT laggy considering all it is doing… and my other dev environment is through a VM anyway (does that make it better or worse, not sure yet…) continuing…
  • on a VM, all hope is lost.  Even sublime is uselessly unusable.  Back to emacs.  Sad world.
  • The speed is now pretty good, I don’t know if it got everything indexed and it’s faster, or if I got used to it.  I think it’s faster!  Just in time for my open source license to expire… and JetBrains renewed it!  Yay, thanks guys.
  • Some things just take some adjustment.  Keymaps, panes, etc.  Also, don’t expect to copy/paste huge chunks of code as fast as you can in a dumb editor – it causes a ton of analysis to occur.  In a non-VM fairly-decent environment, CLion is humming along now.
  • CLion is undeniably faster than Sublime on my VM.  It is downright snappy at editing code compared to Sublime.  Happily shocked!
  • Uhoh… lots of clion lockups on laptop… doh, whoops, out of disk space.  Don’t let it happen!  🙂

Fun tips:

  • You can open a file into an existing clion session by running the startup script with a full path to the file, or do this:
    clion `pwd`/myfile.cpp
    or use the little bash script to do it for you:
    !/bin/bash
    # if $1 does not start with [/], prefix it with `pwd`
    MYFILE=$1
    if ! [[ $MYFILE =~ ^/ ]]; then MYFILE=`pwd`/$1; fi
    cd /home/m/apps/jetbrains/clion/bin
    ./clion.sh $MYFILE $2 $3 $4 $5 &
  • For the huge hirez monitors I have gotten addicted to using with i3, make sure you enable this (which is oddly disabled by default):

    File > Settings > Editor > General > [x] Change font size (zoom) with Ctrl+Mouse Wheel

  • CLion will auto-create projects from CMakeLists.txt, really nice.  It seems to auto-create Debug config using ./cmake-build-debug.  To create Release config too, go to:

    File > Settings > Build… > CMake > click +, it will auto-create Release (a little weird but it was what I needed)

These are really good libraries that got my dates and times flowing client-server full circle, with all the UI and math tools I needed.

KISS!


  // Date sanitation: limit ancient and future days and ensure start isn't beyond end
  date today = second_clock::local_time().date();
  date s = startdate;
  date e = enddate;
  if (e > today)
    e = today;    
  if (e - s > date_duration(cn_max_days_to_look_back))
    s = e - date_duration(cn_max_days_to_look_back);
  if (s > e)
    s = e;

You can directly delete iterators while looping through associative containers like set and map:


    for(auto itue = usersByEmail_.begin(), itue_end = usersBySecret_.end(); itue != itue_end; ) 
    {
        if ((*itue)->bDeleted())
        { 
            // NOTE We could do more cleanup work here if needed.
            itue = usersByEmail_.erase(itue);

        } else ++itue;
    }

With sequential containers like vector, you should use the erase-remove idiom. Here’s an example for my multi-indexed sets of pointers that uses a lambda to keep the code tight. runsByRank_ is of my sorted_vector type:


    runsByRank_.erase(
        remove_if(
            runsByRank_.begin(), runsByRank_.end(),    
            []( StockRun*& psr )
            { 
                // NOTE We could do more cleanup work here if needed.
                return psr->bDeleted(); 
            }
        ),
        runsByRank_.end()
    );

I’ll try to get my quick-http skeleton app updated with these best practices soon. As of now it does not include any delayed-deletion pattern.