Git Product home page Git Product logo

component-intro's Introduction

Introduction to Component and the reloaded workflow

This is my introduction to Stuart Sierra's Component library and the reloaded workflow, given at the aarhus.clj meetup #3.

Beginning

This is where we left off after mettup #2; a functioning webservice with an internal storage to hold integers.

We will convert this example to use the component library in four steps, with a bonus fifth step. Each step isolates one part of the service and plugs it into what will become the final system.

Step 1: In which we wrap the run-server function in a component

Since the run-server function is at the heart of our little webservice, this is where we begin.

Step 2: In which the handler routes are wrapped in a component

Because of the operations on the store found inside the call to defroutes we know the routes have to be componentified before the store.

Step 3: Where a store changes place

Finally we can integrate the store into our component system. This also concludes the rewriting of our actual application logic.

Step 4: Introducing custom profiles

In order to use all the work we did in the first three steps for anything useful, we need to inject some code in our REPL. This is done by adding a file containing the namespace user to the source path.

Step 5: Frosting the cake with proper shutdown

When developing component systems, individual parts often acquire connections to external services. Such connections may need to be terminated properly to let the external service know your system is no longer using it.

component-intro's People

Contributors

mdiin avatar

Watchers

James Cloos avatar

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.