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:
http://localhost:10000/users/{id} http://localhost:10000/?method=user.get&id={id}
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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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 is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.
