In this episode, let’s stop and talk about how you architect your code. Code should be built in modules. These modules are not assembled into your plugin or theme. It’s not snippets of code. Rather, they are complete, fully-tested, ready-to-go component or feature modules. All you have to do is change the configuration and none of the codebase. That makes it a reusable module.
For example, let’s say you are building a theme. In your code libraries, you have modules for:
- and more
The theme you are building needs WooCommerce, bbPress, and Customizer. You can pull those modules into your theme, configure the implementation, and you’re done. No need to change the code within the module. It saves you so much time and reduces your costs.
Let’s talk about how you layout the folders and files within your theme and plugins. PHP namespacing fits this architectural design pattern too.
Keep It Simple, Stupid (KISS) - the best kiss you'll get in code.
Total Lab Runtime: 02:25:26
- 1 Lab Introductionfree 02:59
- 2 What and Why of Namespacingfree 20:15
- 3 Why Namespacing instead of Prefixing?free 12:39
- 4 The Basicspro 17:36
- 5 Fully Qualified Namingpro 06:50
- 6 Callbacks and Namespacingpro 08:00
- 7 Name Resolution Rulespro 12:17
- 8 Using Functions from Another Namespacepro 16:37
- 10 Class Basicspro 12:20
- 11 Practical Example: Convert from Prefixingpro 10:08
- 12 Real World Example: Convert from Prefixingpro 06:14
- 13 Architecture - Building in Packages and Modulespro 08:59
- 14 PHP Examples - Laravel & Symfonypro 02:50
- 15 Wrap it Upfree 07:42