Open tyteen4a03 opened 7 years ago
This post from @xainey really helped me understanding classes and develop an own style.
But I always struggle about things like this:
So maybe it's worth thinking about a style guid for the syntax and a best practice for the usage itself?
I think the only time where I would consider it a mandatory requirement to have a class is for input validation where you need a specific type of object with a specific set of properties. I would also include a constructor that can take any PsCustomObject provided it has the right properties (and would otherwise throw an error), as well as one that simply takes all necessary properties as input.
As for combining objects, I believe Join-Object
is capable of this regardless. If you wanted this join to result in a different class, you could do the join in a constructor.
It would be nice to have PS Style Guides for classes as well.