Tag

static methods

0 views collected around this technical thread.

php中文网 Courses
php中文网 Courses
May 14, 2025 · Backend Development

Why Static Methods Should Be Avoided in PHP and Better Alternatives

The article explains that overusing static methods in PHP violates core OOP principles, hampers testability, creates global state, and reduces extensibility, while outlining appropriate scenarios for static usage and recommending alternatives such as dependency injection, service containers, and cautious singleton patterns.

OOPPHPdependency injection
0 likes · 6 min read
Why Static Methods Should Be Avoided in PHP and Better Alternatives
Raymond Ops
Raymond Ops
Apr 18, 2025 · Fundamentals

Master Python Class vs Static Methods, Deep/Shallow Copies, and Decorators

This comprehensive guide explains Python’s class and static methods, compares deep and shallow copying techniques, demystifies decorators, and reveals how variables are stored in memory, providing clear examples and best‑practice recommendations for writing efficient, maintainable code.

Memory ManagementPythonclass methods
0 likes · 13 min read
Master Python Class vs Static Methods, Deep/Shallow Copies, and Decorators
php中文网 Courses
php中文网 Courses
Nov 20, 2024 · Backend Development

Handling Special Cases in PHP Function Object Programming (FOP)

This article explains how PHP's Function Object Programming treats functions as objects, detailing the behavior of $this, static methods, anonymous functions, and call_user_func, and provides code examples to avoid common pitfalls for developers.

FOPOOPPHP
0 likes · 3 min read
Handling Special Cases in PHP Function Object Programming (FOP)
php中文网 Courses
php中文网 Courses
Jan 11, 2024 · Backend Development

Advantages and Disadvantages of Static Methods in PHP

Static methods in PHP allow functions to be called directly via the class without instantiation, offering benefits such as simplicity, resource savings, and reusability, but they also introduce drawbacks like testing difficulty, reduced maintainability, and limited extensibility, requiring careful consideration before use.

PHPbackend developmentcode maintainability
0 likes · 4 min read
Advantages and Disadvantages of Static Methods in PHP
php中文网 Courses
php中文网 Courses
Dec 19, 2023 · Backend Development

When and How to Use Static Methods in Laravel and PHP

This guide explains the appropriate scenarios for using static methods in Laravel/PHP, illustrates their implementation with practical code examples, highlights challenges such as dependency injection, testing, and calling other methods, and offers best‑practice recommendations for maintainable backend development.

LaravelTestingbest practices
0 likes · 11 min read
When and How to Use Static Methods in Laravel and PHP
Java Architect Essentials
Java Architect Essentials
Nov 3, 2021 · Backend Development

Three Ways to Access Spring Beans in Static Methods Using Spring Boot

This article explains three techniques for obtaining Spring beans inside static methods—using @PostConstruct initialization, a static ApplicationContext stored in the main class, and implementing ApplicationContextAware—complete with code examples and detailed guidelines for the @PostConstruct annotation.

ApplicationContextJavaPostConstruct
0 likes · 6 min read
Three Ways to Access Spring Beans in Static Methods Using Spring Boot
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 27, 2020 · Fundamentals

Understanding the Java static Keyword: Variables, Methods, Blocks, and Advanced Uses

This article provides a comprehensive guide to Java's static keyword, covering its use on variables, methods, code blocks, inner classes, static imports, memory placement, lifecycle, serialization, class‑loading order, and common patterns such as logging and the double‑checked‑locking singleton.

Class LoadingJavasingleton
0 likes · 12 min read
Understanding the Java static Keyword: Variables, Methods, Blocks, and Advanced Uses
Python Programming Learning Circle
Python Programming Learning Circle
Oct 17, 2020 · Fundamentals

Understanding Class Variables, Instance Variables, Class Methods, and Static Methods in Python

This article explains Python's class (static) variables versus instance variables, demonstrates how they are accessed and overridden, and details the differences between class methods, instance methods, and static methods, including naming conventions for private and protected attributes, supplemented with clear code examples and expected outputs.

OOPclass methodsclass-variables
0 likes · 5 min read
Understanding Class Variables, Instance Variables, Class Methods, and Static Methods in Python
Test Development Learning Exchange
Test Development Learning Exchange
Sep 6, 2018 · Fundamentals

Python Class Methods and Static Methods Explained

This article explains the differences between Python's @classmethod and @staticmethod decorators, demonstrating their usage through practical examples with a Date class.

OOPPythonclass methods
0 likes · 4 min read
Python Class Methods and Static Methods Explained
Java Captain
Java Captain
Apr 18, 2018 · Fundamentals

Understanding Static Fields, Static Methods, and the final Keyword in Java

This article explains Java's static data members and methods, demonstrates how they are declared and accessed through a Human class example, shows how object constructors can modify static fields, and clarifies the purpose and usage of the final keyword in Java programming.

JavaOOPclass fields
0 likes · 7 min read
Understanding Static Fields, Static Methods, and the final Keyword in Java