Git Product home page Git Product logo

ziggurat's Introduction

Ziggurat Example App

This is a (spartan) example app to illustrate the components of a Ziggurat app architecture and how they fit together. This app architecture is being used at Square to improve testability and prevent massive view controllers.

This app only does one thing, which is add a pre-computed discount amount to a cart.

This simple app is very similar to the original app I wrote to test if this app architecture is feasible, and to give the idea tangible form.

Since the inital prototype, we've grown an app that uses the Ziggurat architecture to over 69,000 lines of Swift code.

Components in more depth

  • A Service contains most of the app’s business logic and is the only layer that can mutate underlying state. This separation guarantees immutability at all subsequent layers. It can trigger I/O, as well as parse input. It may also communicate with other Services.
  • A Repository wraps I/O details so they don’t permeate the rest of the app.
  • A Presenter queries the Service objects to generate a ViewModel. It has no state.
  • A ViewModel is passed into a ViewController in order to update it. It is an immutable struct which contains simple types.
  • A ViewController manages a view hierarchy and responds to user actions, as in Cocoa. In accordance with a one-way data flow, ViewControllers cannot query other objects, instead, they are updated with new data when it is available through update().
  • A View is appearance-centric, and owned and managed by a ViewController, as in Cocoa.
  • A Renderer listens to signals that state has changed, and coordinates the app update.
  • The Context is a lazy object graph, used for dependency injection, and is owned by the AppDelegate.

ziggurat's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.