Studying design patterns

Sep 9, 2020 PHP oop

#I want to study design patterns

I would like to learn object-oriented design while studying design patterns little by little by referring to the examples on this site. https://www.techscore.com/tech/DesignPattern/index.html/

I’m just getting started, so I think there’s something wrong with the interpretation, so I’d appreciate it if you could comment. Also, I usually use PHP, but it would be greatly appreciated if you could give me some advice that I would often use it in such places.

#Command pattern Quoted below

22.1 What is the Command pattern? In Chapter 22, you will learn the Command pattern. Sending a request to an object is the same as calling a method on that object. Then, the content of the request is expressed by what kind of argument is passed to the method. If you want to send different requests, you have to increase the number and types of arguments, but that has its limits. So make the request itself an object and pass that object as an argument. That is the Command pattern. The Command pattern is a pattern that makes a request a Command object and allows you to use multiple combinations of them.

#Implementation repository https://github.com/TOnodera/Command Following the example on the site, we first implemented and refactored the functionality.

#Impression I read “Why make it object-oriented?” And felt that I understood the merit of improving the readability and maintainability of the code by making it loosely coupled and not using if statements in the main processing part. However, although I understand that each design pattern has its own merits, I felt that I didn’t really understand where to apply it.

I understand that this pattern is also easier to read and maintainability in the refactoring, but it must be used in practice.