From the course: JavaScript: Patterns
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Abstract factory pattern - JavaScript Tutorial
From the course: JavaScript: Patterns
Abstract factory pattern
- [Instructor] If you were to take the concept of factories further. The next step would be the abstract factory pattern. Where you abstract the factories and are able to create multiple factories, classes et cetera. So in our car example this would be a car company overseeing multiple factories. So lets take a look at what it would like in code. So lets go and copy what we have for our class car and our car factory and simply create new ones for SUV's. So what I'm going to do, is first copy all this. Like so and then paste it below. And this is going to be the SUV. So lets go and name this class SUV and then what we're going to do, is create an SUV factory. Pretty much the same way that we have our car factories. So right now what we have is ... Cars or a factory that creates cars and then we have a factory that creates SUV's. So if you want to visualize this. It's as if you had a car factory that creates simple…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.