Designing Immutable Classes and Applying the Flyweight Pattern

Immutable Object Design and Implementation Thread Safety Through Immutability Mutable objects like SimpleDateFormat are not thread-safe. When shared across threads without synchronization, they can produce inconsistent or erroneous results: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (int i = 0; i < 20; ++i) { ...

Posted on Sun, 25 Oct 2026 16:33:18 +0000 by ponies3387

Understanding Parameter Passing in Java

In Java, understanding how data is passed to methods is a fundamental concept for every developer. To demystify this, we must distinguish between primitive types and object references. Core Principles of Parameter Passing When you pass a value to a method, Java behaves based on the data type: Primitive types (int, char, boolean, etc.): The met ...

Posted on Tue, 06 Oct 2026 16:18:46 +0000 by Pr0digy

Understanding Java String Immutability

The immutability of the String class in Java is a foundational concept that impacts performance, security, and memory optimization. Understanding how and why this design decision was made can help developers better utilize strings in their applications. 1. How Immutability Is Implemented in String The immutability of String is enforced through ...

Posted on Sun, 26 Jul 2026 16:24:20 +0000 by nomanoma

Understanding Python Tuples: Immutability, Operations, and Comparison with Lists

Tuples in Python are ordered, immutable sequences that can store heterogeneous data. Their immutability makes them ideal for representing fixed collections of values. Creating Tuples Tuples are defined using parantheses () with comma-separated elements. An empty tuple is created with empty parentheses, and single-element tuples require a traili ...

Posted on Tue, 30 Jun 2026 18:15:35 +0000 by drfate

Understanding `const` in C++: Member Variables and Member Functions

In C++, the const keyword plays a crucial role in enforcing immutability, ensuring that certain data or operations cannot be modified after initialization or within specific contexts. This section explores its application to member variables and member functions. const Member Variables When a member variable is declared as const, it signifie ...

Posted on Mon, 22 Jun 2026 16:04:15 +0000 by ngreenwood6

Deep Dive into Java's `Collections` Utility Class

The java.util.Collections class is a fundamental utility within the Java platform, providing a suite of static methods designed to perform various operations on collection objects. Described as offering "polymorphic algorithms," this class simplifies common tasks such as sorting, searching, modifying, and creating specialized versions ...

Posted on Sat, 30 May 2026 21:05:45 +0000 by danmon

Building a Minimal Blockchain from the Ground Up

Blockchain is a decentralized, tamper-resistant technology for recording data. It consists of a chain of data blocks, where each block contains transaction records and metadata. Every block connects to its predecessor through cryptographic hash functions, forming an ever-growing chain. This article walks through blockchain fundamentals via impl ...

Posted on Sun, 24 May 2026 16:44:53 +0000 by chrisredding

Core Mechanics of Java String Objects and Manipulation Techniques

The java.lang.String class encapsulates sequences of characters within a Java application. Every text literal enclosed in double quotes constitutes an instance of this immutable class. Being located in the java.lang package, explicit import statements are unnecessary. Immutability Characteristics Instances of String maintain a fixed state once ...

Posted on Sat, 09 May 2026 14:06:43 +0000 by sfarid