I want to provide some functionality for compiling sources of a specific kind (e.g. java). As the process of compilation needs additional information i need to give in some more arguments and not only the sourcefile. E.g. working directory, compiler parameters and so on.
There are two ways in my mind how to design it:
Using OOP, that means creating a compiler class, saving the additional arguments when constructing a specific compiler object that can then be used for compiling by just providing the sourcefile
Not creating a class for creating objects but just a (static final?) closure in a class and then using curry to pass in the needed arguments and returning another compile function which can then be provided by for example just the sourcefile to compile it
What are the pros and cons? Is there maybe an even better way to get things done?