Sounish Nath Profile picture
Software Engineer @ Tata Consultancy Services | Data Cloud & AI

Dec 12, 2022, 6 tweets

Strategy Design Pattern:
===================
The Strategy pattern is a design pattern that enables selecting an algorithm at runtime. Let's check the #Python implementation step-by-step that I learned.
#programming #SoftwareEngineering

Step: 0/
Creation of `Base Strategy` abstract class model with necessary functions as `abstract method`.
#Python #programming #SoftwareEngineer

Steps: 1/
Implement the BaseStrategy model to your relevant class model implementation, likewise FIFO, FILO, and Random in my case, and code the functionalities.

Steps: 2/
Driver Class likewise `TicketBookingSystem` and function like `process_tickets()` with fn. parameters `base_model_strategy` class model.
#Python #programming #SoftwareEngineer

Steps: 3/
Check the implementation with `concurrent.futures.ProcessPoolExecutor` to parallelly execute and process the data.
#Python #programming #SoftwareEngineer

Execution Outputs:
Thanksgiving:

Thanks to @ArjanCodes for helping me to understand the design patterns in python in the easiest explanation, super helpful. I will suggest anybody refer me.
#Python #programming #SoftwareEngineer

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling