Much of the web development process involves a creative approach to resolving a business problem using development tools, skills, design and architecture patterns, and other techniques developed over the years. Some programming solutions might be more efficient than others; some might take more lines of code; some might be better documented, and some might use more straightforward and understandable programming tricks. However, even within certain tolerances of efficiency and maintainability, there is no good software development without proper standardization. Standards refer to formal specifications for doing something in a specific way that is easy to understand by an individual and the whole development team, is easy to maintain and scale over time.
When you plan to develop your site, you should have an extensive checklist of everything you need. Does the checklist also cover standards? Are they necessary and fit your case, or are you overengineering a little? Today’s topic focuses on standards (at the level of a programming language, project, or organization) and their influence on the development process.
What is the purpose of standardization?
Standardization aims to apply uniform patterns, which reduce costs, enable smooth cooperation, shorten the time of performing activities, and reduce the possibility of errors.
In short, the purpose of standardization includes:
- Unification of the activities performed in such a way that the same quality is maintained regardless of the place where they are performed
- Creating criteria for the scheme of their implementation
- Cost optimization
- Eliminating errors and increasing the efficiency of the company
Standardization in web development projects – what is it, what for?
We can assume that standardization in projects is an agreement between people involved in the project to write the code in a predetermined way.
As there are many ways to solve a given problem, it’s a good idea to arrange a specific way to:
- Facilitate management
- Standardize the way the code is written
- Facilitate the project takeover (by another person, client, etc.)
- Improving the atmosphere (as everyone has agreed to some rules, no misunderstanding)
- Improve project implementation and shorten the implementation time
We base our projects on Symfony, which standardizes web development and has ready-made solutions, e.g. session and cookies management, full HTTP protocol support, standardized Dependency Injection approach, and follows SOLID principles.
Sylius and Shopware were created based on Symfony, which sets the development standards we feel most PHP developers should follow.
Generally, a standard can be treated as an average norm, type or model, a product that meets specific requirements, or a pattern. The concept of a standard (in a technical sense), in turn, draws attention to formalization; for example, it can be treated as a document resulting from normalization and standardizing as an activity – it should evolve over time whenever required.
Level #1 of web projects standardization: pure PHP language, PSR rules
Thanks to its flexibility, the PHP language offers many possibilities. On the one hand, it can be used to implement very basic projects; on the other hand, it allows you to implement advanced web applications.
Like everything else, PHP also has its supporters and opponents, and since it is not a new language, many opinions have grown around it.
Some people do not see the point in using PHP; others have no idea about the existence of certain standards. As a result, you can meet bizarre code, full of functions declared where they were not needed, global variables commonly used in methods/functions, HTML, CSS, JS, PHP code mixed within one file, etc. WordPress, one of the most famous open-source PHP projects, is full of anti-patterns, which in public opinion, PHP inherited. But as with any tool, the problem is usually between the screen and the chair. As much as PHP allows writing easy-to-execute yet ugly code, it is full of built-in features and functions, making it able to develop a code that is beautiful, easy to read, maintain and update over time.
To put the shame out of PHP, one day, a group of lead developers from various frameworks sat at a conference meeting and decided on introducing standards for all their projects – the PHP Framework Interop Group project was created. At one table sat i.a. Matthew Weier O’Phinney represents Zend, Fabien Potencier of Symfony, and Jordi Boggiano, responsible for Composer and Packagist. The idea was simple – introducing standards for various PHP-related topics.
All available Standards Recommendations:
- https://www.php-fig.org/psr/ – basic PHP writing standards that allow you to be compatible with the open-source community, telling you how to write some things (e.g. autoloader, caching), how architecture should look + what not to do
- Suggestions for the next standards can be found on GitHub.
Due to the fact that PHP was not standardized in the past and standards have been imposed over time, they are fresh, more understandable, and transparent.
- Nobody forces to use the PSR- *, but it is a good practice. In addition, writing code that complies with these standards may facilitate its later use as libraries or the use of external solutions in your project.
Remember that today PHP is something more like echo “Hello world“; , and around the language itself, many tools have been created to support software development, and it is worth knowing them.
Level #2 of web projects standardization: Symfony framework – Dependency Injection for the win
One of the main benefits of using a complete framework is the standardization of your development. Thanks to the default Symfony file and directory structure, any developer with some Symfony knowledge can take care of the maintenance of any Symfony project. In a matter of minutes, get familiar with the code, make corrections and add new features. The usage of a standardized set of packages, above mentioned composer mixed with good coding practices, strong focus on Dependency Injection and Single Responsibility Principle from Liskov’s SOLID patterns forces the developer not only to learn those tools but also to follow the rules that were proved to work for bigger and smaller projects and the team around the world.
It is worth starting working with Symfony standardization process from their documentation. You will find here a set of rules that developers should follow. These standards are similar to the above-mentioned PSR. In fact, they are based on PSR with the addition of Symfony ones.
Why is it worth sticking to the standards? When developers solve a problem in the core themself and want this solution to be included in the newer version, the source code must comply with Symfony standards and therefore is easy to navigate through, update when required and, what is most important – communicate efficiently, which is usually the weak spot in any project.
Remember that the main advantage of standards is that every piece of code looks and feels familiar; it’s not just about being more readable. Most open-source bundles and libraries used by Symfony also follow the same guidelines.
Level #3 of web projects standardization: Sylius – all the best you can get from PHP and Symfony in a single project
Getting deeper, the third level of the standardization process appears when Sylius comes to the game. It’s based entirely on Symfony, so it kind of inherits the standards from Symfony, and again, it also adds its own standards and tools. For example, it has tools that do static code analysis.
Sylius is an interesting eCommerce solution that allows you to solve common problems in many different ways. It is not a typical eCommerce platform, it is rather an eCommerce framework. Each commit to Sylius (before merge) automatically goes through over 1,200 Behat scenarios and thousands of PHPSpec specifications and tests in PHPUnit.
This eCommerce solution offers the highest code quality, has a strong testing environment, and uses Business-Driven Development (BDD). It means that the tests are written in the business language, which speeds up the testing of the application.
Level #4 of web projects standardization: your organization – rule it all
Standardization allows for easier team management and smoother work. The organization adds its standards that result from internal know-how but nevertheless adheres to the standards of lower levels.
Standardization is an effective way to organize reality. Thanks to it, the organization can quickly notice any irregularities and diagnose them early. Therefore, it is a tool that allows you to fix problems before they grow to larger sizes and get out of control and also allows you to assess the actual effectiveness of the company’s activities. Standardization will enable managers to eliminate activities that do not bring added value.
Standardization at the organizational level results from our experience – both from the projects we have implemented internally and from the previous experience of our developers.
Thanks to the fact that we introduce working standards, we facilitate the internal flow and efficiency of work.
We have created the so-called BitBag Bible, which is an internal collection of good programming practices.
Besides coding practices, it is worth considering the architecture and workflow patterns, such as Continuous Integration and Continuous Delivery, microservices and best-of-breed approach, headless design with OpenAPI usage (you might want to check API Platform for that), middlewares design, etc.
Level #5 of web projects standardization: project – there is always something case-specific
Standardizing project management at the project level is often adjustments that should be made on a client-by-client basis and result from an individual approach. However, there are many benefits to creating a consistent project management experience, no matter the endeavor.
These benefits include:
- Easier handoffs – it is easier for anyone to grab the project for a day and coordinate it/work on it. It also keeps people engaged in the project from messing up a well-organized plan or code.
- Shorter learning curves – when a new person is involved in a standardized project, the learning curve is reduced
- Better client experience – If a client works with more than one person from the same agency, it creates a better experience when documents look the same across projects or communications are handled the same way
The graphic below shows the above-mentioned levels of standardization in an organization in the form of a pyramid. It is an example of how you need to standardize your web projects – starting from the basics and progressing through the more detailed levels.
The standards exist to help people in their work, but the most important thing is their usefulness, i.e., appropriate adjustment to the organization’s actual needs at various levels.
If you are looking for an eCommerce development company to help you run or implement a standardized project based on Sylius, Shopware, or even pure Symfony that will work for years, let us get in touch; perhaps we are the ones you want and need to hire.