Building a zero-glue code web app with Starcounter

Marcin Warpechowski

Starcounter

June 2015

What is glue code?

glue code (uncountable)

(computing) Code that serves to connect separate parts of a program for compatibility or interoperability.

 

Considered necessary evil.

Why there is glue code

  • Connects independent software components

 

 

  • Connects black-box software, services, systems

Glue code between 
software stack layers

 

 

Horizontal glue code between applications

Why there is glue code

  • Connects independent software components

 

 

  • Connects black-box software, services, systems

Where does it pile up

Data model

ORM

Business logic

Application logic

Service logic

Client view

Client logic

Microservices

Scalability-related

Glue code between software stack layers

LOC

DEV TIME

Where does it pile up

Glue code between applications

How do you deal with the need for glue code

Seek for patterns

Seek for patterns,

best practices

How do you deal with the need for glue code

Seek for patterns,

best practices,

frameworks &

tools

How do you deal with the need for glue code

Seek for patterns

best practices

frameworks &

tools,

conferences

How do you deal with the need for glue code

How much of code is glue?

From 25% to 95% of the code is glue code.

 

A line of glue code costs 3 times as much as a line of regular code.

Why glue code is an anti-pattern

  • Leads to spaghetti code
  • Ugly Creative hacks are here
  • Goes through endless reorganization/refactoring
  • Likely to be thrown away at some point
  • Leads to developer frustration
  • Is a gray area of SLAs
  • Often overlooked in development effort estimation

How to get 

zero glue code

between application layers

Data Model

Controller

View Model

View

Data Model

Controller

View Model

View

Demo time

What we removed

Data model

ORM

Business logic

Application logic

Service logic

Client view

Client logic

Microservices

Scalability-related

Collapsing the stack

LOC

DEV TIME

What we left

Data model

Business logic

Application logic

Client view

Only the meaningful parts of your app

LOC

DEV TIME

How to get 

zero glue code

between applications

Database and screen as the only integration points

Icons by Iris Sun, James Fenton / Noun Project

Partial app responses merged before sending to client

All apps bind or map to the same data model

Demo time #2

Thanks!