• 11 Posts
  • 12 Comments
Joined 1 年前
cake
Cake day: 2023年7月6日

help-circle


  • Hi - I have been using this in production for a few months now, and haven’t experienced significant issues with debugging or troubleshooting.

    It also helps that the library is type-safe - if we are overriding a function, we must comply with the signature of the original function for TS to pass.

    Wrt. run time errors, the use of proxy does not interfere with good stack traces, if that is what you are worried about.

    If we take the example in this gist where an overriden function throws an exception, we can see that the stack trace clearly shows the file (which overrides the hello function) where the exception is originating from.

    In effect, the DX is not much different if you use any other mechanism for making some feature runtime configurable. In comparision to most traditional IoC/DI utilities I find the DX to actually be superior:

    • Unlike a lot of other IoC solutions whose APIs are cloned/inspired from similar Java/C# libraries, you don’t need to wrap things in classes to participate in the DI system
    • Also, that a function is overridable is transparent from consumer side - they just call a function that they import without needing any @Inject/@Provide boilerplate. This is great if you are writing a library or a small utility and don’t want to enforce usage of a specific DI/IoC library for your consumers.

    What we don’t have (and likely will never) is support for things like request scoped DI or hierarchy of IoC containers. In mostly-functional TS code I have seldom missed those patterns.









  • I like jooq, but after using it in a few projects, I now personally feel an Entity centric approach where you control domain objects rather than have them generated fits in better in the java/kotlin ecosystem where sooner or later you’ll also need to add other annotations to the entities for jackson/spqr/microprofile-graphql etc.

    Doing this with jooq is possible (given support for custom projections etc.) but it requires significantly more boilerplate as jooq is first and foremost a db-first library.

    Having first class support for association loading etc. is also quite helpful esp. for crud-heavy applications as opposed to the jooq approach of staying closer to sql without abstractions. ymmv of course.












  • I don’t use it right now, but two years ago I helped a team incrementally adopt Kotlin in a ten year old java/spring/mybatis codebase. We didn’t have any android experience and in the initial few months mostly used kotlin as a better java, avoiding features that would prevent us from switching back to java if needed.

    But it worked pretty well - we didn’t face much resistence from people experienced with java because they could still continue to benefit from their jvm familiarity, and the language was approachable to new folks who joined us. It also helped that we could just copy paste java code into a .kt file and intellij would convert it to kotlin.

    We didn’t venture into kotlin’s js/native targets but for jvm it worked out great for us.