Saturday, October 24, 2015

Abstract away the object prep work.

It occurs to me that a good use for the factory pattern might be to serve for building out go-to wrappers around the instantiation of objects of third party libraries a developing team does not control itself, and especially so if these objects need to be prepped a little bit after instantiation. Example: I make a Foo and then set the Bar getsetter on it in a second line of code immediately after. Maybe you don't want something like that sprinkled all over your code. Maybe it should be driven from one place.

No comments:

Post a Comment