-
Notifications
You must be signed in to change notification settings - Fork 0
Un-deprecate #161
base: main
Are you sure you want to change the base?
Un-deprecate #161
Conversation
@@ -1,5 +1,3 @@ | |||
⚠️ **Deprecation warning: This package will soon be migrated to [guardian/libs](https://github.com/guardian/libs) and will be archived. ** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we instead add a note to the effect of this PR description to give any new adopters a heads up that, unless they need any of the functionality that isn't going to be migrated, they should be using libs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that we'll be deleting the features that have been migrated? So the only things left will be the ones that haven't?
Hi @JamieB-gu I want to clarify what we mean by deprecated, as it might help alleviate some of your concerns. The plan is for Option and Result will not be supported for reasons that have previously been discussed. We recommend that teams find an alternative solution, and we are more than happy to help with this. We'll keep the deprecation notice in place because we don't want teams to start using this library or the patterns and types within. We won't accept any new PRs except security fixes. We won't un-publish this library or delete any features. We will continue to monitor usage of this library to ensure it is on a downward trajectory. Please let me know if there's anything I can help with, if anything is unclear or if I have said anything that is unacceptable. |
Thanks for attempting to clear things up @SiAdcock 🙂
Couple things on this. Firstly, I don't think that's feasible as a universal rule I'm afraid. As mentioned on that thread, My understanding was that you'd like However, I'm afraid that I don't accept the premise that we should be prescriptive to the point where we mandate that no team should be using these software patterns regardless of whether they find them helpful. Some developers do like working with these features for a number of reasons (which I've discussed elsewhere). At the risk of drifting into the abstract here: I get that it's valuable to have consistency across codebases, and there are a lot of scenarios where I argue in favour of that. But I also think that if we take this too far we're in danger of a) stifling innovation by cutting off the exploration of new techniques we can use to improve our projects, and b) making developers lives more difficult by denying them the tools that they like to work with. Bringing this back to something a bit more concrete: for me personally, I want to write the best, most robust code I can, and I don't want the tools that allow me to do that to be taken away from me 🛠😔. |
Hi @JamieB-gu. I don't have much time today, but the crux of your concerns appears to this:
I don't think that was what I was suggesting, apologies if it was unclear. I'm suggesting you find an alternative solution to consuming them from this library, which is deprecated. I can help you find alternative ways of consuming these patterns if you would like. I believe the relevant point from Coding with Empathy is:
The argument is that Option and Result are not typically familiar to TypeScript developers, they are idioms imported from other languages. As such, they make code that uses them harder to grok. |
Given the following, I'd say:
They're an alien abstraction with a bespoke implementation – that can't be simpler than writing native typescript code (concision is not the same as simplicity).
You could be fluent with typescript and have never seen
Killing off innovation is 100% not what we should be doing and in this situation something we've thought hard about. you've clearly put an awful lot of time and thought into this and that alone is extremely welcome; anything that kills that, even a bit, is massively undesirable. But that can be true while also not being a sufficient acceptance criteria. Something that challenges our assumptions or how we work is a good thing, and trying these things out is vital if we want to progress. but testing them means understanding we might decide against them (the collective ‘we’). Concluding that a new approach will make too many of our lives harder to adopt it globally is a reasonable response – dismissing all change is not, but also not what i think is happening here.
What should we do for developers whose lives are made more difficult by non-idiomatic approaches denying them the fluency they have spent time acquiring?
I think it's worth remembering that our job is to build and maintain good products. Writing code is how we do much of it, but writing code is not the point of it. When we do write code, it needs to support the creation and maintenance of our products by whoever works on them and at any time. We all work in the context of our colleagues. This means not only writing code that is likely to work, but also that is the most likely to be understood by the most number of people. It's clear that this approach is how you feel most able to do the former, but we're trying to balance that here against the latter. That is ultimately what I think we all should be doing. |
Thanks both for your comments 🙂
Awesome, that makes sense, thanks Simon. As discussed offline, I think we've clarified that this is more an issue with the
I'm afraid I don't agree with that Alex, particularly in the case of TypeScript. I think this is where we run into the issue I raised when this recommendation was introduced a few weeks ago. Determining whether something is "idiomatic" is subjective, particularly in the world of JavaScript, and it's hard to resolve this without a definition of idiomatic. All that said, I would find it helpful to understand why these don't seem idiomatic from your perspective. For me these two types are just made up of features that are common in the TypeScript world, like enums and generics, and techniques that are well-documented in the TypeScript handbook, like discriminated unions. Furthermore the entire API consists of a few short functions, which are a foundational feature of JavaScript. Does this seem like a fair description, or do you see things differently?
I'm not sure I understand this phrase, could you clarify? Do you mean they're an abstraction that comes from somewhere else?
I agree with the second part of this - the idea that concision is not the same as simplicity. I've seen lots of examples in multiple languages (JavaScript, Scala, Python etc.) where something is concise but very hard to reason about. However, these weren't introduced for the purpose of concision, and I'm not actually sure they are more concise than other solutions in any case. They were introduced because I don't believe the first part of this statement is always true. I don't think the native JS/TS techniques are particularly simple or easy to reason about. As I've mentioned before, in a lot of cases I think they're quite concise but hide a lot of complexity - we've discussed examples of this in a few places now. The data types discussed here were introduced to reduce complexity and make the code more robust (i.e. fewer bugs).
I appreciate this, thank you 🙂
Are you saying that the collective "we" has both tested these data types and decided against using them?
I thought we'd already decided we weren't going to adopt these globally when we concluded that they weren't going to live in
I've covered the topic of "non-idiomatic" above, but is there an implicit assumption here that it will make people's lives more difficult? How many people have actually tested this approach? How do we know it's more difficult than dealing with the many problems that stem from JavaScript existing "nullable"/error-handling? How do we know it's not easier? It's only been battle-tested in a few applications so far, and it's been used specifically in AR for nearly two years now and refined during that time.
I agree. Introducing these isn't an excuse to play around with new programming concepts. They've been added because they make our production code more robust by avoiding bugs caused by the complexity of JavaScript's native approach, as mentioned. That's a win for the product but also for developers.
I also agree with this. But again, I don't think this approach contradicts that. I've tried very hard to make the biggest impact with the smallest overhead for new developers. We've not really added anything beyond the On a related topic, you've got to understand that not everybody who works on our codebases is a JavaScript expert, and it's a difficult language to work with even for people who consider their competency with it to be good. There are a lot of gotchas and corner-cases that you just have to remember because they don't occur in other languages. One thing I'm trying to do is sand off some of the rough edges and make it easier to contribute for people who have to work across multiple stacks and languages. You mentioned that these concepts feel "alien", but my point is that they're actually common to many languages and JavaScript is the outlier here. From my perspective it's simpler to learn something once and be able to apply it in many environments, rather than have to learn a collection of specific concepts that have no parallels elsewhere. |
Why?
As described in #136, we planned to migrate everything in this repo to
@guardian/libs
. Several features have already been moved across (thanks @jamie-lynch!): guardian/libs#212, guardian/libs#220, guardian/libs#221, guardian/libs#222Unfortunately, we've been unable to migrate everything - for more details see guardian/libs#193. As a result, these features will have to stay in
@guardian/types
so they can be consumed by the projects that use them, receive updates and bug fixes etc.. Therefore we're not in a position to deprecate the project for now 😔.Changes