DEV Community

Iteration Podcast

Time and Simplicity

Chapter 5 (Part 2) - Bend Or Break

A weekly podcast about programming, development, and design through the lens of amazing books, chapter-by-chapter.

Tip 40: Design Using Services

  • JP: This is spoken in the context of concurrency (going back to temporal coupling); These service objects are behind well defined interfaces
  • John: "services—independent, concurrent objects behind well-defined, consistent interfaces."

Tip 41: Always Design for Concurrency

  • JP: Thinking linear-ly leads to assumptions and sloppy code and mysterious bugs. Concurrency gives you flexibility
  • John: concurrency forces you to think through things a bit more carefully—you're not alone at the party anymore.

Tip 42: Separate Views from Models

  • JP: Separate your data from your view logic. This buys you a lot of flexibility. You can use common viewers on many different data models. You can support multiple controllers to provide nontraditional input. Your model encapsulates your data and all the common operations with manipulating it.

The view is an interpretation of the model. It doesn't need to be graphical. The controller is more of a coordination mechanism, and doesn't have to be related to any sort of input device.

  • John: Each view should have its own controller.
  • John: Debugging View - interesting concept.

Tip 43: Use Blackboards to Coordinate Workflow

JP: Use blackboards to coordinate disparate facts and agents, while maintaining independence and isolation among participants
John: The blackboard style of programming removes the need for so many interfaces, making for a more elegant and consistent system.
John: "Feed" concept

Picks

  • JP: Programming Elixir by Dave Thomas

Seriously... just look how cool this is.

defmodule MyList do
  def flatten([ [sub_head | sub_tail] | tail]) do
    flatten(sub_head) ++ flatten(sub_tail) ++ flatten(tail)
  end

  def flatten([ head | tail]) do
    flatten(head) ++ flatten(tail)
  end

  def flatten([]), do: []

  def flatten(head), do: [head]
end


IO.inspect MyList.flatten [ 1, [ 2, 3, [ 4 ] ], 5, [ [ [ [ 6 ] ] ] ] ]
# [1, 2, 3, 4, 5, 6]
  • John: Sketch Mirror + Sketch Prototyping

Episode source