HNHacker News
TopNewBestAskShowJobs

n_e

520 karma · joined February 23, 2013

Contact: nicolas AT even.li

Site: https://www.even.li/

submissionscomments
n_e··on Stay Away from My Trash
It depends what you're getting out of it. I've signed CLAs because it was more convenient for me to have my PR upstreamed rather than maintaining a fork.
n_e··on Stay Away from My Trash
I don't get it either. The LLM-generated issue from the above prompt is just the same information written more verbosely.
n_e··on GraphQL: The enterprise honeymoon is over
The issue is that the API itself is, I assume, badly designed.

Equivalent delete queries in rest / graphql would be

  curl -X DELETE 'https://api.example.com/users/123'
vs

  curl 'https://api.example.com/graphql?query={ deleteUser(id: 123) { id } }'
n_e··on The bewildering phenomenon of declining quality
I've been surprised to see that several cycling products have gotten better over time.

For example I have bought these bottles https://www.zefal.com/en/bottles/545-magnum.html three times over ten years:

- the first time, the mouthpiece was attached by two plastic prongs. The prongs eventually failed

- The second time I bought them, the mouthpiece was attached by four prongs

- The last time I bought them, the hard plastic mouthpiece was replaced by a more comfortable plastic mouthpiece.

I also bought these pedals three times https://www.lookcycle.com/fr-en/products/pedals/road/race/ke... :

- With the first version, small rocks got stuck between the carbon spring and the body of the pedal, making it impossible to clip in and eventually dislodging the spring

- The second version fixed that by adding a plastic cover over the spring, and also improved the bearing seals (which was also a problem with the first version)

- The third version made the angles on the outside of the pedal less acute, making it harder to damage the pedals in a fall

n_e··on How Bear does analytics with CSS
An analytics database is better (clickhouse, bigquery...).

They can do aggregations much faster and can deal with sparse/many columns (the "paid" event has an "amount" attribute, the "page_view" event has an "url" attribute...)

n_e··on I think GCP is better than AWS (2020)
> Cloud SQL Postgres

Although it works and is solid, I wouldn’t say it’s fantastic. My impression is that Google makes limited investment in it to steer customers towards their own services such as Cloud Spanner.

- Major versions are 6 months late - Small instances are horribly slow - Integration with other services is poor (e.g. the Cloud Run integration doesn’t work with a database private IP, so you have to fallback to configuring a VPC and connecting the standard way) - IAM authentication, although great when it works, is complicated and poorly documented - The UI has very few features, for example it isn’t possible to query the database from it - Although I’ve never seen any provider have it, automatic upgrades between major versions would have been nice.

n_e··on Functions and algorithms implemented purely with TypeScript's type system
You can count to an arbitrary number (until the recursion limit) by using tuples of length N (and go back and forth to number literals by using the type of tuple['length'])

e.g. :

  type zero = []

  type Inc<N extends string[]> = [...N,'']
  type Dec<N extends string[]> = N extends [...infer T,''] ? T : never
  
  type one = Inc<zero>
  type two = Inc<one>
  type oneb = Dec<two>
n_e··on How platform engineering works
> At places with basically no platform team, no advanced cloud setup etc, I as a dev could understand everything, and deploying mostly meant getting my jar file or whatever running on some ec2 instance.

With an ec2 instance, how do you, for example, update the Java version? Store the database password? Add URLs the service is served at? If it’s done manually how do you add a second instance or upgrade the os?

Though, I agree the infra setups are usually overly complicated, and using a “high-level” service such as Heroku or one of its competitors for as long as possible, and even longer, is usually better, especially for velocity.

n_e··on I don't need your query language

    select array_agg(e)  from jsonb_array_elements_text('["a","b"]'::jsonb) e;

?
n_e··on I don't need your query language
The biggest advantage of SQL is that it's so common that if you deal with data a lot you tend to know it well enough. Sure, there are small differences between databases but joins/grouping/window functions tend to work similarly enough.

On the other hand, when I have to do a somewhat complex query in Elasticsearch, or MongoDB, or gorm, or Django ORM, I have to check each time in the docs how it's done.

n_e··on I don't need your query language
In most tooling, you can write SELECT FROM table, then go back to the select list and have autocomplete work.

The situation could certainly be better, but at least this works today.

n_e··on Ask HN: Does Anyone Like GraphQL?
> GraphQL doesn't allow for recursive types.

It does, this schema works:

  type Item {
    id: ID!
    children: [Item!]!
  }

  type Query {
    root: Item!
  }
GraphQL queries describe the shape of the response, so with this schema it's not possible to ask recursively for "the full tree up to an arbitrary depth". One way to solve this would be to add a "descendants" field that returns a list of all the children, grand-children...
n_e··on Ask HN: Does Anyone Like GraphQL?
I'm very happy with GraphQL. We use it mainly for APIs that are consumed by several clients (web app, mobile app, other services).

The main benefit to us is that it's a huge time saver. There is almost no similar/duplicated code for similar operations (for example search, list and get operations). It's also very easy to write a generic API once, without thinking to much about how the clients will use it, and have it used in ways that weren't anticipated at the time it was written.

It's also pretty easy to have the API made of entities that are always the same, rather than having routes that return slightly different data.

Another benefit is that the default / basic tooling works well and with no setup. The playground works, it's easy to generate idiomatic clients in many languages, which is not really the case with openapi or grpc.

However, although I have no data to back this up, I feel that the adoption is not that high, and more advanced or unusual tooling doesn't exist or isn't very good or progressing.

Another problem is that developers don't seem to grasp the best practices intuitively and the docs don't make it very clear what they are, but it's necessary to use them to have a useful API and not a slow, more complicated version of REST.

n_e··on Hexatrek: The long distance thru hike in France
> That’s so weird, I wonder how that works. If I’m the first to make a map or a street or any geographic object in France, it can’t be featured on any other map, unless so license it?

A GR isn't a geographic object, it is a sequence of trails that has been arbitrarily chosen by the author among all the possible sequences of trails.

n_e··on Understanding the N + 1 queries problem
Although the problem will be a lot less severe than with remote servers, this is still sub-optimal:

- the data passed from one query to the next still needs to move from the database process to the service process and back

- the queries will always be executed in the order they are in the code, denying the optimizer the opportunity to execute the full query in the best order

n_e··on Understanding the N + 1 queries problem
I don't know ActiveRecord either, but it appears so https://guides.rubyonrails.org/active_record_querying.html#j...
n_e··on Ask HN: If Kubernetes is the solution, why are there so many DevOps jobs?
> If Kubernetes does indeed provide the best solution to provide scalability and availability, one can argue that this would result in a decreased demand for dev ops engineers, as they "would just have to use Kubernetes".

I'd say it would result in either:

- the same scalability and availability with fewer DevOps engineers - better scalability and availability with a similar number or more DevOps engineers

In my experience, it's almost always the second case that happens. For example, a service would be moved from a few (virtualized or physical) servers that can only be scaled manually, to a k8s cluster with either autoscaling or at least scaling by changing a configuration file.

n_e··on Ask HN: Am I an arrogant or am I surrounded by incompetent people?
In the ecosystem I work in, it's normal to have automated tests, it's normal to have a main branch that builds, and it's normal to be able to develop a full feature locally. Plenty of other things that make coding and deployment easier, faster and more reliable, such as using containers, CI/CD, or error reporting are normal too.

However, as you have noticed, all of these things are far from the standard. No tests, code that barely works, devs that are barely able to code, etc. is the standard in many companies.

The people I know who are competent and motivated go down one of two paths:

- either work for a company that values and applies best practices - or work for a company that doesn't in a role such as an architect, where they have a lot of freedom in what they do, and spend most of their time finding simple ways to make poorly written applications work or writing POCs or starting new projects

To answer your questions:

> I wonder if I'm just holding my peers to standards that are too high? Is it too much to expect tests? Is it too much to expect to be able to test full stack locally?

All of the standards you mention are best practices and are uncontroversial in the sense that they require little engineering effort compared to the benefits they bring.

Whether it's too much to expect or not depends of the context: if management or the more senior developers don't value it I'd say it's too much to expect.

However, if your colleagues aren't opposed to it or it's a school project I'd try to introduce improvements, starting with small things. For example, for the main branch that doesn't build you can explain why it's a problem (e.g. your colleagues will pull main before starting to develop something, and it's not nice to them to leave the project in a state where they have to fix things first), and introduce a solution (for ex. a CI job or a pre-commit hook that checks the project builds).

> Am I an arrogant or am I surrounded by incompetent people?

Some people value other things more than software development, don't mind repetitive work, are less driven, or even less intelligent and it's perfectly OK for them to be this way. So I'd say you're arrogant by judging them too harshly or expecting them to be different. However that's not the important part (though it's still a life lesson that I learnt much too late).

The most important part is that you should surround yourself with competent people so you can have more satisfaction in your work and learn new things.

n_e··on A pipe operator for JavaScript: introduction and use cases
> I think it looks fine

_.chain and .value() could be removed

> works fine.

- it isn’t possible to tree-shake the package and only include the lodash functions that are used - it isn’t possible to have non-lodash functions in the pipeline (e.g. date-fns)

n_e··on JSON5 Data Interchange Format
There is no mess.

The 99% case is a pretty string. The 1% case is a string with escaped delimiters.

n_e··on A notable JavaScript developer shamelessly copied one of my most downloaded nod
> Chalk maintainers basically discard the performance improvement as micro-benchmarking (i.e. "doesn't matter in the real world"). Chalk maintainers also say tree shaking doesn't matter in the real world.

Chalk’s purpose is to color things printed to the terminal. Unless it’s performance is atrocious, which I doubt, it doesn’t matter unless a ridiculous amount of data is printed.

> Chalk maintainers also say tree shaking doesn't matter in the real world

No, they say it doesn’t matter for chalk’s use case. Which is command-line tools that are almost never tree-shaken.

n_e··on Lessons learned from running GraphQL
> The fact that GraphQL allows all these permutations in the queries is the root of the problem. It's not something which can be solved or optimized within GraphQL.

Common ways to solve that are to whitelist the allowed queries or to cache at the resolver level instead of the query level.

n_e··on Error stack traces in Go with x/xerror
> Since Go makes errors a return value you have to actively discard the result (by replacing it with a underscore, e.g. `res, _ := getResults()`) or take the time to handle the error.

LoadData(&data)

Does this function return nothing or an error ?

n_e··on Best practices for REST API design (2020)
I’m talking about the GraphQL or OAS schema.

With a REST API, the “resource” type will always have an optional “comments” field, whatever the value of arg is.

With a GraphQL API you’ll have the right type depending on your query.

n_e··on Best practices for REST API design (2020)
> On the flip side, I've never been frustrated by getting too many fields back from an API

A pretty common use-case I have is needing to support these three things :

- A “big object” list screen (where retrieving the whole objects would make the query return megabytes off data)

- A “big object” details screen (where I need the full object)

- Programmatically getting many big objects

With GraphQL it involves writing one (or two) straightforward queries, while with REST it would require more thought or code.

n_e··on Best practices for REST API design (2020)
Unless I’m missing something, the response schema will have an optional “comments” field whether the “with_comments” arg is passed or not.
n_e··on Best practices for REST API design (2020)
> All things that GraphQL claims to do can be implemented in RESTful services easily.

How do you easily write an endpoint that can either return a comment, a comment with its children, a comment with its corresponding story, with a strongly typed schema (ie. no optional children or story whatever the query is)?

n_e··on After 10 years in tech isolation, I’m now outsider to things I once had mastered
> If you knew you could hurt others when you intentionally messed up

Not many people are locked up for a few years for a traffic violation

n_e··on Students are failing AP tests because the College Board can’t handle HEIC images
> Missing HEIC support (and Apple support in general) is not an issue of quality; it's an issue of "knowing your customers".

The test portal "not responding" when receiving an unexpected file format is a quality issue. Not making it clear to the user that the upload has failed before it is too late is another quality issue.

n_e··on A one-line package broke `npm create-react-app`
> If deps are immutable, then nothing anyone does in any other package (short of having the package repository take the code down) should be able to break your future builds.

They are. You're only affected if you don't use a package-lock.json or start a new project (which will pull the latest versions of the dependencies).

← PreviousPage 3 of 4Next →