Threads for amar

    1. 9

      String.length() is to return the number of characters in the string

      There is no such thing as “number of characters in the string”.

      1. 1

        This does say

        Returns the length of this string. The length is equal to the number of Unicode code units in the string.


        the length of the sequence of characters represented by this object.

        1. 2

          Normatively, many have used and continue to use the word “character” to refer to a single grapheme in a piece of text. The point I take @singpolyma and Manish (the person who wrote the linked blog post) to be making is that they shouldn’t.

          In short: the word “character” makes sense under ASCII, but doesn’t make sense under Unicode (whatever encoding you’re using). Unicode code points are definitely not “characters,” and grapheme clusters are only sort-of “characters.”

          More broadly, adhering to out-of-date ASCII-centric wording helps to perpetuate the exclusion of people who use languages whose scripts are non-Latin (most of the world), and can lead to incorrect thinking around the representation and manipulation of text exactly in the manner the top blog post in this discussion describes.

          1. 1

            Can you clarify the three terms for us, then: character, code point, grapheme?

    2. 8

      Can someone please explain how it is possible that one malfunctioning SDK can break the entire app? IIUC this is due to Facebook login but still, why can’t the app continue to function regularly?

      Or is it broken only for whoever actually logged in with Facebook in the first place?

      1. 24

        This is due to Facebook’s idiosynchratic engineering practices.

        At least last time this happened (, two months ago*, just including the SDK was enough to bring your app down before it had even initialised because Facebook ran code in the Objective-C class load method, which no sane person would override, let alone do network calls in.

        That’s the idiosynchratic part, but it spells disaster when combined with Facebook’s amateurish development practices: The SDK will load objects from the FB backend, parsing them with brute force, expecting them to always be well-formed. This, combined with no working internal CI/CD system, leads to situations like this, where anyone doing a configuration error on a backend service can bring down millions of clients without them even calling the code in question.

        1. 10

          “Idiosyncratic” seems like an exceedingly polite way to put it.

        2. 5

          Realized today that I’m more dismayed by the tech public’s reaction to this than the failures of engineering displayed. Specifically, a bunch of people over at the orange site believe it isn’t fully preventable when the fix is simply to see bad engineering decisions for what they are: static initialization is dangerous and has no place in a SDK deployed at FB’s scope. Full stop.

          1. 2

            Unfortunately, there are tons of SDKs out there that does static initialization. When brought this issue up with another big-name SDK during integration, the response is in the line: we need to do some initialization, and relying on SDK users to call “init” method properly is a no-go based on what we experienced. That sounds plausible, but the solution is to make sure you have init’ed upon the first call to your library, and this can be solved through tooling (adding a custom LLVM pass to call your init method if not through your public API).

        3. 2

          Do you have a citation for "no working internal CI/CD system"?

          1. 2

            They have a CircleCI instance, but if it did continuous integration and delivery, it would not be all-green.

        4. 2

          The SDK will load objects from the FB backend, parsing them with brute force, expecting them to always be well-formed

          I spit water out of my mouth as I read it.

      2. 9

        It’s just shoddy code from Facebook, and it’s a hot mess, because their SDK calls home in the initializer, IIRC, and a “bad” result that causes it to throw will blow up any app that includes the SDK, even if the app doesn’t use FB login. It’s a total catastrophe.

      3. 3

        To add my speculative point to the good substantive answers above…

        Another part of the problem is our industry has never really adopted REST as a way of architecting big public APIs. So instead of accessing them over HTTP using common patterns every API is expected to have a client library implementing the API’s custom, closed RPC-over-HTTP architecture.

        (I don’t have any solutions, I’m just lamenting.)

        1. 1

          Which industry are you referring to? Serious question.

          1. 2

            Software. Or that part of it that creates Web APIs.

      4. 4

        I’m guessing this is why a bunch of apps on my iPhone weren’t working this morning (GroupMe, Spotify, etc.). I wasn’t logged in with FB, for what it’s worth.

    3. 3

      20 hour workweeks FTW!

      1. 2

        I would settle for even the normal 40-45 pw and be glad :–/

      2. 0

        I fully support this!