Rapid Java development for PHP programmers
PHP programmers quickly develop Java, just like we are learning java with a magnifying glass. After so many years of development, java can be said to be very huge. The same goes for learning a new language. There are many online tutorials, which are very large and comprehensive. Generally, you have to study systematically for 30 to 60 hours before you can formally contact project development. The basics are very important, but learning too many basics will make everyone lose the fun of learning and self-confidence. Many knowledge points can actually be made up after the project. Learning on demand is the best way to learn driven by yourself.
For example, the hash distribution, hash collision, and dynamic expansion of hashmap, these are what we need to understand in the later stage to improve in depth. In the early stage, we only need to know how to get the hashmap Just do whatever you want.
Oriented to implement things that we are familiar with
For example, when we develop Web back-end APIs, we first start with commonly used loops/iterations, conditional judgments, additions, deletions and modifications. So can we quickly use java to implement these things that we can do very easily with php?
This will help us quickly improve our self-confidence.
Learning method using analogy
How to implement it in PHP, just implement it again in java.
Finally, in-depth systematic study
After you have implemented some small demos, you can refer to other people's projects. If you just look at other people's projects from the beginning, you may have no idea what others are doing. For example, if someone else uses ConcurrentHashMap, then think about why I use HashMap but he uses ConcurrentHashMap. Look at the open source code with questions and thoughts.
After completing some simple projects, you can go back to systematic study. At this time, there will be different gains.
Finally, when the project needs to be tuned and performance improved, break it down individually and learn in depth to be more targeted and targeted.
The actual battle begins
We use netty to provide high-performance web services. It is simple and convenient to use (netty is not simple) and does not depend on other software. Then think about what are the essential components needed to complete a simple web api server. (In fact, when thinking about this, you must keep in mind that making a simple architecture must be done by heart).
I briefly summarized it:
java basic data type (php also has it, don’t be afraid)
java collection framework ( PHP has arrays, very powerful)
First introduction to maven (php has composer)
Reflection (used in framework routing and other places, PHP Also available)
Serialization (used for data transmission, PHP does not have complex data structures and is N times simpler)
jdbc (database operation To use it, php has pdo)
Get a general understanding of generics, annotations and other syntax (optional)
Use netty to actually develop a web api service (php has swoole)
Java basic data structure, various basic data type packaging classes
Java - Collections Framework high-frequency class example
#HashSet is a set without duplicate elements. It is implemented by HashMap and does not guarantee the order of elements, which means that the order of insertion of the elements is inconsistent with the order of output.
This is actually an old friend of mine. It is often used in redis. For example, we can use it to implement a blacklist, so that the search speed is very fast, and there is no need to query redis remotely. It is directly in the current memory. Inquiry.
ArrayList implements the function of a collection based on an array. It maintains a variable-length object array internally. All objects in the collection are stored in this array and realize dynamic expansion and contraction of the length of the array.
Isn’t this the commonly used index array in our PHP?
HashMap is implemented as a hash table data structure. When searching for an object, its position is calculated through a hash function. It is designed for fast query. The characteristics are fast and non-thread-safe.
First introduction to maven
The basic principle of Maven is very simple. It uses remote warehouse and local warehouse and a core configuration file pom.xml. The jar file defined in pom.xml is downloaded from the remote warehouse. To the local warehouse, each project uses the jar of the same local warehouse. The same version of the jar only needs to be downloaded once, and avoids copying the jar for each application.
This is very similar to PHP's package management tool composer, or composer is designed with reference to maven. Maven is more powerful. Composer needs to be imported for each project. Maven, like git, has a local warehouse. Third-party packages will not be directly referenced into the project, but will be introduced during compilation (yes not convenient). On the other hand, maven is not only a package management tool, but also a project management tool that integrates compilation, packaging, unit testing and other functions.
Implement controller access
Specific requirements: provide an api that allows users to specify user information
Definition interface:
1 2 |
|
Perhaps everyone is already accustomed to the former restful api interface.
Because this requires routing mapping and http method matching, considering the cost of learning, I did not choose this method.
Our goal today is to implement our functionality in the simplest and most effective way.
We first implement it in the simplest way (in fact, the API without routing is the fastest, after all, less judgment needs to be made).
The above content is how PHP programmers can quickly develop Java. I hope it can help everyone.
Related recommendations:
A PHP file upload class sharing_php example
php image watermark adding, compressing, and cutting encapsulation Class
The most complete PHP regular expression in history_regular expression
The above is the detailed content of Rapid Java development for PHP programmers. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Java is a popular programming language that can be learned by both beginners and experienced developers. This tutorial starts with basic concepts and progresses through advanced topics. After installing the Java Development Kit, you can practice programming by creating a simple "Hello, World!" program. After you understand the code, use the command prompt to compile and run the program, and "Hello, World!" will be output on the console. Learning Java starts your programming journey, and as your mastery deepens, you can create more complex applications.

Java Made Simple: A Beginner's Guide to Programming Power Introduction Java is a powerful programming language used in everything from mobile applications to enterprise-level systems. For beginners, Java's syntax is simple and easy to understand, making it an ideal choice for learning programming. Basic Syntax Java uses a class-based object-oriented programming paradigm. Classes are templates that organize related data and behavior together. Here is a simple Java class example: publicclassPerson{privateStringname;privateintage;
