Learning Python – Creating and Using Class Objects

A class is the core concept of object-oriented programming in Python. Below, I will comprehensively introduce how to create and use class objects. 1. Basic Structure and Creation of Classes 1. The Simplest Class class EmptyClass: pass # Empty class, using pass as a placeholder # Create object instance obj = EmptyClass() print(obj) # Output: … Read more

C++ Primer Chapter 1: Control Flow and Classes

1.4 Control Flow “Control flow” refers to the “order of program execution”—by default, programs execute in a “top-to-bottom, left-to-right” manner; however, in practical applications, we need to “determine whether to execute a segment of code based on conditions” (branching) or “repeat a segment of code” (looping). This section introduces the two most basic control flow … Read more

Introduction to C++ Classes and Objects

Introduction to C++ Classes and Objects

1. Preliminary Understanding of Procedural and Object-Oriented ProgrammingThe C language is procedural, focusing on processes, analyzing the steps to solve problems, and gradually solving problems through function calls.●C++ is object-oriented, focusing on objects, breaking down a task into different objects, and completing it through interactions between objects.2. Introduction to Classes●In C language, a structure can … Read more

Introduction to Object-Oriented Programming in Embedded C++

Introduction to Object-Oriented Programming in Embedded C++

Follow our official account to keep receiving embedded knowledge! 1. Comparison of Object-Oriented and Procedure-Oriented Programming Imagine you want to build a house. Procedure-Oriented: It’s like you are doing everything yourself. Your thinking is linear: “First, I will move bricks -> then mix cement -> next, build walls -> finally, put on the roof.” You … Read more

A Simplified Understanding of TCP, HTTP, SSE, and WebSocket

A Simplified Understanding of TCP, HTTP, SSE, and WebSocket

Features TCP HTTP SSE WebSocket Communication Direction Bidirectional Request-Response Unidirectional (Server → Client) Bidirectional Underlying Protocol IP TCP HTTP TCP (Initial handshake is HTTP) Protocol Layer Transport Layer Application Layer Application Layer Application Layer Core Advantages Reliable, Stable Simple, Stateless, General Lightweight, Auto-Reconnect True Duplex, Low Latency Main Disadvantages Complex Protocol, High Overhead Header Redundancy, … Read more

Analysis of Streaming Technology for Large Language Models: From SSE, HTTP/2, gRPC to Nginx Applications

Analysis of Streaming Technology for Large Language Models: From SSE, HTTP/2, gRPC to Nginx Applications

What is SSE Server-Sent Events (SSE) is a unidirectional communication protocol based on HTTP that allows the server to actively push data to the client. Unlike the traditional request-response model, SSE establishes a long connection, allowing the server to continuously send event streams to the client. Core Features Client initiates SSE request Receives 200 OK … Read more

The Correct Way to Open Python Classes: The First Step from Beginner to Advanced

The Correct Way to Open Python Classes: The First Step from Beginner to Advanced

Most people learning Python get stuck on “classes” at some point. When first encountering them, many feel, “This is so abstract, like the legendary programming black magic?” 😵 Don’t panic; classes are not that mysterious. You can think of them as common “molds” or “templates” in life. Just like a tailor needs a template to … Read more

Understanding Recent Changes to HTTP+SSE by MCP: Streamable HTTP

Understanding Recent Changes to HTTP+SSE by MCP: Streamable HTTP

Anthropic has introduced the Model Context Protocol (MCP), aimed at standardizing the communication between large language models (LLMs) and the “external world” to enhance their capabilities through tool/function support. The idea is that if we can simplify this integration, we can focus on powerful tools rather than custom integration code. MCP is thriving, with new … Read more

Python Programming – Encapsulation of Classes

Python Programming - Encapsulation of Classes

Encapsulation is the most core characteristic among the three major features of object-oriented programming. Encapsulation is the “integration” mentioned above (integration is an informal term, but it is relatively more vivid). The definition of encapsulation: hiding the attributes and implementation details of an object, only exposing interfaces to the outside, and controlling the access level … Read more

Classes and Instances in Python

Classes and Instances in Python

1 Problem In Python, classes and instances are both a focus and a challenge. They make the code more logical and clarify the relationships between instances. A class is a template used to define the properties and structure of objects, while an instance is a specific object created from a class, possessing the properties and … Read more