Giter Club home page Giter Club logo

Comments (16)

untitaker avatar untitaker commented on August 30, 2024

I still have mixed feelings about having persistent IDs. I see one disadvantage (that in my case most IDs are guaranteed to have more than one digit), but no advantages.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

Advantages are that concurrent operations won't change the IDs, which, IMHO, adds a bit of safety:

  • In terminal A run todo, walk away.
  • Open terminal B, run todo, close it.
  • Some time later, notice terminal A still there, and do something like todo done 3 based on what you see on-screen.

It might be a bit uncommon, but I kinda like the determinism this adds.

from todoman.

untitaker avatar untitaker commented on August 30, 2024

That is fair enough.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

I'm still willing to discuss it, but I honestly, I generally favour determinism.

from todoman.

untitaker avatar untitaker commented on August 30, 2024

An easy fix that wouldn't change the nice cache validation flow we have (first expire, then reinsert) would be to directly derive the ID from the UID.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

I don't think we can derive collision-resistant IDs from UIs due to the amount of digits. Consider that we'd need a two/three digit output for every UID that does not collide (think of it as a hash function).

from todoman.

untitaker avatar untitaker commented on August 30, 2024

We could throw in lowercase letters into the mix since those are easy to type as well.

Other options would require updating the cache in-place during validation which is somewhat complicated.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

With letters + numbers (35 symbols), and 80 todos in the db, we'd have a 92% change of collision with two digits, and 7% with three digits. With both lowercase and uppercase letters, this goes down to 1% and 0.5% respectively.

These number are a bit high, because a single collision would make todo fail.
I'm also not convinced that the case-insensitivity of the ids will be obvious.


To get a better understaning though, what causes the dislike for persistent ids? Maybe there's an alternate solution to it it.

from todoman.

untitaker avatar untitaker commented on August 30, 2024

I dislike persistent IDs precisely because they fill up the space of possible IDs so much. I usually have a few open tasks where most tasks usually have a single-digit ID. With the new behavior, the tasks that I don't care about (done tasks) and will never address by ID again are assigned a low-digit ID.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

Ah, I understand, that's really a really valid concern. Let me think if there's another solution. I take it that todo flush is not something you're fond of.

from todoman.

untitaker avatar untitaker commented on August 30, 2024

I consider todo flush to be a performance workaround but it works.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

How would you feel about an autoflush setting to auto-delete done tasks? Or do you prefer to keep them around?

from todoman.

untitaker avatar untitaker commented on August 30, 2024

I personally have no use for them after I'm done, but we shouldn't assume that the avg user feels about that the same way.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

Right, I meant, autoflush with default=False.

If this sounds okay to you, I'll prepare a PR, but if you actually want to keep them around, we can go back to brainstorming.

from todoman.

untitaker avatar untitaker commented on August 30, 2024

Since flush also wipes the cache I imagine that this slows down everything a lot.

from todoman.

WhyNotHugo avatar WhyNotHugo commented on August 30, 2024

It does. 😞

Back to the drawing board it is!

from todoman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.