Simple example of an application of the strategy design pattern, we implement an "antivirus" π‘
One of the dominant strategies of object-oriented design is the "open-closed principle".
Figure demonstrates how this is routinely achieved - encapsulate interface details in a base class, and bury implementation details in derived classes. Clients can then couple themselves to an interface, and not have to experience the upheaval associated with change: no impact when the number of derived classes changes, and no impact when the implementation of a derived class changes.
The Interface entity could represent either an abstract base class, or the method signature expectations by the client. In the former case, the inheritance hierarchy represents dynamic polymorphism. In the latter case, the Interface entity represents template code in the client and the inheritance hierarchy represents static polymorphism.
For the example of this tutorial we will make a mock of an antivirus. AvastCE antivirus has many types of scans: quick scan, deep scan, file scan and others. Not all scans can be run in the free version, for deep scans you must have a pro account. We will use the Strategy pattern to implement the different types of scans that can be run.
Review the implementation of Java code and discover the potential of using the Strategy pattern in the solution of your projects.
You can find much more about how to use this project in our documentation section
This project has an excellent development group formed by ITCR computer engineering students
- Esteban Alvarado - Developer - @estalvgs1999
- Bertha Brenes - Developer - @BerthaBrenes
- Olman Castro - Developer - @Kstro379
- Randall Mendez - Developer - @Hack998
Project developed at the Technological Institute of Costa Rica | 2021 π―
This project is licensed under the MIT License - see the LICENSE.md file for details