Spring DI with different styles

Spring as a dependency injection (DI) framework allows us to define our application components' dependency tree in three different ways: XML Annotation Java Config I've written a simple app, bookstore, with the three styles and they're available in the following repository. You can take a look and see how each style would look like. It also has a version that uses no Spring beans for comparison. https://github.com/ryu1kn/spring--working-with-beans Different styles have different pros/cons. Spring lets you mix the styles; so you can change it as you go. Here is my observations on each style. XML-based configuration Pros Weak/loose coupling with Spring framework in your app code. Good for keeping the option of removing Spring later Class dependency information is centralised. Fine-grained control on the dependency definition. Changing only the dependency information doesn't require the recompilation of your app code. Cons Unless you have a good IDE ...

Using JavaScript eco-system from Clojure/Scala/Kotlin/PureScript/TypeScript

I've been playing with Clojure for close to two months now.

One thing I like about Clojure is that it seems like I'm typing fewer characters to get what I want. Less code to read and maintain. Once I rewrote one of my recent js script with Clojure and its size shrunk down to 2/3.

Another nice thing is that it can leverage the large collection of software asset (i.e. libraries) that people have written for Java (JVM).

But I noticed that I was reading more characters when checking API docs or library code for checking the use of a library. Wondered if I can save some time if use Clojure with JavaScript libraries. I also wondered how the experience would differ if I use other languages to do the same thing; so after I did it with Clojure, I did it with Scala, then PureScript (which works only with js), ...

I've put them in one repository so that you can compare them yourselves, and see what can be involved if you choose one to run your code on JavaScript engines. There is a straight JavaScript version as well.

https://github.com/ryu1kn/js-interop

Comments

  1. This is an interesting exploration of how developers can take advantage of the JavaScript ecosystem from languages such as Clojure, Scala, Kotlin, PureScript, and TypeScript. The comparison is especially useful because it looks beyond language syntax and considers practical factors such as code size, library availability, API documentation, and the experience of running code on JavaScript engines.

    The idea of comparing several languages against a straightforward JavaScript implementation makes the article particularly valuable for developers evaluating different approaches to JavaScript-based development. For readers who want to strengthen their understanding of the underlying language and ecosystem, a JavaScript Online Course can provide a structured foundation before exploring alternative languages that compile to or interoperate with JavaScript.

    ReplyDelete
  2. I also like the practical motivation behind the experiments: reducing the amount of code while still benefiting from the large collection of JavaScript libraries. The repository-based comparison gives readers an opportunity to examine the implementations themselves rather than relying only on theoretical differences. For continued hands-on learning, JavaScript Training can help reinforce the JavaScript concepts that form the foundation of these ecosystem comparisons.

    ReplyDelete

Post a Comment

Popular posts from this blog

Use Blogger API from its Java client

Spring DI with different styles

Leverage shell commands to quickly edit text on Visual Studio Code