zhaobao1830 Notes

website·Indexed 29 days ago

https://zhaobao1830.github.io/zhaobao1830-notes/

A collection of technical notes covering Java and JavaScript development. Java content includes Spring Boot, JPA, RocketMQ, AspectJ, AOP, SSO, OAuth2.0, and Nginx load balancing. JavaScript content focuses on core language concepts such as the Event Loop, Promises, async/await, prototypes, closures, and memory leaks.

Tokens
159.2K
Snippets
657
Records
910
Agent score
75%

What's inside zhaobao1830-notes

  1. Overview of Java Annotations

    Java annotations (also known as metadata) were introduced in JDK 5. They provide a safe, comment-like mechanism to associate information or metadata with program elements such as classes, methods, and member variables. Annotations are used by tools during compilation or at runtime for descriptive or configuration purposes.
  2. Overview of Project Lombok

    Project Lombok is a Java library that uses annotations to reduce boilerplate code, improving coding efficiency and keeping source files concise. It eliminates the need to manually write repetitive methods like getters, setters, and constructors, ensuring that method names remain consistent when fields are renamed.
  3. Overview of Redis as a Caching Solution

    Redis is a high-speed, non-relational, key-value pair storage system that keeps data in memory to ensure fast read and write operations. It is primarily used in high-concurrency scenarios to reduce database pressure by serving the majority of read requests (typically 80% of internet traffic) from memory rather than disk.
  4. Overview of AspectJ AOP Framework

    AspectJ is an Aspect-Oriented Programming (AOP) framework that supports both annotation-based and XML configurations. It allows developers to modularize cross-cutting concerns—such as logging and transaction management—and apply them to an application without modifying the original source code.
  5. Understand Java Data Object patterns (DTO, DO, VO, BO)

    In Java application architecture, different object types are used to separate concerns between the database, business logic, and the presentation layer:

    • DTO (Data Transfer Object): Used to receive data sent from the frontend. It is typically used for input validation (e.g., checking for non-null values, minimum/maximum ranges).
    • DO (Domain Object / Data Object): Represents the entity object. Its properties map directly to the columns of a database table.
    • VO (Value Object / View Object): Used to encapsulate a group of related data to be returned from the backend to the frontend (the view layer).
    • BO (Business Object): Used to encapsulate business logic processing and facilitate data transfer between different services within the business layer.
  6. Compare Process and Thread characteristics

    In the context of browser architecture:

    • Process: A running instance of a program with its own dedicated memory space. Processes are isolated; if Process A crashes, Process B is unaffected. Communication between processes requires IPC (Inter-Process Communication).
    • Thread: A unit of execution managed by a process. Threads share the memory space of their parent process. If a single thread within a process crashes, the entire process typically crashes.
  7. Use Plugins to extend Webpack build functionality

    Plugins are a fundamental part of Webpack's architecture. While Loaders focus on transforming individual resources, Plugins focus on the overall build process. Plugins can hook into various stages of the Webpack build lifecycle to perform complex tasks that Loaders cannot achieve.
  8. Understand Single Page Application (SPA) concepts and trade-offs

    A Single Page Application (SPA) is a web application model that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. All necessary code (HTML, JS, CSS) is retrieved in a single initial load or loaded dynamically as needed. Common frameworks implementing this model include React, Vue, and Angular.

    Comparison: SPA vs MPA (Multi-Page Application)

    FeatureSPAMPA
    CompositionOne main page + multiple fragmentsMultiple independent main pages
    RefreshPartial refreshFull page refresh
    URL ModeHash or History modeHistory mode
    SEODifficult (requires SSR/Staticization)Easy
    Data TransferEasy (shared state)Via URL, cookies, localStorage
    TransitionFast, smooth user experienceSlower due to resource reloading
    MaintenanceRelatively easierRelatively complex

    Pros and Cons of SPA:

    • Pros: Desktop-like responsiveness, better user experience (no full page reloads), clear separation of frontend and backend.
    • Cons: Poor native SEO (search engine crawling), slower initial page load.
  9. Understand Synchronous vs Asynchronous execution in JavaScript

    JavaScript is single-threaded. Synchronous execution means code is executed sequentially; if a piece of code takes time to return a result, it blocks all subsequent code from executing. Asynchronous execution allows a process to be initiated without waiting for it to complete immediately. Instead, the program continues executing subsequent logic and handles the result of the asynchronous call later via a callback or promise, preventing the main thread from being blocked.
  10. Vue.js 3.0 TypeScript Migration

    Vue.js 3.0 was completely rewritten in TypeScript, replacing the Flow type checker used in Vue 2.x. This migration improves code maintainability through better type checking and complex type inference during development. Because the source is written in TypeScript, the framework no longer needs to maintain separate .d.ts declaration files, and it benefits from the broader TypeScript ecosystem and IDE support.
  11. Nginx Overview and Core Capabilities

    Nginx is a high-performance HTTP and reverse proxy web server that also provides IMAP/POP3/SMTP services. Its primary functions include reverse proxying, implementing clustering and load balancing via configuration, and static resource virtualization (making static files like images, CSS, and HTML accessible via URL). Key characteristics include high stability, low resource consumption, a modular structure, and support for hot deployment.