svc-component – What is svc-component? – Components



svc-component – What is svc-component? – Components

0 0


svc-component-talk

Gilt Architecture Summit Lightning Talk

On Github chrhicks / svc-component-talk

svc-component

What is svc-component?

Manages component configurations and pages

but really, it takes this...

and turns it into this...

Why Components?

  • Independent & reusable
  • Empowers the business (the admin)
  • Easy creation and maintenance
    • quick turnaround for big ticket sales
  • Evolution of LOSA

Components

package com.giltgroupe.web.render

/**
 * The interface for all components. The idea is to only call
 * "thing.render" in your views.
 */
trait Renderable {
  def render: String
  def renderJs: String = ""
}

This is what a component really is.

  • Components don’t care about the frontend
  • They dont actually have to include any assets
  • Just have to return a string

  • Many components to choose from
  • Can be arranged in any way to create pages

Pages

But really about pages

  • Defines an order to the components.
  • experience changes based on order

Page Properties

  • Type
  • Key
  • Start date
  • Components

Moments!

There are moments, but...

  • but no moment 'system'
  • simply a side effect of how we use pages

Pages are scheduled

/* All Pages extend this */
trait Scheduled {

  def startTime: DateTime

  def channels: Set[Channel]

}

Then find the 'moment'

trait Scheduler {
  /* Returns the item with the most recent start time
   * with the given channel. */
  def findCurrent[T <: Scheduled](collection: Iterable[T],
  																channel: Channel) : Option[T]

  /* Returns the item that is active for a specific date and time. */
  def findForTime[T <: Scheduled](collection: Iterable[T],
  																channel: Channel,
  																dateTime: DateTime): Option[T]

  /* Returns the current scheduled item, if there is one;
   * or the next scheduled item (in the future). */
  def findCurrentOrFuture[T <: Scheduled](collection: Iterable[T],
  																				channel: Channel) : Option[T]
}

There's more!

Take what we’ve done for Structured Sales and Showcase Detail and extend it to Mosaic and Homepage.

Thanks!

ninjas@gilt.com if you want to know more