Home > Backend Development > PHP Tutorial > Becoming a PHP Expert: The Missing Link_PHP Tutorial

Becoming a PHP Expert: The Missing Link_PHP Tutorial

WBOY
Release: 2016-07-13 10:37:13
Original
832 people have browsed it

This post is the first of 4 in the "Becoming a PHP Professional" series.

When browsing various PHP-related blogs, such as questions on Quora, Google groups, newsletters, and magazines, I often notice a hierarchy of skills. Questions are similar to "How do I connect to a MySQL database?" or "How do I scale my email system to send more than 10,000 emails per hour without introducing a new server?"

I divide PHP competency levels into 4 levels that may apply to any programming language or major): Beginner, Intermediate, Expert, and Elite.

Level

For PHP beginners, they learn how to use variables, include files, form processing, etc. They learn simple logical structures. Under the guidance of the tutorial, I implemented sending emails using PHP, and even touched on object-oriented programming without fully understanding it. They can also modify several CSS files of WordPress. Armed with this knowledge, they start looking for jobs, but unfortunately usually fail.

Experts are those who have gone through many projects and have rich experience. They have developed many commercial applications, but not entirely using frameworks to do so. They are able to use PHP to develop efficiently with different databases, as well as discuss solutions to problems through meetings. They are familiar with design patterns and can easily implement the project's engineering drawings in code. They stay away from programming procedurally.

EliteProgrammers are those who have worked hard for 10,000+ hours to hone their professional skills. They can write PHP extensions according to their needs, can find bugs just by looking at the source code files, and understand their code layout very well. They work on only the most complex projects and are able to find alternative and creative solutions to problems. They have written some popular books on programming languages, given dozens of lectures, and may even have their own version of the PHP language or a highly successful framework, or both.

So, who belongs to the intermediate level?

Missing Link

How can beginners become and surpass professionals? If a person doesn't know anything beyond basic knowledge, how can he improve his skills, abandon wrong development methods and learn more advanced development methods. This question has been asked to me by many beginners. In order to become an expert, he must first become an intermediate.

The following list indicates the PHP learning journey a person needs to go through to become an intermediate:

Ditch spaghetti code

Many people think that using classes means writing object-oriented code, while using functions means writing procedural code. However, this is wrong. To support this point of view, we assume a widely circulated definition: procedural code is code that does not use classes and objects, while OOP code is code that uses classes and objects as much as possible.

My suggestion is to abandon procedural code entirely. Program in an object-oriented style whenever possible - write classes, encapsulate logic, think about using real-world terminology. The performance advantages of procedural code pale in comparison to the reusability benefits that proper OOP code gives you and the ease with which future developers can continue to work on your project. The objection to this point of view is "But WordPress is procedural!". Frankly, this may sound a bit harsh, but a "WordPress developer" is not really a PHP developer, just like having an Instagram would make you a photographer. Please don’t take this to mean that WP is useless — when you don’t expect to spend too much time developing a blog, a simple site, and small one-day projects, developing with WP will do wonders for you. It's great for people who are in a hurry or don't have a lot of skills, but mastering WP will never make you a professional PHP developer - it uses spaghetti coding and teaches you inappropriate design principles.

Start small. Think of a real world concept and try to represent it in OOP code. Go through some basic tutorials and slowly become proficient in OOP. Stick with writing code in OOP thinking until you understand classes in general, before transitioning to the proper frameworks and confusing terms like "model", "view" and "controller" - all of which are in the clouds. Abstract terms have no solid foundation in OOP.

Analysis of existing projects

Drill down into existing source code where you can find it. For example, check out PHP projects on Github, clone them, deploy to your own host and try to read the code. Every file, every line until you understand what they do.

Look for projects that are well-commented, well-structured, and under ongoing development. Projects updated before 2008 aren't that great if you're going to start using PHP 5.5 - otherwise you might miss out on PHP's latest and greatest features that can make you stand out in an already overpopulated field.

Learn to build your own PHP development environment

It is a very good ability to be able to build your own environment. Building your own environment not only allows you to make minor adjustments based on your situation, but it also allows you to become familiar with building extensions from source code.

Abandon developing on Windows - If your primary desktop environment is Windows, then install virtualization software and run a Linux virtual machine - Windows is not case sensitive, its line endings, and other things are different from capital letters. Most server environments don't match that, and developing on Windows will just cause a lot of trouble, so it's best to develop on a system where you will eventually run the project.

Virtual machines can also help you do some experiments - if something goes wrong, you can start over or roll back. You can try as low as you want without worrying about messing up. It’s important to master the tools, but it’s also important to have a good working platform.

Experimenting on your own will also allow you to become familiar with different servers—whether you use Apache or Nginx, or use Appserver, etc.

Build best practices early

When writing code, make sure you have ample documentation comments, nice indentation, and good structure. When you build a class, project or library, use well-known documentation tools PHPDocumentor, ApiGen) to extract your documentation comments and improve them.

A good IDE is also very worthwhile - using a cross-platform editor can help you set up a new development environment at any time, ensuring that you can focus on writing code rather than wasting time on modifying the keyboard Shortcut keys and themes. Make sure you back up the IDE's configuration files to a place like Google Cloud Services so you can import your configuration files for a fresh installation at any time. A good IDE is PHPStorm, or if you can't afford it, or don't have an open source project that requires a free license, Netbeans is a good choice, and both are cross-platform.

Incorporating best practices early will help your code stay consistent and make it easier for others to read it. Find your style and stick to it - you'll help not only yourself, but others as well. Try to follow the PSR standards (PSR-0, PSR-1, PSR-2, PSR-3) - they are standards for a reason. Most of us use and love these standards, which make everyone's code reusable and readable.

A great and constantly updated resource for a beginner is PHP the right way - learn it and you will be familiar with the latest practices, basic OOP, security, deployment, coding standards and more that I have mentioned and more .

Try different frameworks and choose one

For a long time, PHP was the language used by most frameworks (recently JavaScript has become the most used). Whether this is a reflection of our community or the inconsistent popularity of the language, I can't tell, but the fact remains that choosing a framework can be a daunting task, especially when starting out for the first time.

Have tried most of them and I can wholeheartedly recommend the Phalcon framework for its decent robustness and quality and the fact that it is written in C and installed as an extension to PHP so it is much better than now any framework is faster). However, it’s worth trying out different frameworks yourself.

When you try different frameworks, you will find that the same problems can be solved in new ways. Each framework has advantages that you like and disadvantages that you hate, but more importantly, you will be able to understand the mentality of others, especially the developers of the framework). You'll see new usages and approaches, and best practice is to refactor the same experimental project using as many frameworks as possible. This will help you effectively measure the efficacy of a particular framework: the speed of development using it and its performance.

Don’t underestimate other people’s tips and tricks. Read as much as you can—if you stick with it, it won't take as long as you think. Find a good blog and follow it, read the site's guide, browse the StackOverflow questions and answers, visit the SitePoint forum, subscribe to the newsletter, and follow good resources on Google+. Avoid basic PHP tutorial books—as they are out of date by the time they are published—instead, focus on snippets and guides you can find online that contain the latest code. Even if you come across a topic you've already studied, try reading about it—you'll often discover something new by reading other people's perspectives on the same subject.

If there is nothing to do, try to create something

There's always something to do. Never say “I have no projects to work on” or worse “I’m bored”. If you don’t have an ongoing project to work on—create one. Are you frustrated by a tool you use every day because of its imperfect functionality? Make a better one yourself! No ideas for new products? Then make a copy of an existing one - try rebuilding a basic FaceBook, rebuilding something you already know, just to be able to practice it.

The most important thing is to never stop - if you don’t cherish every hour, you won’t be able to accumulate 10,000 hours! Keep up the good work and keep yourself interested and engaged. Make a simple address book application. Then rebuild it using another frame. and use a different database such as Mongo instead of MariaDB). Stay busy!

Find a partner/mentor

Learning is easier if you have someone with you. Find a partner who shares your passion. Maybe you're one of the lucky few who already has a partner who shares your unique interests. Maybe you have a peer in school or college who would love to start and work hard with you. You can even find a mentor and receive guidance from experts.

Don’t underestimate the power of a partner – if you are a threesome, you will definitely have a mentor!

Summary

When you focus on all of these items and master them as much as possible, when you realize that this is what you want, then keep at it—you are on your way to becoming an advanced PHP developer. Maintain your principles, never give up even if someone around you does) and keep practicing.

If you have some helpful resources and would like to share with us how you have crossed or are crossing the intermediate developer barrier, please leave a comment below and let us know!

Translation link: http://blog.jobbole.com/56560/

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/736531.htmlTechArticleThis article is the first of four blog posts in the Becoming a PHP Professional series. When browsing various PHP-related blogs, such as questions on Quora, Google groups, newsletters and magazines,...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template