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.



Popular posts from this blog

Spring DI with different styles

Use Blogger API from its Java client

Leverage shell commands to quickly edit text on Visual Studio Code