• 12 Posts
  • 180 Comments
Joined 1 year ago
cake
Cake day: June 11th, 2023

help-circle


  • Where would/should the mapping happen? Probably not the Set constructor. JSON.parseSet()?

    JSON.parseSet = json => new Set(JSON.parse(json));
    JSON.parseSet('["A", "B", "C", "A", "B"]'); // Set(3) [ "A", "B", "C" ]
    

    /edit: JSON.parseMap()

    JSON.parseMap = json => new Map(Object.entries(JSON.parse(json)));
    JSON.parseMap('{"a":1,"b": 2}'); // Map { a → 1, b → 2 }
    













  • many2one: so in this relationship you will have more than one record in one table which matches to only one record in another table. something like A <-- B. where (<–) is foreign key relationship. so B will have a column which will be mapped to more than one record of A.

    no, the other way around

    When B has a foreign key to A, many B records may relate to one A record. That’s the many2one part.

    The fact that different B records can point to different A records is irrelevant to that.

    one2many: same as many2one but instead now the foreign key constrain will look something like A --> B.

    It’s the same, mirrored. Or mirrored interpretation / representation to be more specific. (No logical change.)

    If you had B --> A for many2one, then the foreign key relationship is still B --> A. But if you want to represent it from A perspective, you can say one2many - even though A does not hold the foreign keys.

    In relational database schemata, using foreign keys on a column means the definition order is always one to one, and only through querying for the shared id will you identify the many.

    many2many: this one is interesting because this relationship doesn’t make use of foreign key directly. to have this relationship between A and B you have to make a third database something like AB_rel. AB_rel will hold values of primary key of A and also primary key of B. so that way we can map those two using AB_rel table.

    Notably, we still make use of foreign keys. But because one record does not necessarily have only one FK value we don’t store it in a column but have to save it in a separate table.

    This association table AB_rel will then hold the foreign keys to both sides.




  • I don’t have multi-user library maintenance experience in particular, but

    I think a library with multiple users has to have a particular consideration for them.

    1. Make changes in a well-documented and obvious way
      1. Each release has a list of categorized changes (and if the lib has multiple concerns or sections, preferably sectioned by them too)
      2. Each release follows semantic versioning - break existing APIs (specifically obsoletion) only on major
      3. Preferably mark obsoletion one feature or major release before a removal release
      4. Consider timing of feature / major version releases so there’s plannable time frames for users
    2. For internal company use, I would consider users close and small-number enough to think about direct feedback channels of needs and concerns and upgrade support (and maybe even pushing for them [at times])

    I think “keeping all users in sync” is a hard ask that will likely cause conflict and frustration (on both sides). I don’t know your company or project landscape though. Just as a general, most common expectation.

    So between your two alternatives, I guess it’s more of point 1? I don’t think it should be “rapidly develop” though. I’m more thinking doing mindful “isolated” lib development with feedback channels, somewhat predictable planning, and documented release/upgrade changes.

    If you’re not doing mindful thorough release management, the “saved” effort will likely land elsewhere, and may very well be much higher.