Design Patterns

Explain how to use the design patterns. (Creational Patterns) Refer1 Refer2 Refer3 Refer4 1. Creational Design Patterns. 1.1 Simple Factory Factory is an object for creating other objects Use cases: when the class does not know beforehand the exact types and dependencies of the objects it needs to create. When a method returns one of several possible classes that share a common super class and wants to encapsulate the logic of which object to create....

February 11, 2025 · 5 min · Phong Nguyen

Java JNA

Explain how to use the Java Native Access library (JRA) to access native libraries. References: Using JNA to Access Native Dynamic Libraries 1. Introduction Sometimes we need to use native code to implement some functionality: Reusing legacy code written in C/C++ or any other language able to create native code. Accessing system-specific functionality not available in the standard Java runtime. Trace-offs: Can’t directly use static libraries Slower when compared to handcrafted JNI code....

November 21, 2024 · 2 min · Phong Nguyen

Java Basic IO

Explain how to use basic I/O. References: Basic I/O Reading and writing files in Java (Input/Output) - Tutorial 1. I/O Streams An I/O Stream represents and input source or an output destination. A stream is a sequence of data. input stream: is used to read data from source, once item at a time. outputs stream: is used to write data to a destination, once item |at a time. --stream--> 0101010101... ----------> java....

November 14, 2024 · 2 min · Phong Nguyen

Java Platform Standard Edition

Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. Java allows to write a program and run it on multiple operating systems. References: Java Platform Standard Edition 8 Documentation Introduction to Java programming - Tutorial 1. Introduction to Java Oracle has two products implement Java SE: JDK (Java SE Development Kit): is a superset of JRE. JRE (Java SE Runtime Environment): provides the libraries, the Java Virtual Machine (JVM) and other components....

November 12, 2024 · 4 min · Phong Nguyen

Java Annotations

Annotations in Java are metadata that provide information about the program but do not change its behavior. They can be used for compilation checks, runtime processing, or documentation generation. References: 1. @Override 2. @Deprecated /[ˈdep.rə.keɪt]/ Can be used on a field, method, constructor or class and indicates that this element it outdated and should not be used anymore.

1 min · Phong Nguyen

Java OSGi Service

Explain how to use the OSGi Service Refer1 Refer2 Refer3 1. Introduction OSGi Services are essentially Java objects that provide a specific functionality or interface, and other components,plugins can dynamically discover and use these services. Multiple plugins can provide a service implementation for the service interface. Plugins can access the service implementation via the service interface. E.g. When you want to create modular that can be added or removed at runtime, you can use the OSGi service....

February 10, 2025 · 3 min · Phong Nguyen

Java Extension Points - Extensions

Explain how to use the Extension Point and Extensions. Refer1 Refer2 Refer3 1. Introduction Extensions are the central mechanism for contribute behavior to the platform. We used it to contribute functionality to a certain type of API. Extension points define new functions points for the platform that other plug-ins can plug into. E.g. When you want to create modular that can be added or removed at runtime, you can use the OSGi service....

February 27, 2025 · 3 min · Phong Nguyen