Category: Tech

  • LRU Cache

    LRU Cache

    What Is LRU Cache? A cache is a hardware or software component, that stores data so that future retrieval requests can be executed quickly. Each cache operates according to a specific strategy that determines which data is supposed to be stored. One of these cache strategies is the Least Recently Used cache, or LRU cache. […]

  • Introduction to Spring Framework

    Introduction to Spring Framework

    DI Container Overview of Spring Framework’s DI Dependency injection, or DI, is a process where an object defines its dependencies only through arguments to its constructor or setter method, or properties that are going to be set on an object instance after it’s created. DI helps to decouple components; when dependencies are declared as interfaces […]

  • Lambda and Stream

    Lambda and Stream

    Lambda Expression Replace Anonymous Class with Lambda A lambda expression in Java is a concise and straightforward way of declaring and instantiating a class which implements a functional interface. We’ll explore multiple means to pass functionalities to method invocations in the order from redundant to concise. Suppose that we iterate through a list and print […]

  • Topological Sorting and Cycle Detection

    Topological Sorting and Cycle Detection

    Topological Sorting Topological sorting arranges the nodes which belong to a directed acyclic graph (DAG) in a linear order so that for every edge from \(v_i\) to \(v_j\) , \(v_i\) appears before \(v_j\). There’re two well-known algorithms to execute topological sorting: Depth-First Search (DFS) approach, and Kahn’s algorithm. Topological sorting: DFS approach In DFS approach, […]

  • Concurrency in Java

    Concurrency in Java

    Threads By initializing and launching an object which adheres to specific implementations, we can create another thread, which is independent of the other operations described in main method, and we can execute them simultaneously. There’re two ways to create a thread; extending Thread class and implementing Runnable interface. In either way, what we have to […]

  • Transaction Isolation Levels

    Transaction Isolation Levels

    A Transaction and ACID Properties A transaction is a unit of work. It bundles multiple steps into a single, all-or-nothing operation. In the context of DBMS, a transaction is composed of one or more SQL statements. There’re four desirable properties we want transactions to have, which are known as ACID properties; atomicity, consistency, isolation, and […]

  • Garbage Collection in Java

    Garbage Collection in Java

    Java Virtual Machine A Java program written in a .java file is compiled into bytecode which is stored in a .class file. This bytecode is executed on Java Virtual Machine (JVM), not directly on an operating system. Since JVMs specific to each operating system are distributed, we don’t have to worry about the platform on […]

  • Exceptions in Java

    Exceptions in Java

    Checked and Unchecked Exceptions An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of program’s instruction. Exceptions are categorized into two types; checked exceptions and uncheck exceptions. Checked exceptions indicate exceptions which well-written applications can anticipate and recover from. Java requires us to take a precaution […]

  • Generics in Java

    Generics in Java

    Generic Types A generic type is a generic class or interface which is parameterized over types. When defining a generic-type class or interface, what we have to do is describing type parameters, \(T_1, T_2,…,T_n\), which follow the class or interface name and are enclosed in angle brackets. Next, to invoke a generic-type class, we specify […]

  • Stacks and Queues

    Stacks and Queues

    Stacks What Is Stack? A stack is a data structure in which we can only access the element that was added last, and this access follows last-in-first-out (LIFO) principle. Stacks, for instance, can be used to implement a redo and undo function, and a backtracking algorithm (such as depth-first search, DFS). Implementations Stacks typically support […]