←back to thread

399 points nomdep | 2 comments | | HN request time: 0.409s | source
Show context
dvt ◴[] No.44295444[source]
I'm actually quite bearish on AI in the generative space, but even I have to admit that writing boilerplate is "N" times faster using AI (use your favorite N). I hate when people claim this without any proof, so literally today this is what I asked ChatGPT:

    write a stub for a react context based on this section (which will function as a modal):
    ```
        <section>
         // a bunch of stuff
        </section>
    ```
Worked great, it created a few files (the hook, the provider component, etc.), and I then added them to my project. I've done this a zillion times, but I don't want to do it again, it's not interesting to me, and I'd have to look up stuff if I messed it up from memory (which I likely would, because provider/context boilerplate sucks).

Now, I can just do `const myModal = useModal(...)` in all my components. Cool. This saved me at least 30 minutes, and 30 minutes of my time is worth way more than 20 bucks a month. (N.B.: All this boilerplate might be a side effect of React being terrible, but that's beside the point.)

replies(2): >>44295643 #>>44297881 #
skydhash ◴[] No.44297881[source]
For this case, i will probably lift off the example from the library docs. Or spend 5 minutes writing a bare implementation as it would be all I need at the time.

That’s an issue I have with generated code. More often, I start with a basic design that evolves based on the project needs. It’s an iterative process that can span the whole timeline. But with generated code, it’s a whole solution that fits the current needs, but it’s a pain to refactor.

replies(1): >>44303879 #
1. dvt ◴[] No.44303879[source]
> For this case, i will probably lift off the example from the library docs. Or spend 5 minutes writing a bare implementation as it would be all I need at the time.

Both of these would take longer than 5 minutes. There's also no "lifting" as this case involves both Provider and Context, so you'd have to combine React doc examples.

The only alternative would be knowing it by heart, which you might, but I don't (nor do I particularly care to). There's definitely a force multiplier here, even if just in the boring boilerplate cases.

replies(1): >>44305408 #
2. skydhash ◴[] No.44305408[source]
What about understanding. I've not touched React for some times, but I'm familiar enough with the library to locate every piece of exact information I need. And this for a lot of framework, languages, and libraries I've used over the year. There's documentation browsers like dash.app, zeal, devdocs, and various cheat sheets that help.