Category : Articles

Transactions are an essential part of any business critical application as these ensure the integrity of the data being managed by the same application. Transactions ensure that the data remains in a consistent and integral state after this is manipulated, thus mitigating the risk of invalid states. Databases are synonymous with transactions, and many programming languages rely on the underlying database to provide the required transactional support. This works well when all modified state is found at the database level. Unfortunately, this is not always the case and there can be cases where the state is found at the application level rather than the database level. In this article we will see how we can use Multiverse (Git Hub), a Software Transactional Memory, to provide transactions at the software level without using any databases.

Albert Attard
Author: 2 years ago

There can be cases where we need to save large text data into a database tables. This data can take lots of space and may introduce new challenges which needs to be addressed. Backups for example may take longer and if uncompressed, these will take more space. In this article we explore several possibilities available when dealing with large data and compare the results obtained.

Albert Attard
Author: 3 years ago

The Windows operating system (Homepage) provides useful information about video files playable by Windows Media Player (Homepage). This information includes the video length, frame width and height and other similar properties. Unfortunately there is no Java API which can easily retrieve such information. Instead we need to rely on third party native libraries such as MediaInfo (Homepage) and create wrappers around it. In this article we will see how to use the aforementioned third party native library to retrieve the video properties from a Java application.

Albert Attard
Author: 3 years ago

Databases are an important part of most applications irrespective of their size and nature. Data needs to be persisted and this is usually done through a database. OSGi (Home Page) is an emerging platform providing high degree of modularity and also supports the hot deployment and replacement of modules. This article describes how to use Flyway (Home Page), a database migration library, with Eclipse Virgo (Home Page) OSGi implementation (previously known as Spring Dynamic Modules (Reference Guide)).

Albert Attard
Author: 3 years ago

The Singleton (Wiki) pattern is quite an old and well known pattern. This pattern was discussed over and over again in many books and articles on the web. So why are we discussing it again here? This article is not about the Singleton pattern per se, but more about the Java Memory Model (Paper) and the concurrent access of shared objects.

Albert Attard
Author: 3 years ago

Java 7 introduced a new type of ExecutorService (Java Doc) called Fork/Join Framework (Tutorial), which excels in handling recursive algorithms. Different from other implementations of the ExecutorService, the Fork/Join Framework uses a work-stealing algorithm (Paper), which maximise the threads utilisation, and provides a simpler way to deal with tasks which spawn other tasks (referred to as subtasks).

Albert Attard
Author: 3 years ago

Say that you are eating some sweets while watching a movie. You had a look at your pack or sweets, counted five and continued watching the movie. Took the first one and deducted this in your mind (without looking at the sweets pack). In the mean time, and without you knowing, your daughter takes one. While you think that there are four sweets left, in reality there are only three. You will discover this at the end when you are looking for the last one. This is a Race Condition and in this article we will see how this occurs in programming and how we can avoid it.

Albert Attard
Author: 3 years ago

Defensive copying is a technique which mitigates the negative effects caused by unintentional (or intentional) modifications of shared objects. As the title indicates, instead of sharing the original object, we share a copy of it and thus any modification made to the copy will not affect the original object.

Albert Attard
Author: 4 years ago

Programs work well when dealing with a considerable size of data, but their performance tend to degradate when dealing with large volumes of data. Resources are cheaper than ever, but this does not mean that we can have inefficient programs. Dealing with large amounts of data brings several challenges, even if the task is simple parsing some Java objects into JSON strings, as we will see in this article. Inefficient use of memory can make a program wasting more than 5 times the memory when compared with a more efficient one. This means that one program makes use of 1G of memory, while the inefficient one requires 5G of memory to perform the same task.

Albert Attard
Author: 4 years ago