Skip to content

Pattern: Abstract Factory

justinmann edited this page Dec 24, 2017 · 4 revisions

In SJ, the abstract factory pattern can be implemented using interfaces, as in the below example:

#button(
	click()'void
)

#buttonFactory(
	create()'#button
)

linuxButton#button(
	click() {
		// Handle click
		void
	}
)

linuxButtonFactory#buttonFactory(
	create() {
		linuxButton() as button
	}
)

Clone this wiki locally