Migrating to Adobe Commerce - In-Process coding standards
- Topics:
- Best Practices
- Backend Development
CREATED FOR:
- Beginner
- Developer
Learn some essential coding standards and best practices for PHP, JavaScript, and customizations. Whether you’re a developer or a business, this set of tutorials help you navigate the complexities of migrating to Adobe Commerce, ensuring a smooth and successful transition.
Who is this video for?
- Developers: looking to Enhance their skills in Adobe Commerce migration and coding standards.
- Businesses planning a migration to Adobe Commerce and seeking best practices.
Video content
- Learn best practices for PHP, JavaScript, and customizations to ensure a smooth migration.
- Gain insights from Adobe experts on preparation, performance, and security for successful Adobe Commerce projects.
Transcript
This is Russ with Adobe, and this will be an overview for following in-process coding standards when migrating to or using Adobe Commerce. What I mean by this is when doing software development inside the commerce application, for example, code that lives in app code or creating functionality to be included as part of the code that’s eventually found under the vendor folder. And on the flip side, if you’re using App Builder for extensibility to create new features or perhaps an external front end based in React or PWA Studio, then you should be following those coding standards. They don’t apply here. For customizations to the native out-of-the-box themes, you would continue to follow these coding standards, the Magento coding standards as well as any of the other native ones like jQuery that you would be running into. When it comes to the Adobe Edge delivery services, because it’s also an external system outside of the core application, we don’t have any direct standards. Instead, you need to follow those standards and recommendations found on Experience League and whatever place that you have on your own development team that may not be covered by any other standards. This video and this instruction is only for development in the commerce application. So, the Adobe Commerce and Magento open source editions both follow a few coding standards that all developers should be aware of. The core application is written in PHP. The majority of the PSR1 and PSR2 compliances are expected. Alongside of the PHP compliances, we have the Magento coding standards. The core development team uses the Magento coding standards and it’s recommended that all developers who create extensions or customizations follow these standards. Keep in mind there’s a few exceptions to be aware of, so strict adherence is really not possible. So, if you want an example, we used to use underscores to start a variable name. If you look at the current standards, it says not to do that. The reason is that these original classes were written back when PHP 4 was around and that technique was used to state whether a variable was private or not. We are going through the core application and we do updates frequently and things like this are being changed over time and especially like all new features follow the proper up-to-date coding standards. But just be aware that you might find some of these examples in the code and just remember that those are legacy and the expectation is that you follow the current latest PSR standards. As you gain experience, it’s going to be pretty easy to understand what I’m talking about. This was just meant to keep things realistic as you begin your journey for doing in-process software development for Adobe Commerce and Magento open source. When contributing to the core application or developing modules intended for use on the Commerce Marketplace, these standards are used in automated testing to ensure compliance. Having these same tests in your CI CD pipeline will encourage predictable patterns for your team to work on the project and it provides a higher level of confidence that your entire project is compliant. It also stresses the importance for following these well-defined best practices. These coding standards are explained in great detail in the Adobe Developer Docs and it covers things like code demarcation, PHP, DocBlocks, JavaScript, and several more. Understanding the expectations and following these best practices will help with greater maintainability and readability for your current and future developers on your team. Don’t forget that you can have your developers test their code anytime using the CLI command or even by adding the Magento coding standards to your IDE. Details for how this works is covered very well in the Adobe Developer Docs. Now I’m going to hope that you already have the composer require command established and ready for us to try this tool. Let me give you an example. And there you have it. If you’re on the CLI command on some working code, it will give you some feedback and it gives you an opportunity to make some corrections before you do a commit. Finally, for our Lead Developers, Tech Leads, and Architects, please use the Experience League and the Adobe Developer Docs as references for what is considered a best practice. Refer to them and other coding standards when doing a review of a developer’s code. Making comments, directing them to these useful documents will help them grow and learn good patterns. By continuing to refer these teams to these official docs and tutorials, you’ll help them grow and mature as developers and they’ll produce high quality code needed for the success of your project.
Commerce
- Commerce Tutorials
- Adobe Commerce Cloud
- Getting Started
- Global Reference Architecture
- Help and support
- Edge Delivery Services
- Webinars and events
- GraphQL and REST
- Adobe Developer App Builder
- Store Administration
- Customer Management
- Catalog Management
- Content Management
- Marketing Tools
- Orders and Fulfillment
- B2B for Adobe Commerce
- Tools and External services
- Commerce Intelligence
- Commerce Upgrades
- Back-end Development
- Native Front-end Luma Development
- Headless Architecture