Skip to content

ilyabelikin/Design-Patterns-Playground

Repository files navigation

Design Patterns Playgrounds in Swift

These are small examples I made in Swift playgrounds while studying common patterns in software development.

Playgrounds names

Playgrounds with just pattern name are cononical implementations form the course. Some have additional versions like State Machine - Native (see below).

State Machine and State Machine - Native are best examples so far.

Reference materials

Course: Object-Oriented Design with Simon Allardice

Course: Design Patterns with Elisabeth Robson and Eric Freeman

Blog Post: Immutable Swift

"A truth that all programmers know: state management is why we get paid."

Blog post: Singleton Considered Stupid by Stevey Drunken

"The problem is, about 1/3 to 1/2 of them were basically cover-ups for deficiencies in C++ that don't exist in other languages. Although I'm not a huge Perl fan anymore, I have to admit the Perl community caught on to this first (or at least funniest). They pointed out that many of these so-called patterns were actually an implementation of Functional Programming in C++.

The Visitor, for instance, is just a class wrapper for a function with some accumulator variables, something that's achieved far more cleanly with, say, the map() function in higher-level languages. Iterator is a poor man's Visitor. The Strategy pattern is beautiful on the surface, but Strategy objects are typically stateless, which means they're really just first-order functions in disguise. (If they have state, then they're Closures in disguise.) Etc. You either get this, because you've done functional programming before, or you don't, in which case I sound like I'm a babbling idiot, so I guess I'll wrap it up."

Book: Head First Design Patterns

Book: Functional Programming in Swift

More Playgrounds

Design Patterns implemented in Swift – a better collection.

About

Swift way to explore OO and functional design patterns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages