Skip to main content

Articles

2025


Handling ExecutionException - tips for Writing Robust Concurrent Code

Java
2 mins
Handling an ExecutionException in Java requires understanding its root cause and applying the right strategy to ensure smooth execution in concurrent environments. Practical solutions include unwrapping the exception with getCause() and implementing structured error handling.

Singletons in Python

Python
8 mins
A singleton is a design pattern that restricts the instantiation of a class to one single instance. This is useful when exactly one object is needed to coordinate actions across the system. In Python, there are several ways to implement singletons, including using modules, classes, and decorators.

The __init__.py is still useful

Python
4 mins
Before Python 3.3, the `__init__.py` file was used to mark a directory as a Python package. It can be empty, but it can also contain code that initializes the package or sets up the package namespace. In modern Python, it is still useful for defining the package interface and providing a consistent API for users.

Speeding up JAXB with caching and pooling - with benchmarks

Java
8 mins
Caching JAXB instances can significantly improve performance in Java applications. It reduces the overhead of creating new instances and allows for better resource management. See benchmarks comparing caching vs. non-caching approaches.

Dynammically importing modules in Python

Python
4 mins
Dynamically importing modules in Python can be done using the importlib module, which provides a way to import modules programmatically. This can be useful for loading modules at runtime based on certain conditions or configurations.

Where is the Python switch statement?

Python
3 mins
Although Python does not have a switch statement, there are several ways to implement similar functionality. You can use if-elif-else statements, dictionaries, or the match-case statement introduced in Python 3.10.