|Perl Monk, Perl Meditation|
High level OOP queryby packetstormer (Monk)
|on Oct 24, 2013 at 11:24 UTC||Need Help??|
packetstormer has asked for the wisdom of the Perl Monks concerning the following question:
This isn't really a detailed technical question, it's more a "accepted norm" query. As I have thought myself Perl without any immediate "go-to" person (there is nobody in my work environment that knows anything about coding!) I find I that I am struggling with coding practices and principles a lot.
I have recently moved from small (under 1000 lines) scripts to larger, modular, OOP projects. I won't lie, I am finding the concept a little difficult, especially coming from a non-coding background! Anyway, my question involves the creation of an instance and specifically how acceptable it is to modify it. Example:Suppose this simple code:
As you can see I am creating an instance with a $config hash ref with certain information. However, is it the "norm / acceptable", as above, to check the argument and based on a value then modify it.
OR, is it better/normal to create a "blank" instance and then pass that into another method to change/modify?
OR, the third option: I am getting way to bogged down on what is the "norm" and I should worry more about my apparent lack of understanding of how OOP works!