Posts

Showing posts from 2013

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 ...

Use SWI-Prolog's package manager

SWI-Prolog has its own package manager ( prolog_pack ). Available packages are listed here: Available packages I was looking for a way to write lambda expressions in Prolog and found lambda pack on that list. To install/use the package, I rebuilt my swi-prolog to have archive.pl availbale. Install libarchive-devel (I use openSUSE with zypper, change the command according to your environment) $ sudo zypper install libarchive-devel Fetch the git repository (Or get the source from the official page ) $ git clone git://www.swi-prolog.org/home/pl/git/pl.git Follow the instructions in the repository To download configuration files, submodules and documentations. Do prepare first. $ cd pl $ ./prepare configure , make and make_install in the src directory $ cd src $ ./configure $ make $ make install configure , make and make_install in the packages directory $ cd ../packages $ ./configure $ make $ make install Make sure that after you do configure , you have H...