Coding Blocks cover image

Design Patterns Part 1 – You Create Me!

Coding Blocks

00:00

The Pros of Having a Factory Class

If you're doing just a ton of if else's or switch statement, this might in your newing up objects based off these if else's then there's probably a good place to have a factory. You can insert and this is probably what your interview question was just a second ago. Yeah, yeah, I was going I was thinking along the lines of if you needed to instantiate multiple different types, but they might all have be based off of a common base class,. Then that's when you would want to use the factory. That way you have only the one place where those concrete types are being newed up.

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app