HN user

dimaaan

29 karma
Posts0
Comments13
View on HN
No posts found.

Don't call them rockstars - call them "resume-driven developers."

We had one on our team in the past.

A bunch of microservices built on an in-house RPC framework he wrote, RabbitMQ, half-baked "monads" in an OOP language, esoteric naming, and no comments (the code should be self-documenting!), no docs.

Management adored him.

Once we started to grow, the problems started to appear: bad orchestration, uninformative logs full of PII, poor error handling, edge cases that were nearly impossible to fix within the existing abstractions, dependency hell, etc.

At that point, he moved on.

It took years and many hundreds of pull requests to clean it up.

And standard library design errors also.

Properly designed date/time API invented relatively recently.

System.DateTime (.NET) - 2002 | System.DateTimeOffset - 2005

Joda time (JVM) - 2005 | java.time - 2014

Temporal (JavaScript) - still experimental

Thank you for that kind of words.

It's so rare nowadays.

While i agree with technology, art (painters, literature), dance (ballet), i didn't think Russia brings much to the worlds of music.

Curious what is in you iTunes rotation?

TypeScript Magic 3 years ago

Similar trick for JSON-based web API's that returns either error message or result

    async fetchApi<TResult = void>(request: Request): Promise<TResult> {
      type SuccessfulApiResponse = { Succeeded: true; Result: TResult }
      type FailedApiResponse = { Succeeded: false; Error: string | null | undefined }
      type ApiResponse = SuccessfulApiResponse | FailedApiResponse;
      const response = await fetch(request);
      ensureStatusOK(response);
      const result = await response.json() as ApiResponse
      if (!result.Succeeded) throw new Error(result.Error || 'Unknown API error');
      return result.Result
    }

Use System.Threading.Channels.

BoundedChannelFullMode.DropNewest, DropOldest, DropWrite, Wait specifies the behavior to use when writing to a bounded channel that is already full