You can use factory method design pattern in scenarios where you think the underlying implementation may vary based on parameters at run-time. This is a usual occurrence when working with NetSuite customization related tasks, because you may want to use the same code base for different clients.
While working on our Folio3 Magento Connector for NetSuite, we came across a similar scenario. Basically, we wanted to implement the following functionality for different clients in different ways:
To do so, we used the Factory Design Pattern method in our NetSuite Magento Connector’s code. Basically, we used a class in our code named F3ClientFactory, that was responsible for creating objects based on the current client.
For representing the functionality of all clients, we used a base class called F3ClientBase. This class contained all base functionality that we need to achieve. To override any of the methods, we used client specific classes which could override any method in which we wanted to implement different behavior.
You can use the Factory Design Pattern Method in all of your NetSuite customization code, which will enable you to have a single code base with varied underlying implementations.