Let’s do a code review of the plugin as it stands now with 2 custom meta boxes. What do you see? Repeating code patterns. Right? Both the subtitle and portfolio details meta boxes have the same code patterns.
Why is that problematic? Think about it.
- It takes your time to refactor the first implementation to make it’s function names unique.
- It takes your time to copy the first implementation to another and then change all of the specifics including the callback function names.
- That editing time is exponential by the number of implementations, i.e. your time x number of meta boxes.
- The number of error opportunities is equally as exponential, i.e. number of meta boxes x making an error potential.
- If something changes, you have to change it in all of the implementations. That increases your time and the potential to make an error.
Time is money.
Therefore, for our plugin as it is right now, the code review would fail due to repeating code patterns that need to be abstracted to separate the implementation from the meta box handling and generation.
There’s a time to code and …. yup, that sums it up.
Total Lab Runtime: 04:38:42
- 1 Lab Introductionfree 13:01
- 2 Add Another Meta Box - Portfoliopro 11:05
- 3 Code Review - Repeating Patternspro 07:17
- 4 The Reusable Mindsetfree 07:52
- 5 Separating Implementation from Business Logicfree 06:31
- 6 Plan It Outpro 06:35
- 7 Laying Out the Architecturepro 08:16
- 8 Configuration Model - Add Parameterspro 11:58
- 9 Configuration Model - Render Parameterspro 10:36
- 10 Configuration Model - Save Parameterspro 07:23
- 11 The Implementation Configurationspro 08:33
- 12 Fix the Config Modelpro 01:53
- 13 Architect the ConfigStore - Part 1pro 07:33
- 14 Architect the ConfigStore - Part 2pro 13:34
- 15 Loading the Configuration into the Storepro 16:04
- 16 Get Configuration or Parameter from the Storepro 12:43
- 17 Wire Meta Box to the ConfigStorepro 13:03
- 18 Merging Configuration with the Defaultspro 10:50
- 19 Get Only the Meta Box Keys From ConfigStorepro 22:29
- 20 Rethink the Save Functionalitypro 07:58
- 21 Is it Okay to Save?pro 05:41
- 22 Remap Custom Fields Config for Savepro 11:54
- 23 Fix the Default Mergepro 18:03
- 24 Walk Through & Test Our Save Functionpro 08:53
- 25 Improving the Renderpro 09:30
- 26 Optimization, Review, & Housekeepingpro 10:13
- 27 Wrap it Upfree 09:14