Member-only story
DRY vs WET Principles — Php Implementation
DRY (Don’t Repeat Yourself)
Every developer should know that repeating codes is not a preferable approach. Think that you have admin panel and you will have lots of forms in your code base. You will repeat all the inputs and other elements again and again. This will take much more effort and time. Why a person do this to himself/herself.? Such as think that you are using Laravel. You can create view components and you can reuse instead of repeating your codes again and again. This will be a really timesaver. And you can use your efforts to other things.
What is the pros of this principle?
- Maintainability
- Readability
- Reuse
- Cost
Maintainability
We can say the best advantage of DRY is maintainability. When creating reuseable codes and when changes needed we can change all things in just one file. You don’t have to search other files to do changes. You can change at one place and you can finish your work. This makes you app maintainable and sustainable.
If the logic of checking permissions was repeated all over the code, it becomes difficult to fix issues that arise in the repeated code. When you fix a problem in one, you…