<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Polyglot]]></title>
  <link href="http://markfussell.emenar.com/atom.xml" rel="self"/>
  <link href="http://markfussell.emenar.com/"/>
  <updated>2016-01-26T12:28:29-08:00</updated>
  <id>http://markfussell.emenar.com/</id>
  <author>
    <name><![CDATA[Mark Fussell]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Polyglot DevOps]]></title>
    <link href="http://markfussell.emenar.com/blog/devop-1/"/>
    <updated>2016-01-02T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/devop-1</id>
    <content type="html"><![CDATA[<p>During the last decade, I did quite a bit of launching IT and product operations for products as a &#8216;sidelight&#8217; of my main product
development work.  Build the product, launch it operationally, and grow/maintain it going forward.  This pretty well matches
the responsibility of a DevOps role as people are now using the term, so I seem to be among the earlier &#8216;DevOps&#8217; people.  At
first I had a Data Center (racks in Hurricane Electric), later VMWare ESX on the Data Center, later servers running in
other people&#8217;s Data Centers (e.g. RackSpace), and then servers running in true clouds (e.g. AWS, GCE, etc.)</p>

<p>A number of tools have appeared to help automate operations, and each seems to have a fair number of acolytes.  One of the
issues with software is that there is a lot of it, and it takes quite a bit of time to become familiar with all of (a) software
design, (b) software languages and (c) the problem domain itself.</p>

<p>Although it was not really my &#8216;direct intent&#8217;, over a decade I put in thousands of hours into DevOps.  We needed a running
product and I was more and more concerned that the operations itself needed to be capable and software deployment seamless.  Part of this may have
kicked in when I lost all Thanksgiving vacation in a data center fixing someones very bad IT.</p>

<h2>Comparison</h2>

<p>You really shouldn&#8217;t talk about something you don&#8217;t know, and ideally you know quite a few different things so you can compare
them to each other.  Or you can try to leverage someone else&#8217;s work and evaluation to help yourself go in the right direction.</p>

<p>The &#8216;Taste Of&#8217; series is meant to help people compare different programming languages solving a similar problem.  The &#8216;Architecture&#8217;
series is meant to help people see similarities and differences of architectures solving various problems.</p>

<p>This comparison describes a number of plausible ways to provision and deploy software systems.  Depending on your
goals and background, they are all viable.  Some are clearly better for most teams because they deal with critical needs very effectively,
where others handle needs some teams might have and other would never have.</p>

<p>A list of approaches is below.</p>

<ul>
<li>Copy-Paste Provision – Have a script designed to provision a machine, and copy-paste into the console to make it happen</li>
<li>Machine Image – Have a virtual machine image that you can clone and launch</li>
<li>SSH-Provision – Have a script that executes on any number of machines</li>
<li>Jenkins (Pipeline) Deploy – Have the automated pipeline automatically deploy/provision</li>
<li>Bash-Up – Have a script that a machine can automatically execute when baseline provisioned</li>
<li>Git-Deploy – Have one or more repositories with changing contents and machines watching (PushMePullYou)</li>
<li>Provisioning DSLs:

<ul>
<li>Chef</li>
<li>Puppet</li>
<li>Ansible</li>
<li>Salt</li>
</ul>
</li>
<li>BOSH</li>
<li>Docker</li>
<li>RightScale</li>
</ul>


<h3>Goals</h3>

<p>Software operations is software running.  Development operations is within the development team, and production operations
is for the benefit of users outside the development team.  DevOp Goals can be either for development or production.  Some
of them include:</p>

<ul>
<li>DOG-1: Running the software successfully with the intended amount of usage</li>
<li>DOG-2: Handling spikes of usage successfully/gracefully</li>
<li>DOG-3: Being easy to diagnose and repair issues</li>
<li>DOG-4: Knowing what version (of each/all components) is running in a given environment</li>
<li>DOG-5: Easily deploying new versions</li>
<li>DOG-6: Automatedly deploying new versions</li>
<li>DOG-7: Being able to tune system components to behave optimally</li>
<li>DOG-8: Being able to understand what the working environment looks like and how it works</li>
<li>DOG-9: Not having a single-point-of-failure (SPOF)</li>
<li>DOG-10: Having development and production mirror each other as much as possible</li>
<li>DOG-11: Being able to deploy to a new data center easily</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Micro-Services]]></title>
    <link href="http://markfussell.emenar.com/blog/microservice-1/"/>
    <updated>2016-01-01T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/microservice-1</id>
    <content type="html"><![CDATA[<p>In the last few years, a trendy new term has come up: &#8220;microservice&#8221; and a microservice architecture.
I have been building software for a long time, and have used a service-oriented-architecture (SOA)
and component-oriented-architecture (COA) for many of the applications / systems my teams have built.  Sometimes an industry is missing a shared term for things people have done for decades.  The microservice term
was new to me, so after having some discussions with people from ThoughtWorks and other companies, I wanted to get
a more definitive definition.</p>

<p>So far, this article seems a good intro: <a href="http://martinfowler.com/articles/microservices.html">Microservices by Lewis and Fowler</a></p>

<p>If you read through the core issues that a microservice architecture is trying to address, they seem to distill to this:</p>

<ul>
<li>Have an architecture where you produce working &#8216;product&#8217; continuously</li>
<li>Your &#8216;product&#8217; will be <em>deployed</em> and you need to be responsible for that being successful</li>
<li>Don&#8217;t make the architectural components too big for a team to understand and successfully build and maintain</li>
</ul>


<p>These seem very practical and straightforward architectural guidelines.  In both startups and enterprises, you
are delivering products that the company needs or sells, so you should always have your focus be on achieving that.<br/>
I agree that some teams seem to lose this, so keeping them reminded is a good idea.</p>

<h2>Good Idea, Horrible Name</h2>

<p>Given the above reasonableness of the concept, this would be a good thing to have a good name for.  Maybe something
like:</p>

<ul>
<li>Service-Component Architecture</li>
<li>Business-Service Architecture</li>
<li>Right-Sized Service Architecture</li>
<li>Deployed Service Architecture</li>
<li>Composed-Service Architecture</li>
</ul>


<p>All of the above pull at least some interesting aspect of the solution or problem into the term.</p>

<p>Unfortunately using &#8216;micro&#8217; with service doesn&#8217;t do anything other than imply &#8216;small&#8217; or &#8216;very-small&#8217;.  A &#8216;microscopic&#8217;
entity is too small to see.  A &#8216;microprocessor&#8217; is a processor that is powerful in abilities but physically small.<br/>
I am not sure what word containing &#8216;micro&#8217; that in any way implies what the &#8216;micro&#8217; of &#8216;microservice&#8217; is trying to imply.</p>

<h2>Bad names lead to bad architecture</h2>

<p>You might think this pedantic, but words are powerful.  And the first uses of microservice in the wild I heard were
for services <em>so tiny in functionality</em> that if you scaled to build a system out of them, you would have a nightmare
of managing components.  It is fine to do something small as a test run, but services need to be cohesive and as comprehensive
as possible to avoid spiralling out of control with dozens of service components wired together haphazardly.</p>

<h2>Trendy/Transitional vs. Foundational</h2>

<p>My guess is microservice is somewhat trendy and will die because it is a poor term.  A more appropriate word is again
&#8216;service&#8217; or &#8216;service component&#8217; or &#8216;right-sized&#8217;.  You want an architecture that has a reasonable number of services organized/composed in
a reasonably understandable way.  One way you might organize things is by business function, another is by core
infrastructure capability (e.g. caching), another is by &#8216;rate-of-change&#8217;, and another is by &#8216;risk-of-change&#8217;.</p>

<p>Monoliths are incredibly easy to understand, so they are actually a good starting point.  Your goal is to deliver
a valuable product, so &#8220;start with&#8221; doing that.</p>

<p>As long as you are good at splitting monoliths (dealing with inter-service calls vs. in-memory calls, providing a facade that hides the change, etc.),
and leverage third-party service-components when suitable, you should have a pretty effective architecture.  You can
split early (before production) or later, but keep you eye on delivering valuable product to your company.</p>

<p>Basically review &#8216;Design Patterns&#8217; and think at the service-component level.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[PeerCase: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-8/"/>
    <updated>2015-12-08T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-8</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>PeerCase was a mobile-first medical communication application that enabled community doctors to get expert
advice from specialists.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Epocrates: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-7/"/>
    <updated>2015-12-07T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-7</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>Epocrates was building a mobile-capable EMR.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Vive: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-6/"/>
    <updated>2015-12-06T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-6</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>Vive had a single product: a wellness coaching system designed for both individuals and groups.  I was interested and
partially &#8216;won&#8217; the interview process because I could help game-ify the product.</p>

<h2>Major System Aspects</h2>

<p>When I joined Vive, the system was implemented in Flash and Microsoft .Net on proprietary servers.  This had
a couple big issues:</p>

<ul>
<li>It was meant to be mobile, and especially iPhone</li>
<li>The server code was not really functional</li>
</ul>


<p>So the first architectural change was to move to an iPhone compatible front-end and a Linux based backend.  If the
backend code had been better, the second part wouldn&#8217;t have been done, but given it was a restart, staying in the Linux stack
was a significant benefit, especially on cloud computing.</p>

<p>After doing a Rails project with FooMojo and a couple other ones on my own, I was pretty comfortable with Rails and liked
the productivity improvements it provided from being so opinionated.  At this point the Grails technology was mature enough
to be stable, so I leveraged that to make Vive.  After evaluating a number of front-end technologies, the team and I
picked YUI as being sophisticated enough for the kind of user interfaces we needed (or thought we needed).</p>

<p>Although the product was meant to support iPhones, it was also meant to be &#8216;SMS compatible&#8217; and most of the messaging was expected to be through SMS vs. through email and web capabilities.</p>

<p>A couple more system aspects that &#8216;came later&#8217; or were proposed included:</p>

<ul>
<li>A Unity or similar interactive game environment</li>
<li>Connecting to devices like FitBits</li>
</ul>


<h2>AA-1 : Unifying SMS and a Web UI</h2>

<h2>AA-2 : The curse of the UI, especially for mobile</h2>

<p>The UI on small-screen form factors is very constrained and with a platform like iOS, quite opinionated.  Unless your design team is experienced and skilled at this, it can cause a lot of issues and thrash.</p>

<p>Vive was at the very beginning of WebApps for mobile devices.  Technically, everything was correct:</p>

<ul>
<li>The payload was manifest-based, so updates happened correctly and behind the scenes</li>
<li>There was some amount of client detection to make sure features would work (including on a BlackBerry)</li>
<li>The layout was simple and widgets were large enough to interact with.</li>
<li>And a number of other mobile-oriented aspects</li>
</ul>


<p>Unfortunately there was a core problem of &#8216;fancy&#8217;, &#8216;complex&#8217;, &#8216;changing&#8217;, and &#8216;confused&#8217; for the requirements with the mobile UI and its relation to the desktop UI.
Week upon week a slightly different approach was used that might be &#8216;better&#8217; and needed to be tested out.  The functionality
was always the same: it wasn&#8217;t much more than the SMS interface provided, except you could see what was happening better.
This continuous thrash was a significant overhead to development, slowing work in other functional areas.</p>

<h2>AA-3 : Gamification</h2>

<p>The game-enabling of Vive was important to me: I wanted a race-like environment, or a treasure hunt, or something similar.<br/>
The technologies behind FooMojo (Unity and similar) made this possible, but the prototypes were never moved forward with.
The one gamification that did make it in was that distance competitions (say first team to 100 miles combined) were plotted
out on a map that was a windy course and potentially had realistic terrain (there was a collection of maps,
some of which were terrain-based and others simply geometric)</p>

<h2>AA-4 : Connected devices</h2>

<p>Vive never decided to productize it, but architectural work was done on using connected devices for input.  The market
was still early but Garmin and others had some devices that you could pull data from.</p>

<h2>AA-5 : Grails</h2>

<p>Although not fully capable at the time, Grails was a great productivity booster and made it easy to transition the code to someone else by simply saying &#8220;It uses Grails, augmented by this&#8221;.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[FooPets: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-5/"/>
    <updated>2015-12-05T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-5</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>FooPets had several different products, but all were related to photorealistic virtual pets.</p>

<h2>Major System Aspects</h2>

<p>The core FooPets site was originally framed by Facebook with a small amount of HTML driving a Flash-based interactive game.
The server behind the Facebook content was a Ruby/Rails application with a few standard extensions initially running on a bare linux box.  No automated testing or other code-quality metrics.</p>

<p>For most kinds of software, the logic and user-interface are the hardest things to build.  But because FooPets was
effectively a 3-D movie / game, the content was actually the hardest thing to build: creating photorealistic 3-D pets
took a lot more people-power than making these photorealistic pets behave.</p>

<p>Later there were to be a couple more architectures:</p>

<ul>
<li>An iPhone version of the pets

<ul>
<li>This was purely client initially and then later semi-integrated with the server until the game was killed</li>
</ul>
</li>
<li>The <a href="https://www.youtube.com/watch?v=C72spt5ZL44">HeartPark</a> truly 3-D interactive game (vs. canned limited videos).

<ul>
<li>The game ran in Unity and only talked to the server for leaderboards</li>
</ul>
</li>
</ul>


<h2>AA-1 : Lack of promotions and regression testing is a very bad thing</h2>

<p>FooPets was a very unstable code base for many reasons, but definitely the lack of &#8216;make sure this works&#8217; was a huge
part of it.  Some team members had the ability to modify production directly, and they could do it even before getting
on a plane and disappearing for the holidays.  A promotion model looks like this:</p>

<ul>
<li>Developer tests things on their own machine, and when happy, &#8216;promote&#8217; into the development team server</li>
<li>The development team server tests the new code checkin and sees whether it passes the base line rules for the server

<ul>
<li>If not, it rejects it or starts yelling &#8216;foul&#8217;!</li>
</ul>
</li>
<li>When the development team is happy the development team server&#8217;s code base is good, it goes to the next level (QA, Integration, etc.)</li>
<li>Finally the last QA level is basically the same as production, and the final promotion should be trivial</li>
</ul>


<p>Without this kind of staging model, you are basically just praying production will be about the same as whatever machine you last tested on&#8230; potentially a developer laptop very different from production.</p>

<h2>AA-2 : Sanity testing and automation are very good things, in all kinds of situations</h2>

<p>When I joined FooMojo, I expected to work on the main code base and the iPhone application as the &#8216;most important&#8217; code bases.
These two code bases needed some work, but ultimately the long-pole for the company was <em>content</em>.  And creating content
required a lot of computational power rendering graphics, connecting images into movies, and similar activities that were
only semi-automated.  The biggest productivity improvement was when a few of us focused on making the whole pipeline pretty
much completely automated (with failures identified and easily re-run).</p>

<p>At thirty frames per second, a 10-minute set of clips has 18,000 frames that have to be rendered and composed.  The frames might have different kinds of issues,
but the most likely issue is they didn&#8217;t get rendered at all, which is pretty easy to identify.</p>

<p>So similar to DevOps where you apply software to computer operations, DevGraphics applies software and development techniques to
the graphics pipelines of movies and high-content games.</p>

<h2>AA-3 : Using advanced technology can make things very easy and impressive</h2>

<p>The concept for <a href="https://www.youtube.com/watch?v=C72spt5ZL44">HeartPark</a> started during the post-Christmas &#8220;break&#8221;, and
within less than two months, a fun game was in all users hands.  By combining the skills of a very small team with a very
advance technology (Unity 3D), we went from idea through prototype to live in a very short time.</p>

<p>Sometimes the technologies used could be considered &#8216;prototypical&#8217;: you could never support 1MM with them (say maybe hardware
compatibility issues).  But the importance of figuring out whether you have a viable product for a viable market and pivoting
as you do or don&#8217;t is far higher in value than getting the technology &#8216;perfect&#8217; the first time.  And even more fun: sometimes
the nonviable technology becomes mainstream enough to use by the time you have the right product for the right market.</p>

<h2>AA-4 : Make sure clients &#8220;always work&#8221; or Apple is smart about devices</h2>

<p>A critical rule to getting through the Apple AppStore process was making sure your application obeyed a bunch of rules.
Some of these rules were human-factor rules to make sure the product was pleasant and conformant with iOS.  But one of the
core rules was that applications <em>must work</em> even when the device was not in a suitable environment.  The application
could be thoroughly hobbled by the environment, but it must launch, interact with a user pleasantly, maybe explain
and resolve the situation, and shut down <em>no matter what</em>.  An application / client can&#8217;t fail without explanation or
really at all, it can only behave very restrictedly but properly.</p>

<p>This &#8220;always work&#8221; can then lead you to a decision tree around how well does a client in a degraded environment work.  It definitely must work, but how well?</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Winster: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-4/"/>
    <updated>2015-12-04T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-4</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>Winster was a cooperative social gaming web site that enabled players to win real-world prizes.  It predated
Zynga and Facebook, but both of those companies &#8216;rose&#8217; during the time I worked for Winster.</p>

<h2>Major System Aspects</h2>

<p>Winster had a fairly standard Java backend that dealt with managing player information, talking with PayPal,
and keeping track of prizes, advertisements, and promotions.  This is pretty independent of what Winster was:
almost any commercial consumer site might have these capabilities.</p>

<p>What made Winster interesting is that the client was in Adobe Flash/Flex, it was realtime multi-player, and
the rules of the games were all stored on the server.  This created a pretty compelling environment for
players to interact: players could swap pieces and both be in better shape vs. &#8220;the house&#8221;.  And this interaction
supported a real-time chat system.  So very much like a card-game table without any competitiveness between players.</p>

<p>The client-server interaction was a combination of HTTP calls and socket-based bidirectional updates.</p>

<h2>AA-1 : No important logic on the client</h2>

<p>At Winster players could &#8216;win prizes&#8217; based on playing the games.  A lot of basic games out there put the actual
functionality into the game client (Flash, JavaScript, and even compiled desktop clients).  This is fine if there
is nothing at stake.  Someone hacks the client and they get to play a &#8216;different&#8217; game.  Many games even have
available &#8216;cheat modes&#8217; that make a different game easy to enable.</p>

<p>But if the client can actually impact the business, it has to be securely and correctly implementing business rules.
To enable this, you can try to make sure the client is an unhacked/unaltered version of the correct client.  Or more
simply, you can treat the client as untrusted: it makes request, and the server decides whether they are reasonable.</p>

<p>For Winster, we chose to not trust the client and so every action done on the client that affects the state of the
game went through a &#8216;game server&#8217; that knew the rules of the game.  There are a lot of wins for this:</p>

<ul>
<li>Servers tend to be easier to verify

<ul>
<li>You control the hardware completely, and at least at that time, there were significantly more testing frameworks</li>
</ul>
</li>
<li>Server failure is &#8216;unlikely&#8217; and should be totally visible if you have a problem</li>
<li>You are already writing the server in a particular language, so may more easily be able to augment its capabilities (although some clients have very nice game/event-oriented languages)</li>
</ul>


<p>There are some losses:</p>

<ul>
<li>Latency is guaranteed to be higher, and potentially has to be masked

<ul>
<li>For games like first-person shooters, you need to see the bullet fly even though the server determines the hit</li>
<li>For things like field-validation, you commonly have to repeat yourself on both the client and the server</li>
</ul>
</li>
<li>Clients sometimes have really nice game language</li>
<li>If there are delays in answers, you somehow have to get them to the client asynchronously</li>
<li>As clients scale &#8216;game servers&#8217; scale.</li>
</ul>


<p>The last loss can badly affect your operational profits, especially &#8216;pre-cloud&#8217; which is the timeframe that Winster
was.  We had to have servers big enough to deal with our peak loads and smart enough not to overload themselves.</p>

<p>The server-side game can be much simpler than the visual appearance on the client side (e.g. think the rules of chess
vs. a pretty chess board), but the server-side game has to protect the business rules of the game so people can&#8217;t game the game.</p>

<h2>AA-2 : Socket based client-server connection</h2>

<p>Winster existed before Websocket, Comet, and other specifications and approaches.  To communicate what other players
did within your room / table, the server sent updates through a direct socket.  Making sure customers could connect
with a straight socket was painful for customer support (if a customer was behind a very restrictive firewall) and
required augmentations to deal with &#8216;Flash Policies&#8217; and other aspects.  The advantage of the Game Server approach
was that the socket notifications were just that: notifications that the world was in a new state.  If clients missed
them, they could get updated on a subsequent notification.  Or catch up if initially stalled for some reason.</p>

<h2>AA-3 : Protocol versioning</h2>

<p>On top of the socket communication was a &#8216;V1&#8217; and &#8216;V2&#8217; version of a custom communication protocol.  A great rule to any protocol:</p>

<ul>
<li>Version it!</li>
</ul>


<p>You may not think it will change, but by simply versioning the protocol with a &#8216;V1&#8217; or &#8216;{ &#8220;version&#8221;:&#8221;v1&#8221;, &#8230;&#8217; or
similar you have enabled easily migrating forward with backward compatibility.  In many cases you can never be sure when or
if a client will be updated, so you need to enable continued support of old clients until they are commercially
non-viable.</p>

<h2>AA-4 : AJAX or Send-Data vs. rendering</h2>

<p>Because Flash/Flex is a very high-level UI language, the Java server had absolutely no ability to &#8216;render&#8217; for the client,
so there was a very strong client/UI vs. Server/Data &amp; Rules separation.  You make a request of the server and you get
data back via HTTP / XML or via the socket connection.  This enables the client to swap out and enables the server to
have easier automated testing.</p>

<h2>AA-5 : Logging and Telemetry</h2>

<p>Logging has a number of different purposes.  Three very different ones include:</p>

<ul>
<li>To see if the software has issues / defects</li>
<li>To have a record if a customer asks for &#8216;proof&#8217;</li>
<li>To see what a customer and the systems are doing compared to the business benefit</li>
</ul>


<p>Winster had a lot of logging and telemetry because it (a) needed to work, (b) needed to deal with grouchy customers,
and (c) needed to be very optimized to be profitable.</p>

<p>Logging frameworks and infrastructure improve every year, and it is important to put in the best structure you can
for the purposes you have.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Velidom: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-3/"/>
    <updated>2015-12-03T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-3</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>Velidom came out of the technologies that helped increase velocity, agility, and scale of the Evant
development team.  This was in the mid 2000 time-frame and Evant had created technology which did
mass regression testing on every checkin, enabled continuous inter-team communication (including to India),
and various other major features.  Velidom was an attempt to productize this whole concept: The Velocity
to Dominate with an Advanced Software Development Factory.</p>

<h2>Major System Aspects</h2>

<p>The Velidom Factory was built primarily out of Java-based technologies and VMWare ESX capabilities.  The goal was
to integrate into common tools at the time (Eclipse / Subversion / etc.), automatically launch testing
and deployment servers on any given checkin, verify whether a commit was clean, and either push it through
to the main development line or roll it out based on that verification.</p>

<p>Another side of the factory was an agile development tool that tracked features, their values, the tasks
needed to complete them, and the status of everything.  This was for planning, agility, and measuring.  The
automation was to increase velocity and &#8216;reality&#8217; (if it didn&#8217;t successfully go in, it wasn&#8217;t in).</p>

<p>A final side of the factory was a set of communication tools for both real-time and knowledge accumulation,
where both of these were hooked into the other sides of the factory so what everything was visible and memorable.</p>

<p>If you look at the <a href="http://markfussell.emenar.com/blog/add-1">Advanced Development and Delivery Environment</a> you will see pretty much all of this
vision manifested through other companies&#8217; solutions.  Ultimately Velidom&#8217;s vision was too big to succeed with the
runway the startup had and the events that occurred during its&#8217; lifetime.</p>

<h2>AA-1 : Virtualization and Virtualized Desktops</h2>

<p>Of all the architectural aspects that Velidom got right, virtualizing the infrastructure was almost certainly
the biggest &#8216;Yes!&#8217;.  VMWare ESX was expensive, but having that infrastructure in place made it possible to
think about computation in a way very different from the raw hardware.  Ultimately from Amazon EC2 through to
Vagrant, this separation has come to pass as a higher-level-language of computational hardware.  Virtualized
computers can be built in minutes and discarded after being used.</p>

<p>Velidom provided virtualized desktops and servers as a service, and we spent the money and time
building out the hardware, the virtualized server side, and creating a custom desktop client.  The results were impressive,
leading edge, unreliable, and expensive.  Things were unreliable due to the client-server desktop communication
paradigm.  This needed good networks and a good protocol for the remote desktop.  And given these were development machines, they needed
to be secure, so each had its own private network.  Again, this was too big a vision to succeed at that time.  Focusing
on just servers may have been viable, but it wasn&#8217;t clear what the value was without a large base of customers committed
to good automated test suites (which is certainly plausible).</p>

<p>Expensive is relative, and the virtualization Velidom provided may have been viable except for an event that occurred
in 2006.  Amazon announced EC2, and suddenly the price point of virtualized computers dove to a number no one else
could compete with.  Even 10 years later, there are very few viable cloud providers, and no small ones.</p>

<h2>AA-2 : Tool Integration and Improvement</h2>

<p>One of the core Velidom concepts was the integration between tools (e.g. Eclipse) and the functionality we provided.
We had Eclipse plugins to do things within the factory, including chat, logging, automation, and other activities.
Integrating directly with a tool is nice, but definitely development expensive.  And the tools you are connecting with
(Eclipse and Subversion) may &#8216;go away&#8217;.  In 2005, Eclipse was a good choice, but if we had customers on a Microsoft
development stack, they might have been unsatisfiable.</p>

<p>The core problem wasn&#8217;t picking the right tool, it was picking any tool before having a Minimal Viable Product.  Tool
integration is not part of Minimal Viable: if your product is good at group chat, people will start using it.  A full
suite of products (the Factory) is also not part of Minimal Viable: whether chat or automated regression testing,
just get a product done and in the hands of customers to get feedback.  If they like your product, they will drive
integration with their favorite tools or your other products as an important improvement.</p>

<h2>AA-3 : Reactor</h2>

<p>The last architecture from Velidom that I am going to mention is the &#8216;reactor&#8217; or &#8216;queue&#8217; pattern.  Doing
a mass regression test with servers being created on the fly takes time.  Separating the &#8216;request&#8217; from the &#8216;task&#8217;
to complete the request is very effective for both scaling and also avoiding needless scaling.  If the automation
is fast enough, you don&#8217;t need to scale.  If you don&#8217;t have the extra money to buy the bonus performance,
you also don&#8217;t need to scale.  You can choose whether to pay for time or not.</p>

<p>The one aspect that for a codebase or similar &#8216;team progessive&#8217; activity is whether people wait for things to finish.
Ideally, you are &#8216;unblocked&#8217; while you wait: you can go on to something else.  But in a team environment, many people
are trying to get there work in the main codebase of work.  With Subversion, we had to do some annoyingly fancy tricks
to extract a bad build.  With Git and faster testing tools (in memory databases, better functional test declaration
languages), this is far less of a problem.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Evant: Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-2/"/>
    <updated>2015-12-02T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-2</id>
    <content type="html"><![CDATA[<p>This is a series describing various architectures I have worked with in the last two decades and some of their
benefits and issues.  The table of contents of the series is <a href="http://markfussell.emenar.com/blog/arch-1">here</a>.</p>

<p>Evant was originally named Retail Aspect and provided a Retail-as-a-service suite to companies that were
joining the Web retail boom (e.g. Disney Online).</p>

<h2>Major System Aspects</h2>

<p>The technical foundations of the company were from a
Java / Smalltalk background, so the server technologies were pretty mainstream Java enterprise technologies.
The client was the &#8216;leading edge&#8217; piece in the implementation technology, using a lot of JavaScript back in a very early time
for the language (early 2000s).  The whole system was notable in the number of automated regression tests
it contained (see below).  The database was initially Oracle but later moved to DB2.</p>

<p>Evant had a suite of products that did not succeed as a suite, potentially due to 9-11 causing a shutdown of online
retail activity.  But the Advanced Planning system was of interest to several retailers, including Staples.</p>

<h2>AA-1 (Architectural Aspect): Strong Client, Server-UI, and Server-Domain separation</h2>

<p>In terms of making the Evant Advanced Planning product capable, performant, and testable, there was a very strong
separation between &#8220;Interface&#8221; (UI or Test) and &#8220;Domain&#8221;.  The Domain includes all the business functionality within the planning
engine, exposed by a Java-based API.  It could be driven by either tests or the User Interface.  The API was identical,
so if the tests were successful, the engine was doing the &#8216;right thing&#8217;.  And the UI just needed to:</p>

<ul>
<li>Interact with the interface similarly to the tests

<ul>
<li>Or expand interface and tests for new needs</li>
</ul>
</li>
<li>Present the information pleasantly and effectively</li>
</ul>


<p>The UI could do all kinds of amazing things to transform the results or make actions easier for a user.  Since this was
a JavaScript application, lots of things could happen on the client without server interaction or asynchronously with
the server.  The important part was having a single contract that the two clients (one verifying, one using) could
run against.</p>

<h2>AA-2 : Mass Automated Testing</h2>

<p>The original Evant team was very committed to a full XP (Extreme Programming) approach and used TDD, Paired Programming,
and other aspects of XP as part of their development process.  I arrived after this development period, but there
were a fairly extensive collection of automated tests as part of the development artifacts.  However they were
created, they were incredibly useful for regression testing as we transformed the Domain to be far faster,
more scalable, and flexible.</p>

<p>Initially the tests were in XML to allow a very flexible system of automated testing that (in theory) could have tests
written by subject matter experts or general end users.  This flexibility made it a poor Domain-Specific-Language and
users could not write tests themselves.  The tests were also very repetitive (wet) given they had to describe
many states, inputs, and outputs within a matrix-like space.  Ultimately the solution was to move to a matrix-oriented
tool: a Spreadsheet.  And simply organize states, inputs, and outputs within that spreadsheet.  Automation turned
the spreadsheets into automated test specifications.  And the integration server ran this vast collection of tests
pretty much <em>all the time</em> to make sure nothing regressed (or at least it was identified if it did).</p>

<p>The automated testing was a continuous benefit as long as we could keep performance of the testing servers equal to
developer demands.</p>

<h2>AA-3 : Hidden Storage Model</h2>

<p>An important part of the Domain&#8217;s API was its&#8217; separation of &#8216;transactions&#8217; from its &#8216;storage&#8217;.  The system had
transactional statements (&#8216;update&#8217; and &#8216;save&#8217;) but how those things were accomplished was not visible at the
interface.  This separation prevented callers from caring and fiddling with how things were communicated to the
persistent storage.</p>

<p>Not all systems need this kind of separation: What is the chance you will swap out your database?  With a very different
database?  But the Evant storage model was a Hybrid-relational system with the bulk of the data stored in semi-opaque
compressed format.  So the domain acted transactionally, but under the covers it did a lot of data transformations to
organize and compress facts.  Transformations that evolved in time (different versions had better formats) and evolved
based on the size of the data space and performance tuning around it.</p>

<h2>AA-4 : Canned to Generic</h2>

<p>Another common and useful architectural progression is going from &#8216;canned&#8217; (fully specified) to &#8216;generic&#8217; (very flexible)
capabilities.  You should generally start at &#8216;canned&#8217; so you have super-control over what you are doing and what you
expect its results to be.  This is great for both modeling and testing the system.  As the canned capabilities grow,
they can become unwieldy and need to be more parameterized or even genericized (e.g. an Excel formula built out of
operations).</p>

<p>As you go from canned to generic, you will likely encounter both behavioral anomalies and performance anomalies.  But
if you start with generics that do the same as canned, you can focus on performance.  And then switch to generics that
are more broadly capable and focus on whether they behave correctly.  And then return to performance of these more
broadly capable generics.</p>

<h2>Next</h2>

<p><a href="http://markfussell.emenar.com/blog/arch-3">Velidom Factory</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Two Decades of Systems and Architectures]]></title>
    <link href="http://markfussell.emenar.com/blog/arch-1/"/>
    <updated>2015-12-01T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/arch-1</id>
    <content type="html"><![CDATA[<p>It is now the end of 2015 and for decades I have been reading and writing software in both small and large companies, in startups and established enterprises, and in multiple industries.  My background includes several early languages (C, Basic, Pascal, Fortran, and specialty database systems), but I truly became a serious engineer in Smalltalk.  After doing several systems including IRIS-2 / <a href="http://cargosmart.com/">CargoSmart</a>, <a href="http://www.thefreelibrary.com/McKesson+and+SunScript+Sign+$500-Million+Pharmaceutical+Supply...-a020515184">BidLink</a>, and others, I switched to Java as my primary language.  Since then, I have also worked in Objective-C, Ruby/Rails, JavaScript (client and server), Python, and various other languages.</p>

<p>By building so many systems over the years, I have seen many choices and their impacts.  Sometimes the choice was before me, commonly it was mine and my team,  and sometimes people made choices after I &#8216;passed the system on&#8217;.  This series is meant to document as many of these systems as possible.  Previously I spoke at conferences and disseminated some of our insights.  I may return to that venue, but wanted to get more than a decade of work visible.</p>

<p>The systems, applications, and architectures documented here will eventually include:</p>

<ul>
<li><a href="http://markfussell.emenar.com/blog/arch-2">Evant Advanced Planning</a>: A multidimensional planning system

<ul>
<li>Java, JavaScript</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/arch-3">Velidom Factory</a>: A highly virtualized and automated software development environment / factory

<ul>
<li>Java, VmWare ESX, Subversion (as part of the infrastructure), Flash/Flex, and Eclipse plugins</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/arch-4">Winster</a>: A cooperative online gaming and social site

<ul>
<li>Java, Flash/Flex, MySQL</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/arch-5">FooPets</a>: A virtual pet entertainment site

<ul>
<li>Main Site:

<ul>
<li>Ruby, Rails, Maya, Flash, iOS, etc.</li>
</ul>
</li>
<li>HeartPark: A 3-D world / game

<ul>
<li>Unity 3D, C#</li>
</ul>
</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/arch-6">Vive</a>: A mobile health and wellness application

<ul>
<li>Grails, Java, YUI</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/arch-7">Epocrates EMR</a>: An electronic medical records application

<ul>
<li>Ruby, Rails, iOS</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/arch-8">PeerCase</a>: A mobile-first medical communication application

<ul>
<li>Grails, Sencha</li>
</ul>
</li>
<li>Rumble: A platform to support free-to-play and hiqh-quality games

<ul>
<li>Grails, Kafka, Redis, eJabberd, and a host of other technologies</li>
</ul>
</li>
<li>SnapArch: An architecture to build out a collection of services and applications on top of them

<ul>
<li>Spring, Angular, etc.</li>
</ul>
</li>
<li>ABC: An analytics platform for massive scale machine learning

<ul>
<li>Weka, Python, Grails, Amazon AWS services</li>
</ul>
</li>
<li><a href="http://markfussell.emenar.com/blog/add-1">ADD</a>: A recommended development &amp; delivery environment and platform for The Gap, Shaklee, and others</li>
<li>IRIS-2 / CargoSmart: An enterprise container-shipping logistics system

<ul>
<li>Smalltalk, GemStone, C++, Java, etc.</li>
</ul>
</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[READ: Scaled Agile]]></title>
    <link href="http://markfussell.emenar.com/blog/read-2/"/>
    <updated>2015-11-20T01:00:00-08:00</updated>
    <id>http://markfussell.emenar.com/blog/read-2</id>
    <content type="html"><![CDATA[<p>This is the fourth series describing the ADD: a radically more productive software development and delivery
environment.  This series is on estimation, and the first part is here: <a href="http://markfussell.emenar.com/blog/read-1">ADD: Estimation</a>.</p>

<h2>Scaled Agile</h2>

<p>As mentioned at the end of the first part, the extreme reaction to waterfall was to toss Analysis and Design
away, and go from very-loose requirements into actual implementation.  I believe this was a complete mistake
and has caused these &#8220;extreme&#8221; agile projects to be much <em>slower</em> and <em>unstable</em> compared to another approach.</p>

<p>The alternative is &#8220;Scaled Agile&#8221;, and by this I mean both:</p>

<ul>
<li>It is better designed for larger projects</li>
<li>It is achieved by scaling the activities of software development projects to be appropriate for the scale and needs of the project

<ul>
<li>Analysis &amp; Design efforts, deliverables, and precision can be smaller or larger</li>
<li>Increments of delivery can be smaller or larger</li>
<li>Allowance for iteration (repeating something to refine it) can be smaller or larger</li>
<li>Overlap of activities can be smaller or larger</li>
</ul>
</li>
</ul>


<p>The second item was tossed out with the &#8220;Waterfall&#8221;, at least by many in the industry.  A Waterfall is an extreme version of Agile (basically
no during-build agility), but going directly from verbal or spread-sheet based requirements is a similarly extreme version of Agile
and is unlikely to be as effective as properly-scaled versions of Agile.</p>

<h3>Retail Aspect / Evant / XP / Scaled Agile</h3>

<p>In 2003, while at Evant, we took an XP-based product (an advanced retail planning system) and worked on scaling the velocity and
agility of that project:</p>

<ul>
<li>To a bigger and non-XP team</li>
<li>Through multiple time-zones, including to India</li>
<li>Outside the development team into Product Management, Technical Sales, Marketing, and Support</li>
<li>Into a bigger portfolio of products that had inter-dependent deliverables</li>
<li>Across the portfolio to other product lines and teams</li>
</ul>


<!--more-->


<p>Evant was eventually acquired and folded into a larger company, so much of the memory of what worked well and not about
this was lost.  Except the person who had the &#8216;APT&#8217; charter for Evant is still alive and cognizant.  And maybe a bit
opinionated, but will try to be objective.</p>

<p>Ultimately, I think the scaling &#8220;worked in principle&#8221; but having a pure XP team shift to Scaled Agile is asking them
to give up an almost religious desire to &#8220;Not Analyze&#8221;, &#8220;Not Design&#8221;, and &#8220;Not be Objectively Measured!&#8221;.  If the
software developers really think they can program without being measured around productivity of delivering value to the
customer, you really have to let them go.  Maybe you have a wizard or two that makes crazy amazing things happen and you
don&#8217;t bother putting them into the normal project teams, but beyond that, you need to know if your products, projects,
and programs are <em>delivering a good ROI</em> and how you could make them deliver a better ROI.</p>

<p>To do that, you need to measure.  And returning to COSMIC, it is a way to measure the scale of software functionality.
Which isn&#8217;t the value to the customer of that system, but does reasonable express the complexity in providing the
value to the customer.</p>

<h3>COSMIC Measurement: Analysis and Design</h3>

<p>The COSMIC process is clearly doing Analysis and Design, but in a relatively light and tunable way.  You can control:</p>

<ul>
<li>How much you decompose a system</li>
<li>The detail level and decomposition of the functional users of the system</li>
<li>How detailed you get with &#8220;Objects of Interest&#8221; and their corresponding &#8220;Data Groups&#8221;</li>
<li>What scope of the system you are going to measure</li>
<li>The granularity and formality of the functional user requirements (FURs)</li>
<li>Details around the non-FURs (indirect FURs, non-functional requirements, and other constraints)</li>
</ul>


<p>Doing the COSMIC measurement process is basically doing a minimal Analysis and Design on a system, so you have a good
basis for measuring its size and correlating that to development costs.  But it doesn&#8217;t just support the measurement,
it starts building a model of the user concepts (Object of Interests), their events, the system actions, and the
system components (based on the decomposition level).</p>

<h3>The Hub: Additional (or Not) Analysis and Design</h3>

<p>The COSMIC analysis can be a basis to additional investment in Analysis and Design, but that is optional.  That
is a choice of <em>delivery</em>.  You could have extreme delivery that ignored the COSMIC scope model completely.  Or
you could have extreme delivery that went into Waterfall after the COSMIC model was produced.  Or more sensibly,
you could start working <em>outward</em> from that hub:</p>

<ul>
<li>Does the minimal user concepts start describing a good logical data model?</li>
<li>Does the decomposition work with the implementation frameworks?  Should these be more fully designed or just implemented and noted how they are different.</li>
<li>If there is a lot of data-reading by different functional processes, are these from a single database or many or cached?</li>
</ul>


<p>Note that these &#8216;expansions&#8217; are not meant to alter the Hub: The measurement was done, and you can leave it alone
but leverage it for subsequent activities</p>

<h3>The Hub: Drilling down with COSMIC</h3>

<p>Alternatively, as you do analysis and design, you can produce a new granularity and scope that you want to now
measure again.  This could be done only when things seem to have become <em>very</em> different from original expectations,
or consistently to understand development &#8216;hidden requirements&#8217; or really &#8216;derived requirements&#8217; growth.  The
measurement should still ignore NFRs, but the deeper granularity and the conversion of some NFRs to FURs would
cause a different estimate of &#8216;Joints&#8217; because we have a different (more detailed) view of the system.</p>

<h3>Scaled Agile Manifesto</h3>

<p>I believe the Agile Manifesto was reactionary and extreme.  It had good ideas in it, but was missing core premises
that customers and development teams should expect from a good development project:</p>

<p>Manifesto:</p>

<ul>
<li>The Customer is always right about what they want.  The delivery team should always be honest and informative about what they can deliver and how they are doing it.

<ul>
<li>The Customer can change what they want, change the delivery team they use, but they can&#8217;t interfere within the delivery team</li>
<li>The delivery team should always deliver a functional-requirements-based estimate of a project independent of the technology and other delivery choices, so the customer knows what they are asking for (compared to other projects) and getting (given the delivery approach)

<ul>
<li>Unless the customer clearly says &#8220;I don&#8217;t care&#8221;, in which case the delivery team can choose whether to do the work for their own internal benefit</li>
</ul>
</li>
</ul>
</li>
<li>Unless it helps a customer figure out what they want, requirement-fulfilling working systems are the only true progress of a project</li>
<li>A customer can desire to go forward to later stages (analysis, design, and implementation) before they are sure what they want

<ul>
<li>The cost of responding to change should be minimized while still supporting maximal ROI and velocity if there are no changes</li>
</ul>
</li>
<li>Processes and tools are to support the Customer and Ddelivery team&#8217;s needs, and not ends of themselves.

<ul>
<li>A default or customary usage of processes and tools is appropriate, but should be evaluated if there appears to be no need or even clear counter-benefit</li>
</ul>
</li>
</ul>


<p>Principles:</p>

<ul>
<li>Our highest priority is to satisfy our current customers

<ul>
<li>Through techniques that enable the customer to make good decisions, see verifiable progress toward their goals, and determine if they are getting a good ROI</li>
</ul>
</li>
<li>Our second highest priority is to satisfy future customers even better

<ul>
<li>Through evaluation of what went well and poorly, and looking for ways to give even higher satisfaction (whether ROI, predictability, or in other ways) to customers</li>
</ul>
</li>
<li>Both sides should care about each other:

<ul>
<li>A happy development team that cares about the customer is usually better at satisfying the customer</li>
<li>A customer that truly cares about the development team is usually better at inspiring the team to deliver its best</li>
</ul>
</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD: Estimation]]></title>
    <link href="http://markfussell.emenar.com/blog/read-1/"/>
    <updated>2015-10-23T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/read-1</id>
    <content type="html"><![CDATA[<p>This is the fourth series describing the ADD: a radically more productive software development and delivery
environment.  The first series starts here: <a href="http://markfussell.emenar.com/blog/add-1/">Advanced Development and Delivery</a> and described the core four ingredients
of the ADD.  The second series starts here: <a href="http://markfussell.emenar.com/blog/addstack-1/">ADD Stack</a> and described the application stack and
system components associated with the ADD.  Some of these were Java / Grails specific, and some were more general
components and capabilities.  Together these went through a huge amount of functionality, flexibility, reliability,
and scalability.  Both for the IT infrastructure (whether on EC2 or on bare hardware) and for the applications
on top of that IT infrastructure. The third series starts here: <a href="http://markfussell.emenar.com/blog/add2-1">Advanced Development and Delivery Summary</a>
and gave an executive summary of the ADD.</p>

<p>This series is about project estimation, and is basically <em>orthogonal</em> to the ADD itself.  You can have good
 estimates or bad estimates.  The ADD delivers exceptional productivity.  How much you need to estimate is
 quite independent of productivity.  But by using Estimation and Feedback, you can figure out (a) whether
 to do a project and (b) whether the people you have are up-to-snuff.  If you <em>know</em> you have to do
 a project and you <em>have</em> certain people: don&#8217;t worry about the estimate.  It is irrelevant.  Just &#8220;wing it&#8221;.
 But if you have choices about either (a) whether to do a project or (b) what people to use or even (c)
 figuring out how good your team is after you do a project, then estimations are the core benchmark to
 give you feedback.</p>

<h2>Estimation is crazy-hard</h2>

<p>The problem with estimating is you can&#8217;t be good at it unless you have done something very similar before.  But
most workers in an industry are relatively new to it: less than ten years.  And if each project takes a couple
years to complete, you may have only a couple experiences in your first five years of work.  Change technologies,
change roles, or change organization, and your estimates are likely poorly based.</p>

<p>When something is too hard for someone to do easily, you need to decompose it to make it (a) easier and (b) separable.</p>

<!--more-->


<p>Doing two or more pieces sequentially is commonly easier than doing the whole task at one time.  By easier, I don&#8217;t
mean faster.  It may take more time, especially if there is some interrelationship between the pieces.  But there
is commonly a limit to how much a human brain can do at one time until they are trained.  Over time, the training
in the pieces enables them to be done simultaneously.  Master chefs and similar tend to be trained in all pieces of
  their craft until they can do it all so easily that they can do it simultaneously.</p>

<p>By making the pieces separable, you can have different people work on each of the pieces, and develop the skills
   needed for that piece alone.  Note that this isn&#8217;t &#8220;slicing&#8221; a large piece of work into a smaller piece of work which
   requires all the same skills.  That would be like a chef doing part of the dinner service.  Instead it is
   separating the skills needed for the task: one chef &#8220;Plates&#8221; and just plates, another cooks meats, another cooks vegetables,
   another makes sauces, and so on.</p>

<p>The critical question is then how to decompose?  First we need to define and decompose what we mean by estimation.  And to do
that, we can put estimation into the macro solution-delivery process of software.</p>

<h2>A Framework: READ-OR</h2>

<p>I have been reading and writing software for about 35,000 hours.  Mostly reading, which I believe is the core
to being a great programmer: read great programmers&#8217; code and you will learn from it.  It may be hard to find
great code to read, but you can always start with Smalltalk or find some epic system close to the
kinds of systems you build.</p>

<p>Working through possible acronyms for the bigger software development process, I stumbled upon my favorite word: &#8220;READ&#8221;.
All software is developed through this simple approach and acronym:</p>

<ul>
<li>Requirements of Solution – Given the problem, and what is your solution to that problem?  What does that solution require to solve the problem?</li>
<li>Estimation of Size – What is the estimate of the <em>size</em> of the solution?  Note this is independent of the architecture and technology.  It is the functional size estimate and not the delivery estimate</li>
<li>Architecture – What is the architecture and technology you want to use to deliver this solution</li>
<li>Delivery – Now deliver or consider delivering.

<ul>
<li>Estimate the delivery timeline and costs, and decide if the solution is worth doing.  If not, change architecture or change solution.</li>
<li>If this is a waterfall, deliver once.  If incremental, deliver in increments.</li>
</ul>
</li>
</ul>


<p>And bonus pieces</p>

<ul>
<li>Over – Now the project is either done or the process starts over until the solution solves the real problem.

<ul>
<li>This requires &#8220;Delta&#8221; size estimation.  How much is being added to or modified about a system?</li>
</ul>
</li>
<li>Review – Review the size of what was built (not time, but solution functional size)

<ul>
<li>Determine what you would likely want to improve in the solution, architecture, or delivery</li>
</ul>
</li>
</ul>


<p>So now that we have Esitmation</p>

<h3>Estimation of Solution Size</h3>

<p>The hard part is doing Estimation of Solution Size without getting pulled into the details of architecture and delivery.  We are not
yet good at this as an industry.  We need a body of knowledge and a system to estimate the size of a solution
 independent of the architecture chosen and the team that delivers.  If we have this, we can finally <em>measure</em>
 something useful.  Actually we can measure <em>a lot</em> of useful things.</p>

<ul>
<li>What is the ROI of the solution?  If the solution is really big, there are very few architectures and delivery teams that are going to dramatically reduce the cost</li>
<li>How well do certain architectures do against a particular solution?  For a given delivery team, you can see what they are good at or not.  Going across delivery teams, you may be able to identify <em>better</em> architectures vs. <em>more familiar</em> to the team.

<ul>
<li>What are the differences between the architectures that cause these effects?</li>
<li>Should we change architectures or train more in an architecture?</li>
</ul>
</li>
<li>How well do the delivery teams deliver?  Especially if the solution is about the same size, and the architecture is the same, you should start seeing better and worse results.

<ul>
<li>What are the differences between the teams that cause this effect?</li>
<li>Can we improve the numbers?</li>
</ul>
</li>
</ul>


<p>Estimation of solution size has been attempted with Function Points and more recently with COSMIC Function Points. I
think using the term &#8220;point&#8221; is not quite right, so I am going to recommend being more creative although just a
simple twist on the word.  I propose &#8216;joint&#8217; to capture complexity.  Things with more joints are usually more
complex, and it is relatively linear or even somewhat exponential as you increase the joint count.</p>

<h3>Joints / Moves / COSMIC</h3>

<p>So what should constitute a &#8216;joint&#8217;?  With very little effort in evaluating it (will be starting soon), I believe COSMIC
is a valid starting methodology.  So a COSMIC Point is a Joint.  Not much difference, but at least it splits the
  two issues: How big is it (1000 joints)?  How long is it expected to take to build it (10,000 points)?
  Given COSMIC measure data movements, a joint could be a synonym for a &#8216;move&#8217;, but if we augment the system with
  additions beyond &#8216;moves&#8217; as source of size, then the term would become a misnomer.</p>

<p>More information about COSMIC is here: <a href="http://cosmic-sizing.org/">http://cosmic-sizing.org/</a> and elsewhere online.</p>

<h3>Analysis and Design</h3>

<p>When working through COSMIC terminology and examples, it flashed me back a couple decades to a time that we built software very differently:</p>

<ul>
<li>Software was built from requirements through analysis through design and then into implementation</li>
</ul>


<p>This was called a &#8216;Waterfall&#8217; model because each stage tended to block doing anything for the next stage until
the stage was &#8216;complete&#8217;.  Modern Agile proponents, especially the extremely agile, have basically dropped the stages.
But the stages are useful going both <em>forward</em> (analyse what your system is supposed to do before coding it) and <em>backward</em>
does the analysis seem to plausibly match the requirements?  The analysis and design work was actually not the problem,
it was just the amount of work (if you an analyst, you want to analyze) and the &#8216;blocking&#8217; nature of the work that was
a problem.</p>

<p>A great book on this analysis and designe work was Object-Oriented Analysis and Design (1st edition) which was in several different programming
 languages and dealt with realtime, server application, and other types of software systems.  The second generation can
  be found here: <a href="http://www.sphoorthyengg.com/MCAupload/upload/object-oriented-analysis-and-design-with-applications-2nd-edition.pdf">http://www.sphoorthyengg.com/MCAupload/upload/object-oriented-analysis-and-design-with-applications-2nd-edition.pdf</a>
These methods became parts of UML, which is  again commonly used for <em>heavy</em> analysis and <em>heavy</em> design, preventing the
customer from seeing the actual product early on.</p>

<p>The solution isn&#8217;t to drop the steps, but to scale and time them properly</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Advanced Development and Delivery (ADD) and the ADD Stack – Summary]]></title>
    <link href="http://markfussell.emenar.com/blog/add2-1/"/>
    <updated>2015-10-23T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/add2-1</id>
    <content type="html"><![CDATA[<p>This is the third series describing the ADD: a radically more productive development and delivery environment.  The
first series starts here: <a href="http://markfussell.emenar.com/blog/add-1/">Advanced Development and Delivery</a> and described the core four ingredients
 of the ADD.  The second series starts here: <a href="http://markfussell.emenar.com/blog/addstack-1/">ADD Stack</a> and described the application stack and
 system components associated with the ADD.  Some of these were Java / Grails specific, and some were more general
 components and capabilities.  Together these went through a huge amount of functionality, flexibility, reliability,
 and scalability.  Both for the IT infrastructure (whether on EC2 or on bare hardware) and for the applications
 on top of that IT infrastructure.</p>

<p>This series assumes you have at least skimmed the other two series, but this one is the summary of the other two.
It is an incremental growth of the architecture in a fairly macro sense, where the details are in the other series.</p>

<h2>The three ingredients</h2>

<p>Wait, it was four a moment ago.  The ADD requires four, but advanced project collaboration requires only three.  And
at the heart of the ADD is advanced project collaboration.  Collaboration has no &#8216;machines&#8217;, just people, so we put aside
one ingredient.  The remaining three are the <em>nucleus</em> of ADD:</p>

<ul>
<li>GitHub.com <a href="http://github.com/">http://github.com/</a></li>
<li>HipChat    <a href="http://HipChat.com/">http://HipChat.com/</a></li>
<li>Amazon S3  <a href="http://aws.amazon.com/">http://aws.amazon.com/</a></li>
</ul>


<p>These three ingredients can give individuals and teams 4x or more productivity.  And the reason is the same as for
 ADD.  There are two critical roles in any project:</p>

<ul>
<li>Changers</li>
<li>Watchers</li>
</ul>


<p>The Changers are gonna change, change, change, change and the Watchers are gonna watch, watch, watch, watch.  And
all of the people involve need to see what is going on (in the best way for them) and not be blocked getting things
done by others on the project.  They need perfect transparency.  Which will ultimately build incredible trust,
knowledge, and skill.</p>

<p>The three ingredients form the core of a three-way Venn diagram, that I will draw in hexagonal rings.</p>

<p><img src="http://markfussell.emenar.com/images/add2-1/add2_threeIngredients1.png" /></p>

<!--more-->


<p>Clearly the three make sense with project collaboration, and all three are used by Changers and Watchers.<br/>
Note that &#8216;Annexes&#8217; are part of the collaboration nucleus.  You need annexed repositories for GitHub to be a practical collaboration
tool as resources become large.</p>

<h3>The fourth ingredient and full ADD nucleus</h3>

<p>Now adding the machines in, we get:</p>

<p><img src="http://markfussell.emenar.com/images/add2-1/add2_fourthIngredient1.png" /></p>

<p>And seeing the transformation from the three-ingredient version, we can see the EC2 servers are
not critical for Changers and Watchers to interact with each other.  Except in the sense that any final product
is part of the nucleus that Changers and Watchers want to work on.  For ADD it is a deployed application which
might be on an EC2 server, and for other product development (books, cars, etc.) it would be that <em>product</em> vs.
whatever &#8221;<em>factory</em>&#8221; created the product.</p>

<h2>The Rings</h2>

<p>So the ADD works outward from the inner collaboration nucleus plus &#8216;the machines&#8217;.  In the other series, the tools and
system components built out more and more functionality.  They were not described this way at the time, but
they could be viewed as rings around rings.  As the rings worked outward, a specific ADD was defined
(e.g. one that was Linux and Java oriented) or a specific application architecture was defined
(e.g. on that had workers and relational databases).  All the rings are &#8220;good rings&#8221; in my experience, but
especially as you get further out each ring could be swapped with an alternative &#8216;implementation&#8217; that
 may be more familiar to the team or somewhat more suited to the domain.</p>

<p>The rings I recommend (and recommended in the series) follow.</p>

<h3>Ring-1: Interacting with the Nucleus; EC2, Linux-capable workstations, Web Browsers, Email, and Talking</h3>

<p><img src="http://markfussell.emenar.com/images/add2-1/add2_ring1.png" /></p>

<p>In the bottom right for the machines, I recommend using EC2 as by-far the most mature and capable cloud computing
environment.  Once you are familiar with EC2, you can compare to other clouds (Google, IBM, EMC, etc.) but you
need to see a &#8216;Real Cloud&#8217; before you can evaluate whether another is good enough.  And again, althoug I recommend
EC2, very little in the ADD is EC2-specific and it is always in the little details.</p>

<p>Having Linux-capable workstations provides the best Git, automation, and EC2 tools.  You can be on Windows, but
you will be punished.  Even worse when Ring-2 recommends Linux-Servers.</p>

<p>GitHub works fine for reading with Web Browsers, and you can even do updates with it.  HipChat is the same: it
  has an application, but it is not required.  And although most collaborative activities should be in HipChat,
  getting email notifications are quite effective.  Finally, like other Agile methodologies, direct &#8216;talking&#8217;
  is fine and encouraged, but you need to make sure anything important gets into the collaboration environment
  (HipChat) and similarly make sure anything <em>private</em> never gets into that collaboration environment.</p>

<h3>Ring-2: The machines react and collaborate; Linux-Servers, CloudFormation, Bash, PushMePullYou, Vagrant, and HipChat notifications</h3>

<p><img src="http://markfussell.emenar.com/images/add2-1/add2_ring2b.png" /></p>

<p>Ring-2 is where the ADD starts coming truly alive and the machines &#8216;react&#8217; to the ADD infrastructure as well as
 notify the ADD infrastructure of what is going on.  Linux-based servers (ec2 defaults to a Centos variant)
 are the most flexible, documented, and capable on the AWS (and most other) cloud infrastructures.  So this
 is an obvious choice.  Using Amazon CloudFormations is not required, but is a very simple to understand model and
 well supported in AWS.  Defaulting to using &#8216;bash&#8217; for scripting basically makes you &#8216;agnostic&#8217; beyond the Linux
 part.  People who don&#8217;t know bash programming &#8216;bash on bash&#8217;, but it is a perfectly reasonable scripting language
 with slightly esoteric notation.</p>

<p> The PushMePullYou model is the core to mass, understandable, and fast automation.  You don&#8217;t touch machines, you
 touch Git repositories, push the request (letting everyone know the request), and the machines pull it and react
 as appropriate.</p>

<p> Developers/changers can use Vagrant to run and test everything very much like production is running, including having
  their local machines come into the PushMePullYou model.</p>

<p> Finally, Git, machines, and other components should always post into HipChat so people can see what they are doing.</p>

<h3>Ring-3: An opinionated Java stack and good monitoring / logging: Grails, Spring, Maria, SumoLogic etc.</h3>

<p><img src="http://markfussell.emenar.com/images/add2-1/add2_ring3.png" /></p>

<p>Ring-3 augments the ADD into a good Java-based stack.  Both in production (a JVM running Tomcat) and
 for development (IntelliJ with a Grails/Spring stack).  By this ring we can develop software, deploy
 it, and monitor whether it is functioning properly.</p>

<h3>Ring-4: A good UI framework and any other system components needed: Angular, Redis, etc.</h3>

<p><img src="http://markfussell.emenar.com/images/add2-1/add2_ring4.png" /></p>

<p>Ring-4 finishes off most of our application functionality.  We need to pick a UI framework beyond
 generating web pages / CSS / jQuery (those are all part of Grails) if we want functionality beyond
 the core UI from Grails / Spring.  And we can augment our application servers with any of a host of
 components / technologies (as few as possible, but better to use them then to build ourselves&#8230;
 usually).</p>

<h2>Conclusion</h2>

<p>The ADD can be thought of as rings around a &#8220;collaboration nucleus&#8221;.  The nucleus and the first
two rings define the ADD approach and it&#8217;s benefits, where the subsequent rings tailor
the ADD to the characteristics of good software development and high-quality
production deployment.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-10]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-10/"/>
    <updated>2015-10-22T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-10</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third dealt with the application stack (Grails and other technologies).
The fourth discussed UI alternatives.  The fifth added some major aspects to the stack: Semi-Structured Data, Templates,
and Dual or Isomorphic scripting. The sixth discussed UI frameworks in a bit more detail and ended with an Angular vs.
Ember as a core choice.  The seventh went into logging, analytics, and monitoring of the running applications and nodes.
The eighth was an overview of Federation Components like caches, queues, payment services, and the like.  The ninth
was on a highly reliable, scalable, flexibly, and ultimately very simple worker model.</p>

<h2>WAR!</h2>

<p>Continuing with the worker model, we currently have a non-production Application Server running Grails:</p>

<ul>
<li><a href="http://fed1-app1.aws.gaps2c.com:8080">http://fed1-app1.aws.gaps2c.com:8080</a></li>
</ul>


<p>It is running grails &#8216;interactively&#8217; and &#8216;off-source&#8217;.  This is fast for deployment, but it is missing a few
things that people usually want in production:</p>

<ul>
<li>Well-defined artifact that has been tested and can&#8217;t &#8220;just change&#8221;</li>
<li>A container environment that can provide certain resources to the application (e.g. monitoring)</li>
<li>Removal of having to understand the &#8216;building&#8217; technology from the running technology (JVM)</li>
<li>That production has as few technologies as possible, and is normally missing &#8216;compilers&#8217; so people can&#8217;t tweak behavior</li>
</ul>


<!--more-->


<p>The last item is (IMO) a bit paranoid, and there are better ways to make sure production is stable (tripwires and
logging).  And the third is probably unrealistic for anything but trivial debugging.<br/>
But the first two are certainly reasonable wants.  A lot of people are familiar with deploying wars and deploying
wars on Tomcat and other servers.</p>

<h3>Where&#8217;s the WAR?</h3>

<p>The first issue with changing from source deployment to war-based deployment is &#8220;Where is the WAR?&#8221; and
&#8220;How do I know it has changed?&#8221;.  As with the other weird primary ingredient approaches, the WAR is going to
be in an annexed repository.  And you can see that it changed by simply looking at whether the &#8216;git revision&#8217; of
the war has changed.  This approach gives incredible power and flexibility:</p>

<ul>
<li>You can have as many different versions of the application as you want.  They just each have to have their own &#8216;folder&#8217;</li>
<li>You can easily see which deployments are using which versions</li>
<li>Changing a deployment to use a different version involves copying a 50 byte hash vs. an actual WAR file</li>
<li>Getting the real file is a super-fast call to S3</li>
<li>Bootstrapping the initial version is the same as any other version, which makes it less likely to diverge and break</li>
</ul>


<p>The WARs should be in a different repository from the source for a number of reasons, but the main one being their
rules and rythms are very different.  But the structure of the repositories can be very similar to make it easy to see
the created artifacts.  Something like this:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-10/addstack10_war1.png" /></p>

<p>Note that the contents of the directory could be anything.  And actually a &#8216;trick&#8217; to making the upload much faster
is to use an exploded &#8216;war&#8217; vs. a normal &#8216;war&#8217;.  Why?  Because a WAR contains a bunch of jars that are all almost
 always <em>identical</em> between versions.  So although S3 has basically unlimited space, it is silly to waste it with
 a file that (although different) is 99% the same between each version.  For example, all the identical jars within this
 expanded war:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-10/addstack10_war2.png" /></p>

<p>The trade is that you have a lot more files in the other folders.  Finally, you could do a hybrid where everything but
the lib folder is compressed.  To make the real war, your deployment process would uncompress and then re-WAR the contents.</p>

<p>The performance difference is dramatically different when working outside the EC2 grid, but is less so within that
grid.</p>

<h3>Who deploys what?  The Promotion model</h3>

<p>The deploying server needs to watch something so it can see a change that is relevant to it.  Production does not care
that there is a new QA build.  And QA may not care there is a new development build.  QA never creates its own build,
but it only cares when a development build is &#8220;Good enough to QA&#8221;.  This I call the promotion model.</p>

<p>For any given application:</p>

<ul>
<li>Automated builds occur <em>all the time</em> (whenever something changes) and each gets a unique identifier (e.g. 201)</li>
<li>Each build is then promoted through however many levels of inspection you want

<ul>
<li>If it passes muster</li>
<li>If it has not been superseded by another build</li>
<li>If not, it is ignored</li>
</ul>
</li>
</ul>


<p>With this model, you never <em>go backward</em>, which increases productivity a lot.  And your are continuously trying to
 <em>go forward</em>, which means you have very current information about where you are.  And this also increases productivity.
 Yes, in a pinch, you could see if a build <em>between</em> last success and most current can be promoted.  But that is
 impacting productivity so it should rarely be done.</p>

<p>This also implies there is no branching.  One source.  One set of builds based on that source.  That is not required
by this approach (branch source, new set of builds), but it is strongly encouraged because it again <em>wastes no energy</em>
and it is trivial to flip to a different &#8216;set of builds&#8217; when a branch/back-patch is required.  But the process is
very optimistic while also being very realistic (the world is where it is) and appropriately pessimistic
(you can&#8217;t promote through QA until you pass the automated tests).  Because machines embody the process, you
can&#8217;t subvert it without doing it <em>very conspicuously</em></p>

<p>To be promoted, you just have to be &#8216;copied&#8217; into the right destination.  Promotions are more an &#8216;it&#8217; than
a &#8216;development&#8217; activity, so they are structured under the &#8216;it&#8217; folder.  Each federation (and potentially part)
has it&#8217;s own versions of things.  If you are in &#8216;fed1&#8217; and want the &#8216;grails-petclinic&#8217; application on your
machine, you know where to look: &#8216;fed/fed1&#8217;.  The use of &#8216;common&#8217; vs. &#8216;stacktype&#8217; is mirroring the flexibility
 shown elsewhere.  You could have most deployments use &#8216;common&#8217; and have some override it.  Or most deployments override &#8216;common&#8217;
 but there is a default in case they don&#8217;t.</p>

<p><img src="http://markfussell.emenar.com/images/addstack-10/addstack10_promo2.png" /></p>

<h3>Who builds and deploys?  Custom Worker vs. Chores</h3>

<p>OK, so we need to build and deploy every time a particular repository changes.  We could do that monolithicly
and have no registry of the war being built (it just magically happens), or we could do that in two parts:</p>

<ol>
<li>Detect change in repository: create chore to build war</li>
<li>Detect chore and worker do chore</li>
</ol>


<p>The advantage of the second version is we can decompose figuring out what needs to be done from doing it, and we
also have better visibility and consistency in the process.  Although I like doing things incrementally, I don&#8217;t
think the increment (monolith) is notably simpler than the second, and this was meant to build on our Worker topic.</p>

<p>The critical question is actually &#8216;who is going to write the chore&#8217;.  We don&#8217;t want to have a bunch of chores
created by different workers who all recognized a change was done.  Fortunately, we already have a model for this
 with the &#8216;chore&#8217; ownership.  We need to describe an &#8216;event&#8217; in a way that is related to whatever has changed
 about the world, and then when trying to &#8216;create the chore&#8217; a worker first &#8216;creates the event&#8217;.  Once an event
 is created and &#8216;pushed&#8217;, there is no reason to create it again.</p>

<p>In this case, the event is pretty obvious to describe: a git repository went to a new version or specifically:</p>

<ul>
<li>repo3_miniature-ironman</li>
<li>551b86e42d&#8230;</li>
</ul>


<p>so if an event for that exists, don&#8217;t create another one.  Since this is a simple identification, we don&#8217;t need
the extra directory structure and can simply write a &#8216;.json&#8217; file into the appropriate time directory.  Note the
time should be the time of the &#8216;event&#8217;, not of when it was noticed.</p>

<p>A given event could trigger multiple chores, but in our case we just want to have the one &#8216;build the war&#8217; chore
created.  Note that the chore could be trivial: it could result in <em>no work</em> being done except seeing if a
new WAR is needed.  Chores are rarely &#8216;you must do this&#8217;, but more &#8216;do this if necessary&#8217;.  This alows us to
be fast in the creation of the &#8216;chore&#8217; vs. doing a lot of analysis up front.  Since the worker pool can be
large, we don&#8217;t want any given worker to block the pipeline too much.</p>

<h4>Event structure</h4>

<p>The structure of the event can be anything.  It is nice to have the JSON be declarative of what it is (an &#8216;event&#8217;)
and then have enough information to process the information.  Some human readable information is handy for debugging
and logging.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="nt">&quot;type&quot;</span> <span class="p">:</span> <span class="s2">&quot;event&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;id&quot;</span> <span class="p">:</span>  <span class="s2">&quot;repo3_miniature-ironman_551b86342d&quot;</span>
</span><span class='line'>  <span class="s2">&quot;tss&quot;</span> <span class="p">:</span> <span class="s2">&quot;20151022120009&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;kind&quot;</span> <span class="p">:</span> <span class="s2">&quot;repochange&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;repochange&quot;</span><span class="p">:</span> <span class="p">{</span>
</span><span class='line'>    <span class="nt">&quot;repo&quot;</span> <span class="p">:</span> <span class="s2">&quot;repo3_miniature-ironman&quot;</span><span class="p">,</span>
</span><span class='line'>    <span class="nt">&quot;version&quot;</span> <span class="p">:</span> <span class="s2">&quot;551b86342d&quot;</span><span class="p">,</span>
</span><span class='line'>    <span class="nt">&quot;comment&quot;</span> <span class="p">:</span> <span class="s2">&quot;Just set the javaagent for Java&quot;</span><span class="p">,</span>
</span><span class='line'>    <span class="nt">&quot;committer&quot;</span> <span class="p">:</span> <span class="s2">&quot;markfussell&quot;</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<h4>Chore structure</h4>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="nt">&quot;type&quot;</span> <span class="p">:</span> <span class="s2">&quot;chore&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;tss&quot;</span> <span class="p">:</span> <span class="s2">&quot;20151022120009&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;event_id&quot;</span> <span class="p">:</span> <span class="s2">&quot;repo3_miniature-ironman_551b86342d&quot;</span>
</span><span class='line'>  <span class="s2">&quot;event&quot;</span> <span class="p">:</span> <span class="p">{</span>
</span><span class='line'>      <span class="nt">&quot;kind&quot;</span> <span class="p">:</span> <span class="s2">&quot;repochange&quot;</span><span class="p">,</span>
</span><span class='line'>      <span class="nt">&quot;repochange&quot;</span><span class="p">:</span> <span class="p">{</span>
</span><span class='line'>        <span class="nt">&quot;repo&quot;</span> <span class="p">:</span> <span class="s2">&quot;repo3_miniature-ironman&quot;</span><span class="p">,</span>
</span><span class='line'>        <span class="nt">&quot;version&quot;</span> <span class="p">:</span> <span class="s2">&quot;551b86342d&quot;</span><span class="p">,</span>
</span><span class='line'>        <span class="nt">&quot;comment&quot;</span> <span class="p">:</span> <span class="s2">&quot;Just set the javaagent for Java&quot;</span><span class="p">,</span>
</span><span class='line'>        <span class="nt">&quot;committer&quot;</span> <span class="p">:</span> <span class="s2">&quot;markfussell&quot;</span>
</span><span class='line'>     <span class="p">}</span>
</span><span class='line'>  <span class="p">}</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<h3>Making it happen</h3>

<p>Although I mentioned before that there were &#8216;parents&#8217;, &#8216;workers&#8217;, and that application servers shouldn&#8217;t do any of
this kind of work, with this very clean pipeline it is clear our single application server could easily do all of
this itself.  So just to save on IT, that will be the first version.  After that it is easy to see we could separate
the &#8216;parent/worker&#8217; from the application server.  And although likely not necessary, we could separate the &#8216;parent&#8217;
from the &#8216;worker&#8217; node too.  The reason the &#8216;parent&#8217; doesn&#8217;t need to be separated is we should always have two
parents around and a simple CloudFormation can make sure that is true.  And parents don&#8217;t do that much, so there
is no reason to have them be separate from workers.  With this model, all workers are also potential parents, and
there are always two workers available.</p>

<h4>Detecting the change to &#8216;Repo3&#8217;</h4>

<p>This is actually the same script as before where we just do something different in the &#8216;ActualWork&#8217; source:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>   <span class="nb">echo</span> <span class="s2">&quot;Detected Change in Git Version!&quot;</span>;
</span><span class='line'>
</span><span class='line'>   <span class="nb">export </span><span class="nv">START_TSS</span><span class="o">=</span><span class="s2">&quot;`date +%Y%m%d-%H%M%S`&quot;</span>
</span><span class='line'>   <span class="nb">echo</span> <span class="s2">&quot;Starting ActualWork at ${START_TSS}&quot;</span>
</span><span class='line'>   <span class="nb">echo</span> <span class="nv">$GIT_VERSION</span> &gt; <span class="k">${</span><span class="nv">WORK_DOING_VERSION</span><span class="k">}</span>
</span><span class='line'>
</span><span class='line'>   <span class="nb">source</span> <span class="k">${</span><span class="nv">MY_DIR</span><span class="k">}</span>/work_FindEvent_Repo3_ActualWork.sh
</span></code></pre></td></tr></table></div></figure>


<p>So now we know we have to do the work, but we need to see if it was already done by someone else:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nb">export </span><span class="nv">FIND_EVENT</span><span class="o">=</span><span class="sb">`</span>find work/event -name <span class="k">${</span><span class="nv">EVENT_NAME</span><span class="k">}</span> | head -1<span class="sb">`</span>
</span><span class='line'>
</span><span class='line'><span class="nb">echo</span> <span class="nv">$FIND_EVENT</span>
</span><span class='line'>
</span><span class='line'><span class="k">if</span> <span class="o">[[</span> <span class="s2">&quot;&quot;</span> <span class="o">==</span> <span class="s2">&quot;$FIND_EVENT&quot;</span> <span class="o">]]</span> ;
</span><span class='line'><span class="k">then</span>
</span><span class='line'>     <span class="c">#========================================</span>
</span><span class='line'>     <span class="c">#=== We are the first! Rush to add it</span>
</span><span class='line'>     <span class="c">#========================================</span>
</span><span class='line'>
</span><span class='line'>cat <span class="s">&lt;&lt;EOS &gt;&gt;$EVENT_FILE</span>
</span><span class='line'><span class="s">{</span>
</span><span class='line'><span class="s">  &quot;type&quot; : &quot;event&quot;,</span>
</span><span class='line'><span class="s">  &quot;id&quot; :  &quot;${EVENT_ID}&quot;</span>
</span><span class='line'><span class="s">  &quot;tss&quot; : &quot;${EVENT_TSS}&quot;,</span>
</span><span class='line'><span class="s">  &quot;kind&quot; : &quot;repochange&quot;,</span>
</span><span class='line'><span class="s">  &quot;repochange&quot;: {</span>
</span><span class='line'><span class="s">    &quot;repo&quot; : &quot;${EVENT_REPO}&quot;,</span>
</span><span class='line'><span class="s">    &quot;version&quot; : &quot;${GIT_VERSION}&quot;</span>
</span><span class='line'><span class="s">  }</span>
</span><span class='line'><span class="s">}</span>
</span><span class='line'><span class="s">EOS</span>
</span><span class='line'>
</span><span class='line'>git add <span class="nv">$EVENT_FILE</span>
</span><span class='line'>git commit -m <span class="s2">&quot;Creating an event for the change ${GIT_VERSION}&quot;</span>;
</span><span class='line'>git push
</span></code></pre></td></tr></table></div></figure>


<p>If this push succeeds, we are free and clear.  If not, we can try to merge (maybe some other event or chore was written)
and push again with a quick &#8216;git pull; git push&#8217;.  We could do that &#8220;forever&#8221; or until we know we have no hope (study the
actual output of the git pull, push, or other metadata between the two branches).  For the first pass, we can just do
it once.</p>

<h4>Event poster also chore poster</h4>

<p>Since we know we detected the &#8216;event&#8217; first, we are the owner of the event and
can now safely write out the &#8216;chores&#8217; associated with the event.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>cat <span class="s">&lt;&lt;EOS &gt;&gt;$CHORE_FILE</span>
</span><span class='line'><span class="s">{</span>
</span><span class='line'><span class="s">  &quot;type&quot; : &quot;chore&quot;,</span>
</span><span class='line'><span class="s">  &quot;tss&quot; : &quot;${EVENT_TSS}&quot;,</span>
</span><span class='line'><span class="s">  &quot;event_id&quot; : &quot;${EVENT_ID}&quot;,</span>
</span><span class='line'><span class="s">  &quot;kind&quot; : &quot;buildwar&quot;,</span>
</span><span class='line'><span class="s">  &quot;war_repo&quot; : &quot;${WAR_REPO}&quot;,</span>
</span><span class='line'><span class="s">  &quot;war_path&quot; : &quot;${WAR_PATH}&quot;,</span>
</span><span class='line'><span class="s">  &quot;event&quot; : {</span>
</span><span class='line'><span class="s">      &quot;kind&quot; : &quot;repochange&quot;,</span>
</span><span class='line'><span class="s">      &quot;repochange&quot;: {</span>
</span><span class='line'><span class="s">        &quot;repo&quot; : &quot;${EVENT_REPO}&quot;,</span>
</span><span class='line'><span class="s">        &quot;version&quot; : &quot;${GIT_VERSION}&quot;</span>
</span><span class='line'><span class="s">     }</span>
</span><span class='line'><span class="s">  }</span>
</span><span class='line'><span class="s">}</span>
</span><span class='line'><span class="s">EOS</span>
</span><span class='line'>
</span><span class='line'>git add <span class="nv">$CHORE_FILE</span>
</span><span class='line'>git commit -m <span class="s2">&quot;Creating a chore for the event ${EVENT_ID}&quot;</span>;
</span><span class='line'>git push
</span></code></pre></td></tr></table></div></figure>


<h4>Detecting and doing the chore</h4>

<p>We went through detecting the chore before <a href="http://markfussell.emenar.com/blog/addstack-9/">AddStack-9</a>, but now we want to do something with the chore.</p>

<p>Given the chore is describe in JSON and what we do for the chore could be complex, we should switch to a higher
level language than &#8216;bash&#8217;.  In this case we can go into Python as a decent scripting language:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>python <span class="k">${</span><span class="nv">COMMON</span><span class="k">}</span>/doChore.py --source <span class="k">${</span><span class="nv">RANDOM_DOIT_DIR</span><span class="k">}</span>/chore.json --gitroot <span class="k">${</span><span class="nv">GIT_ROOT</span><span class="k">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>This implies a powerful chore processing script, or one that can modularly call other scripts.
As long as the script leads the creation of &#8216;chore&#8217; types, we should be fine whether monolithic or modular.</p>

<p>The core of the routine is just to extract the necessary information from the JSON</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="n">source_directory</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
</span><span class='line'><span class="n">source_json</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">source</span><span class="p">))</span>
</span><span class='line'>
</span><span class='line'><span class="n">chore_kind</span> <span class="o">=</span> <span class="n">source_json</span><span class="p">[</span><span class="s">&#39;kind&#39;</span><span class="p">]</span>
</span><span class='line'>
</span><span class='line'><span class="k">if</span> <span class="n">chore_kind</span> <span class="o">==</span> <span class="s">&quot;buildwar&quot;</span><span class="p">:</span>
</span><span class='line'>    <span class="n">build_repo</span> <span class="o">=</span> <span class="n">source_json</span><span class="p">[</span><span class="s">&#39;event&#39;</span><span class="p">][</span><span class="s">&#39;repochange&#39;</span><span class="p">][</span><span class="s">&#39;repo&#39;</span><span class="p">]</span>
</span><span class='line'>    <span class="n">build_version</span> <span class="o">=</span> <span class="n">source_json</span><span class="p">[</span><span class="s">&#39;event&#39;</span><span class="p">][</span><span class="s">&#39;repochange&#39;</span><span class="p">][</span><span class="s">&#39;version&#39;</span><span class="p">]</span>
</span><span class='line'>    <span class="n">war_repo</span> <span class="o">=</span> <span class="n">source_json</span><span class="p">[</span><span class="s">&#39;war_repo&#39;</span><span class="p">]</span>
</span><span class='line'>    <span class="n">war_path</span> <span class="o">=</span> <span class="n">source_json</span><span class="p">[</span><span class="s">&#39;war_path&#39;</span><span class="p">]</span>
</span><span class='line'>
</span><span class='line'>    <span class="n">buildwarfromrepo_version_torepo_path</span><span class="p">(</span><span class="n">build_repo</span><span class="p">,</span> <span class="n">build_version</span><span class="p">,</span> <span class="n">war_repo</span><span class="p">,</span> <span class="n">war_path</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>With this information we can then go to the build repository, do a simple &#8216;grails package&#8217;, and copy it to the
appropriate repo and path.</p>

<h3>Other &#8216;chores&#8217; for this event?</h3>

<p>The event that caused the &#8216;buildwar&#8217; chore could also cause other activities.  Each of the
 application servers could create their own &#8216;chore&#8217; to redeploy, which would enable the &#8216;event&#8217; and &#8216;chore&#8217;
 repository to reflect system activity on a broader sense.  Because they are doing the chore themselves,
 it would just be a way to log the activity vs. being a way to pass it out to a bunch of workers.</p>

<h2>Conclusion</h2>

<p>The event, chore, and worker model is a very flexible, reliable, and scalable way to get stuff done.  It is
especially good at keeping throughput under control even when tasks can get onerous or &#8216;herding&#8217; occurs.<br/>
As the backlog grows, more workers appear to keep it in control.  When the backlog shrinks the workers go
to sleep or decommission.</p>

<p>The biggest issue with the worker approach is to make sure you know the ramp rate and reliability.  Even with a
huge cloud like EC2, there can be stutters and you have to more aggressively try to get resources, or accept that
the user experience may be a bit more lagged.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-9]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-9/"/>
    <updated>2015-10-21T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-9</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third dealt with the application stack (Grails and other technologies).
The fourth discussed UI alternatives.  The fifth added some major aspects to the stack: Semi-Structured Data, Templates,
and Dual or Isomorphic scripting. The sixth discussed UI frameworks in a bit more detail and ended with an Angular vs.
Ember as a core choice.  The seventh went into logging, analytics, and monitoring of the running applications and nodes.
The eighth was an overview of Federation Components like caches, queues, payment services, and the like.</p>

<h2>Workers!</h2>

<p>Among the more interesting federation / deployment component are workers.  Workers are interesting because
they can do almost anything imaginable and they do it very efficiently.  How efficiently?  Well, the perfect
worker is at 100% when doing a task and <em>dead</em> when they have no tasks to do.  That is pretty darn efficient
because it approaches 100% and is only not 100% when we choose to not accept the &#8216;spin up&#8217; latency of getting
 a new worker.  As the amount of work increases, our pool of workers increase, and the spin-up-latency decreases
 on a per-chore basis.  That is <em>very cool</em>: as scale goes up, efficiency <em>increases</em>.  There are a lot of places that
 is not true for computers, so it is nice when it is.</p>

<h3>Work?  Chore?</h3>

<p>So we want to have a worker model where we can add a &#8216;chore&#8217; (a unit of work, using a term not otherwise used in
IT and CS&#8230; job, task, etc. are now ambivalent) to a queue of work-to-be-done, and have
 something do that chore.  There are a lot of ways to do this:</p>

<p> <!--more--></p>

<ol>
<li>Use BeanStalk</li>
<li>Use Kafka with a bunch of consumers</li>
<li>Use a database and launch a worker if none is available</li>
<li>Use Quartz and coordinate amongst the application servers which one is going to do the work</li>
<li>Use GitHub and launch one or more workers as needed</li>
</ol>


<p>And that is just a minor collection of simple solutions.  The first two are probably &#8216;the best&#8217; in terms of having
a very clean model.  But they require additional infrastructure and I am trying to keep that at a minimum.  The
second is using a database as a WorkQueue.  Well, it turns out that this is actually commonly done and almost
always <em>regretted</em>.  Most databases are horrible with the characteristics of Chores and their lifecycle.  So it does
work, but not well.</p>

<p>The fourth is quite functional but not scalable.  You don&#8217;t want your application servers doing <em>a lot</em> of work.
A little housekeeping is fine.  But the whole point of the Worker model is to enable as many or as few workers who each
<em>always</em> do <em>a lot</em> of work.  And then go away if no longer needed.  That isn&#8217;t the lifecycle and duty of application
servers.</p>

<p>So if you haven&#8217;t guessed by now, I am going to describe the fifth approach.  Use an annexed Git repository to describe
chores, their media (if any), and to provide the results (if any).  It turns out to be blazingly fast, scalable,
and flexible.  A little weird but sometimes weird really works.</p>

<h3>Chores, Parents, and Workers</h3>

<p>A lot of time, the real world can seriously inspire the computer world.  The Worker model I am about to describe
matches a &#8216;high-speed&#8217;, &#8216;high-efficiency&#8217;, parenting model.  I would guess any parent can see the similarities
and even the Nirvana of this Worker model.  It has a few major components:</p>

<ul>
<li>The World creates some Chores in a to-do list</li>
<li>The World doesn&#8217;t want to do the Chores, because it has other things to do</li>
<li>So The World creates two or more adults (for redundancy) so they can do the Chores

<ul>
<li>And then The World gives responsibility to the adults to do the Chores</li>
</ul>
</li>
<li>The adults don&#8217;t want to actually do the Chores themselves, so they produce Workers to do the Chores</li>
<li>The Workers are so awesome that they automatically <em>all</em> try to do the Chores, as quickly as possible

<ul>
<li>The adults (Parents) have worked out a system to prevent two Workers from doing the same Chore</li>
</ul>
</li>
<li>If the Chores are not getting done fast enough, the Parents produce more Workers</li>
<li>If there is no more work to do, the Workers go to sleep

<ul>
<li>Waking periodically to see if there is more work</li>
<li>Or if the Chores are not getting done fast enough, the Parents wake one or more Workers</li>
</ul>
</li>
</ul>


<p>With this model:</p>

<ul>
<li>The World is the Application Server or something similar</li>
<li>The Parents are special Nodes (or processes on Application Server nodes) that can see the &#8216;to-do&#8217; list</li>
<li>The Workers are special Nodes that are created as the &#8216;to-do&#8217; list backlog gets larger</li>
</ul>


<p>You need at least two Parents at all time to make sure the To-Do list is being watched.  You don&#8217;t need any
Workers until the To-Do list is sufficiently long or latent.</p>

<p>We will put the &#8216;To-Do&#8217; chores into a specially structured, annexed, Git repository.  Because of the annexing,
resources are automatically &#8216;deduped&#8217; and having each &#8216;chore&#8217; be self-contained is both possible and space
efficient.  Imagine all the &#8216;jar&#8217;s needed for a java build.  Given most of these are stable between builds,
they cost nothing at all to include in a &#8216;chore&#8217;.  Where people run fragile artifact servers (fragile because
(a) they exist as something that could fail and (b) they are rarely run redundantly) that have to handle
heavy load, the Annex puts all that load on S3&#8230; which is designed from the ground-up for loads well beyond our workers.</p>

<h4>Chore Structure</h4>

<p>The core of a Chore has to include:</p>

<ul>
<li>The identity of the chore

<ul>
<li>And an ability to &#8216;take it on&#8217;</li>
</ul>
</li>
<li>What the instructions are for the chore</li>
<li>What resources you need for the chore</li>
<li>Where the results of the chore are supposed to go</li>
</ul>


<p>To make the throughput easier to see, we will organize chores by time.  So basically a queue.  We can have &#8216;priority&#8217; within the
metadata of the chore if we want things to jump the queue.  And we can have different chore types (or IT needs) to
make sure a worker can really handle the chore. Using the &#8216;cron_1m&#8217; model of things working on the minute, we will
put things into buckets every minute.  But workers have to look for any not-done chore and pick it up if they can.</p>

<p>An advantage of the one-minute cron is we automatically can have a nice 30-second jitter.  That plus some kind of randomization
in chore selection makes it very unlikely that workers will acquire the same chore at the same time.  But if they do, one will win due
to &#8216;git push&#8217; timing.</p>

<h5>Identity</h5>

<p>Chores are identified by their &#8216;producer&#8217; and a timestamp.  A &#8216;producer&#8217; is a node plus a process id, and the timestamp can
have any precision necessary for the process to know it can&#8217;t collide with itself.  Two of the banes of any identity system
is making sure identity is unique and not having a bottleneck for identity generation.  The identity proposed solves these
two main issues.  A third requirement (sometimes) is keeping identity short / consistent.  A hash of the &#8216;phrase&#8217; is
possible if necessary, but collisions could be an issue if the phrase is too short.</p>

<h5>Instructions</h5>

<p>So we have something like &#8220;chore_ip-1-2-3-4_ps-349467_20151022-110109-123456&#8221; as a chore.  This is simply a directory with
a &#8216;chore.json&#8217; within it where that &#8216;chore.json&#8217; looks something like this:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="nt">&quot;chore_id&quot;</span> <span class="p">:</span> <span class="s2">&quot;ip-1-2-3-4_ps-349467_20151022-110109-123456&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;chore_tss&quot;</span> <span class="p">:</span> <span class="s2">&quot;20151022110109&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;producer_id&quot;</span> <span class="p">:</span> <span class="s2">&quot;ip-1-2-3-4_ps-349467&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;runner&quot;</span> <span class="p">:</span> <span class="s2">&quot;bash&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;command&quot;</span> <span class="p">:</span> <span class="s2">&quot;ps -aux&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;result&quot;</span> <span class="p">:</span> <span class="s2">&quot;output.txt&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;error&quot;</span> <span class="p">:</span> <span class="s2">&quot;error.txt&quot;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Another file is in the directory initially called &#8216;do_it.txt&#8217; which can be empty.</p>

<h5>Take on the &#8216;chore&#8217;</h5>

<p>To take this &#8216;chore&#8217; on, a worker adds a &#8216;worker.json&#8217; file to the directory:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="nt">&quot;chore_id&quot;</span> <span class="p">:</span>  <span class="s2">&quot;ip-1-2-3-4_ps-349467_20151022-110109-123456&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;work_id&quot;</span> <span class="p">:</span>  <span class="s2">&quot;ip-4-5-6-7_ps-1000_20151022-110209-123456&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;worker_id&quot;</span> <span class="p">:</span> <span class="s2">&quot;ip-4-5-6-7_ps-1000&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;work_start_tss&quot;</span> <span class="p">:</span> <span class="s2">&quot;20151022110209&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;state&quot;</span> <span class="p">:</span> <span class="s2">&quot;working&quot;</span><span class="p">,</span>
</span><span class='line'>  <span class="nt">&quot;work_finish_tss&quot;</span> <span class="p">:</span> <span class="s2">&quot;&quot;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>and renames the &#8216;do_it.txt&#8217; to &#8216;doing_it.txt&#8217;</p>

<p>When these changes commit and push successfully, this worker now owns the chore.  The worker can update the &#8216;worker.json&#8217;
through the work if desired, or put files into the directory or elsewhere.  When the chore is complete, the worker
should change worker.json to a finished state, and rename the &#8216;doing_it.txt&#8217; to &#8216;done.txt&#8217;.  With this,
the three states are:</p>

<ul>
<li>do_it.txt</li>
<li>doing_it.txt</li>
<li>done.txt</li>
</ul>


<p>And everyone can quickly tell what the state of a chore is without worrying about the details.  Or dive into the json
and results to figure out those details.</p>

<p>Visually it would look likte this:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-9/addstack9_chore1.png" /></p>

<p><img src="http://markfussell.emenar.com/images/addstack-9/addstack9_chore2.png" /></p>

<p><img src="http://markfussell.emenar.com/images/addstack-9/addstack9_chore3.png" /></p>

<p>The script to acquire a chore is a little involved because of the possibility of failure, but basically it just</p>

<ul>
<li>Finds all the &#8216;doit.txt&#8217; files</li>
<li>Picks one at random</li>
<li>Tries to rename it and push that change

<ul>
<li>If successful, then we are in.  If not, roll-back</li>
</ul>
</li>
</ul>


<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nb">export </span><span class="nv">RANDOM_DO_IT</span><span class="o">=</span><span class="sb">`</span>find work -name <span class="s1">&#39;do_it.txt&#39;</span> | <span class="k">while </span><span class="nb">read </span>x; <span class="k">do </span><span class="nb">echo</span> <span class="s2">&quot;\`expr $RANDOM % 1000\`:$x&quot;</span>; <span class="k">done</span> | sort -n | sed <span class="s1">&#39;s/[0-9]*://&#39;</span> | head -1<span class="sb">`</span>
</span><span class='line'><span class="c">#...</span>
</span><span class='line'>git mv <span class="nv">$RANDOM_DO_IT</span> <span class="s2">&quot;${RANDOM_DO_IT_DIR}/doing_it.txt&quot;</span>
</span><span class='line'><span class="c">#...</span>
</span><span class='line'>git push
</span><span class='line'><span class="nv">PUSH_RETVAL</span><span class="o">=</span><span class="nv">$?</span>
</span><span class='line'>
</span><span class='line'><span class="k">if</span> <span class="o">[</span> <span class="nv">$PUSH_RETVAL</span> -ne 0 <span class="o">]</span>;
</span><span class='line'><span class="k">then</span>
</span><span class='line'>
</span><span class='line'><span class="c">#=================================================</span>
</span><span class='line'><span class="c">#=== We failed to acquire, so roll-back</span>
</span><span class='line'><span class="c">#=================================================</span>
</span></code></pre></td></tr></table></div></figure>


<h4>Doing the work</h4>

<p>A worker should alway be able to acquire:</p>

<ul>
<li>The root of the work repository – Say &#8220;${GIT_ROOT}&#8221;</li>
<li>The root of the chore itself – Say &#8220;${CHORE_ROOT}&#8221;</li>
</ul>


<p>Where the &#8220;GIT_ROOT&#8221; can have shared scripts in its &#8216;work/bin&#8217; or &#8216;bin&#8217; directories, and the chore can have
individual scripts in it CHORE_ROOT/bin directory.  We also likely have &#8216;repo2&#8217; available,
so we have access to a lot of resources (common and work specific) to leverage.</p>

<h4>Saving the work</h4>

<p>When the worker is done, it needs to do a final &#8216;write&#8217; of all the results.  This could be nothing more than
logs (a worker is &#8216;anonymous&#8217; and ephemeral, so ideally logs go to the chore&#8217;s directory vs. somewhere
effectively &#8216;random&#8217;).  This is just a final pull-push:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c">#=================================================</span>
</span><span class='line'><span class="c">#=== Done, try to write out the results</span>
</span><span class='line'><span class="c">#===</span>
</span><span class='line'><span class="c">#=== Make sure everything is annexed</span>
</span><span class='line'><span class="c">#=================================================</span>
</span><span class='line'>
</span><span class='line'>./bin/deflatePaths.sh <span class="s2">&quot;${RANDOM_DO_IT_DIR}&quot;</span>
</span><span class='line'>
</span><span class='line'>git pull
</span><span class='line'><span class="c">#...</span>
</span><span class='line'>
</span><span class='line'><span class="c">#=================================================</span>
</span><span class='line'><span class="c">#=== Pull successful, start writing</span>
</span><span class='line'><span class="c">#=================================================</span>
</span><span class='line'>
</span><span class='line'>git mv <span class="s2">&quot;${RANDOM_DO_IT_DIR}/doing_it.txt&quot;</span> <span class="s2">&quot;${RANDOM_DO_IT_DIR}/done.txt&quot;</span>
</span><span class='line'>
</span><span class='line'>git add -A <span class="s2">&quot;${RANDOM_DO_IT_DIR}/../&quot;</span>
</span><span class='line'>git commit -m <span class="s2">&quot;$ME completed chore ${RANDOM_DOIT_DIR}&quot;</span>
</span><span class='line'>
</span><span class='line'>git push
</span></code></pre></td></tr></table></div></figure>


<p>and as long as this is successful, the work is done.</p>

<h4>Jitter</h4>

<p>Although the randomization of chore selection helps with a lot of chores, it does not help when there are very few
chores left.  On the &#8216;go&#8217; of chore selection, all the workers go after the chore.  So we need to say &#8216;go&#8217; at
different times.  This brings back the &#8216;jitter&#8217; concept mentioned previously.  To jitter in this case, we just
create a &#8216;random&#8217; number and then modulo it by whatever jitter interval we want.</p>

<p>For example, using the process id plus the time stamp, and trying for a 0-29 range, we can have:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">TSS_SECOND</span><span class="o">=</span><span class="sb">`</span>date +%s<span class="sb">`</span>
</span><span class='line'><span class="nv">PSEUDO_RANDOM</span><span class="o">=</span><span class="s2">&quot;`expr ${TSS_SECOND} + $$`&quot;</span>
</span><span class='line'><span class="nv">SLEEP_LENGTH</span><span class="o">=</span><span class="k">$((${</span><span class="nv">PSEUDO_RANDOM</span><span class="k">}</span> <span class="o">%</span> <span class="m">30</span> <span class="k">))</span>
</span></code></pre></td></tr></table></div></figure>


<h2>Conclusion</h2>

<p>The above is a very generic worker model that enables all kinds of flexibility in setting up &#8216;chores&#8217; and scalably
having a &#8216;right-size&#8217; for the number of workers doing the work.  The next article will be more specific and
build new &#8216;wars&#8217; every time the application changes after passing the built-in tests.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-8]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-8/"/>
    <updated>2015-10-20T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-8</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third dealt with the application stack (Grails and other technologies).
The fourth discussed UI alternatives.  The fifth added some major aspects to the stack: Semi-Structured Data, Templates,
and Dual or Isomorphic scripting. The sixth discussed UI frameworks in a bit more detail and ended with an Angular vs.
Ember as a core choice.  The seventh went into logging, analytics, and monitoring of the running applications and nodes.</p>

<h2>Federation Application Infrastructure</h2>

<p>The application stack we have so far:</p>

<ul>
<li> UI (both client and server)</li>
<li> Application Server (Grails, Java, potentially scripting engine)</li>
<li> Database (Maria or similar)</li>
</ul>


<p>Is very capable.  Using it combined with the ADD ingredients:</p>

<ul>
<li> GitHub – With resource, presence, application, and configuration information repositories</li>
<li> EC2 Instances – Running continuously or based on load, and running their &#8216;part&#8217; plus any dynamic configuration</li>
<li> S3 – For resources</li>
<li> HipChat – To let everyone know</li>
</ul>


<p>Makes for a very functional application.  The nodes and their applications can talk to each other based on presence.
The nodes and their application can keep certain data in-memory (cached).  The nodes can
 launch other nodes to handle load or do certain tasks.  An Application Server is a very generic thing and
 can do pretty much anything.</p>

<h3>Standard Federation Components</h3>

<p>Doing pretty much anything and everything turns out to be very confusing.  For people.  Big monoliths of capabilities
are basically beyond comprehension.  And the bigger the monolith, the harder it falls.  The more likely it falls.
And even if you have redundant monoliths, the system becomes very painful to maintain and to learn.</p>

<!--more-->


<p>So instead of having the one super-capable application server, we can start breaking out some of the responsibilities
of the application server into other system components, and then decide whether we need them or not.  If we need
them, we will be using a very main-stream approach that is redundant, scalable, and easily managed.  It needs to &#8216;fit&#8217;
with our application, but it doesn&#8217;t have to be similar to the application (e.g. works with Java, written in Erlang,
runs on Linux).</p>

<p>The list of standard system components isn&#8217;t that long, but it is <em>longer than you need</em>.  If you are using all of these,
you are likely over-engineering your solution.  Try to start weaning yourself off some of this technology.</p>

<p>A partial list of federation components</p>

<ul>
<li>Cache – For rapidly retrieving information that changes slowly or needs to be shared broadly</li>
<li>Queue – For getting information from producers (requests) to consumers (workers)</li>
<li>Distributed State – For precise and consistent decision-making among several different entities</li>
<li>Semistructured Database – For persistently storing data in a faster or more flexible format than the main database</li>
<li>SSO (Single Sign-on) – To enable users to get access to various resources without the resources having to authenticate</li>
<li>&#8220;Chat&#8221; – Real-time presence and data communication enabling &#8216;chat&#8217; and various other capabilities</li>
<li>Map-Reduce – Taking large amounts of data and processing it to get answers to questions.  Can be real-time or not</li>
<li>Forum – Supporting forum capabilities for customers to talk with each other</li>
<li>Customer Support – Supporting customer-facing capabilities, including defect and product request tracking</li>
<li>SMS / Email / Contact – Ability to send out emails, SMS, surveys, and other customer contact</li>
<li>Web Site – A separate web site from the main application</li>
<li>Web Content Creator – An ability to enable users to create content within your site (vs. doing it via templating)</li>
<li>Payment Processing – Handling the record of credit cards and payment processing</li>
<li>Freetext Search – The ability to search documents and similar free text</li>
<li>Workers – Special nodes that do work and either go idle or disappear when no work is needed</li>
</ul>


<p>There are some more (e.g. the BI pipeline), but that is a pretty good list.  Especially the &#8216;Workers&#8217; is a category basically as broad as
&#8216;Application&#8217;.</p>

<p>Working through the list, here are some examples:</p>

<ul>
<li>Cache – Redis <a href="http://redis.io">http://redis.io</a></li>
<li>Queue – Kafka <a href="http://kafka.apache.org">http://kafka.apache.org</a></li>
<li>Distributed State - Presence in Git (for minutes), ZooKeeper (for sub-second) <a href="http://zookeeper.apache.org">http://zookeeper.apache.org</a> and Curator <a href="http://curator.apache.org/curator-recipes/index.html">http://curator.apache.org/curator-recipes/index.html</a></li>
<li>Semistructured Database – Riak  <a href="http://basho.com/products/">http://basho.com/products/</a></li>
<li>SSO – Shibboleth <a href="http://shibboleth.net">http://shibboleth.net</a></li>
<li>Chat – Ejabberd <a href="https://www.ejabberd.im">https://www.ejabberd.im</a></li>
<li>Map-Reduce – Spark <a href="https://spark.apache.org">https://spark.apache.org</a>,  Hadoop <a href="https://hadoop.apache.org">https://hadoop.apache.org</a></li>
<li>Forum –  phpBB <a href="https://www.phpbb.com">https://www.phpbb.com</a></li>
<li>Customer Support – Parature <a href="http://www.parature.com">http://www.parature.com</a></li>
<li>SMS / Email / Contact – SendGrid <a href="https://sendgrid.com">https://sendgrid.com</a> , Silverpop <a href="http://www-03.ibm.com/software/products/en/silverpop-engage">http://www-03.ibm.com/software/products/en/silverpop-engage</a> , SurveyMonkey <a href="https://www.surveymonkey.com">https://www.surveymonkey.com</a> , etc.</li>
<li>Web Site –  Expression Engine <a href="https://ellislab.com/expressionengine">https://ellislab.com/expressionengine</a> , Squarespace <a href="http://www.squarespace.com">http://www.squarespace.com</a></li>
<li>Web Content Creator – How about the original &#8216;wiki&#8217; <a href="http://wiki.org">http://wiki.org</a> or a more modern one like Foswiki <a href="http://foswiki.org">http://foswiki.org</a></li>
<li>Payment Processing – PayPal <a href="http://paypal.com">http://paypal.com</a> or even Facebook <a href="http://facebook.com">http://facebook.com</a> and Google <a href="http://google.com">http://google.com</a></li>
<li>Freetext Search – Solr <a href="http://lucene.apache.org/solr/">http://lucene.apache.org/solr/</a></li>
<li>Workers – All kinds of workers and frameworks for doing it, including AWS beanstalks <a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html">http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html</a></li>
</ul>


<p>Sadly, Rumble did use almost all of the above (and more) in some way or another, but that is seriously off-the-chart
and incredibly expensive.  Yes, it is powerful.  No, your users do not care to pay you for that much power.</p>

<p>A company like Wikipedia/Wikimedia looks more like this:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-8/addstack8_wikimedia1.png" /></p>

<h2>Conclusion</h2>

<p>It is good to understand what kinds of system components are out there and be aware that you don&#8217;t have to
reinvent / recode them when you need them.  Each of the above are good products.  They do what they should
to fill a particular need.  And almost all of them are
fault-tolerant and scalable, so they can join the rest of the <em>very tolerant</em> ADD stack.
Or they are a service and you get what you pay for.  If you really need
one of them, certainly bring it aboard.  It is better than creating a monolith.
But if you can do without it, your application and you IT will be easier to understand and maintain.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-7]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-7/"/>
    <updated>2015-10-19T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-7</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third dealt with the application stack (Grails and other technologies).
The fourth discussed UI alternatives.  The fifth added some major aspects to the stack: Semi-Structured Data, Templates,
and Dual or Isomorphic scripting. The sixth discussed UI frameworks in a bit more detail and ended with an Angular vs.
Ember as a core choice.</p>

<h2>Logging, Analytics, and Monitoring</h2>

<p>Returning to a bit more of an &#8216;IT&#8217; issue, how do we handle logging, monitoring, and analytics on our collection of
machines?  There are a number of choices:</p>

<ol>
<li>Run our own infrastructure</li>
<li>Go with an inexpensive provider</li>
<li>Go with a more capable provider</li>
<li>Don&#8217;t</li>
</ol>


<p>Of the above, I believe #3 is usually worth it until your scale gets to the point of needing #1.  Downgrading
from #3 to #2 is fine <em>after</em> you have learned the capabilities you are giving up.</p>

<!--more-->


<h3>Logging: SumoLogic</h3>

<p>The longest standing, very successful, and SaaS capable company is Splunk (<a href="http://splunk.com/">http://splunk.com/</a>) .  But their prices are crazy.  Have no
idea how they can charge that much.  So instead I will demo SumoLogic (<a href="http://SumoLogic.com/">http://SumoLogic.com/</a>) as the &#8216;3B&#8217; tier.</p>

<p>Installing SumoLogic is incredibly easy:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>wget <span class="s2">&quot;https://collectors.us2.sumologic.com/rest/download/linux/64&quot;</span> -O SumoCollector.sh <span class="o">&amp;&amp;</span> chmod +x SumoCollector.sh <span class="o">&amp;&amp;</span> ./SumoCollector.sh -q -VskipDefaultSources<span class="o">=</span><span class="nb">true</span> -Vsumo.token_and_url<span class="o">={</span>token<span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>And the collector is on the machine.  If you tell it what you want to aggregate, it starts collecting and indexing files in those paths.  In our case, the nodes
all have files in &#8216;/root/log&#8217; which it would be nice to have aggregated.</p>

<p>The results are visible here:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-7/addstack7_sumo1.png" /></p>

<p><img src="http://markfussell.emenar.com/images/addstack-7/addstack7_sumo2.png" /></p>

<p><img src="http://markfussell.emenar.com/images/addstack-7/addstack7_sumo3.png" /></p>

<h4>Logging Alternative: Graylog</h4>

<p>For Rumble, we had a Graylog (<a href="http://graylog.com/">http://graylog.com/</a>) cluster that dealt with a tremendous amount of data (half a
terabyte a day if memory serves, due to over-enthusiastic logging) and was relatively stable under that load.
Elasticsearch had issues if a node failed (just due to the stress of moving data to another backup), but this
is under pretty extreme load levels.  So if you wanted to roll your own, the Graylog path would be a very
inexpensive and powerful path.</p>

<h3>Analytics and Monitoring: NewRelic</h3>

<p>NewRelic (<a href="http://newrelic.com/">http://newrelic.com/</a>) started out as a Ruby-oriented monitoring service, and basically came about because Ruby/Rails developers
(a) wanted a lot of information about why their apps were running slowly, (b) had very little knowledge about
operations and other ways of monitoring things, and (c) Ruby itself has little support for monitoring.  NewRelic
came along and provided the metrics (as you would expect for Java and similar mature languages) <em>outside</em> the
Ruby environment.  Initially this could be viewed as a crutch for Ruby where Java didn&#8217;t need it, but ultimately
by putting the metrics outside the application everyone&#8217;s life was simpler.</p>

<p>To install NewRelic, you need to get the agent onto the machine.  In our case we are going to leverage the annex:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c">#====================================================</span>
</span><span class='line'><span class="c">#=== Install NewRelic</span>
</span><span class='line'><span class="c">#====================================================</span>
</span><span class='line'>
</span><span class='line'><span class="c">#===================================</span>
</span><span class='line'><span class="c">#=== Server</span>
</span><span class='line'><span class="c">#===================================</span>
</span><span class='line'>
</span><span class='line'>rpm -Uvh http://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm
</span><span class='line'>yes | yum -y install newrelic-sysmond
</span><span class='line'>nrsysmond-config --set <span class="nv">license_key</span><span class="o">=</span>key
</span><span class='line'>
</span><span class='line'>/etc/init.d/newrelic-sysmond start
</span><span class='line'>
</span><span class='line'><span class="c">#===================================</span>
</span><span class='line'><span class="c">#=== Java</span>
</span><span class='line'><span class="c">#===================================</span>
</span><span class='line'>
</span><span class='line'><span class="nb">export </span><span class="nv">APP_VERSION</span><span class="o">=</span>3.21.0
</span><span class='line'><span class="nb">export </span><span class="nv">APP_FULL_VERSION</span><span class="o">=</span>newrelic-java-<span class="k">${</span><span class="nv">APP_VERSION</span><span class="k">}</span>
</span><span class='line'>
</span><span class='line'>mkdir -p .temp
</span><span class='line'>cp it/resource/<span class="k">${</span><span class="nv">APP_FULL_VERSION</span><span class="k">}</span>.zip .temp/
</span><span class='line'>
</span><span class='line'>./bin/inflatePaths.sh .temp/<span class="k">${</span><span class="nv">APP_FULL_VERSION</span><span class="k">}</span>.zip
</span><span class='line'>
</span><span class='line'>mkdir -p /opt
</span><span class='line'>cp -fr .temp/newrelic /opt/
</span><span class='line'>
</span><span class='line'>cp -fr <span class="k">${</span><span class="nv">RESOURCE</span><span class="k">}</span>/newrelic.yml /opt/newrelic/newrelic.yml
</span></code></pre></td></tr></table></div></figure>


<p>The first section puts on the system-monitoring agent for newrelic.
The second section has two parts.  The first part puts the general NewRelic agent onto the machine, and the second part
enables us to override (overlay) the default configuration with our own.  The most important part is to replace the
license, but there are many things that can be configured within the NewRelic agent.</p>

<p>Finally, we need to launch with the agent configuration into the java / &#8216;gradew&#8217; launcher:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.</span>
</span><span class='line'><span class="nv">DEFAULT_JVM_OPTS</span><span class="o">=</span><span class="s2">&quot;-javaagent:/opt/newrelic/newrelic.jar&quot;</span>
</span></code></pre></td></tr></table></div></figure>


<p>After doing this and waiting for the metrics to hit the NewRelic servers, we get some nice visuals:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-7/addstack7_newrelic2.png" />
<img src="http://markfussell.emenar.com/images/addstack-7/addstack7_newrelic4.png" />
<img src="http://markfussell.emenar.com/images/addstack-7/addstack7_newrelic5.png" />
<img src="http://markfussell.emenar.com/images/addstack-7/addstack7_newrelic6.png" />
<img src="http://markfussell.emenar.com/images/addstack-7/addstack7_newrelic7.png" />
<img src="http://markfussell.emenar.com/images/addstack-7/addstack7_newrelic7.png" /></p>

<h3>Operational Monitoring: Nagios and Icinga</h3>

<p>The above monitoring is not &#8216;alert&#8217; oriented.  It lets you drill into the details of what is happening
in operations both currently and somewhat into the past.  To be a bit more alert oriented, you need
to go down a different path.  The most mature open source path is the Nagios / Icinga double path (<a href="http://nagios.org/">http://nagios.org/</a>,
 <a href="http://icinga.org/">http://icinga.org/</a>).</p>

<p>An important aspect of monitoring is to have <em>multiple</em> monitors on your network.  And, in general, for the monitors
to be outside the data center.  Agents within the data center can relay information out, but if your monitors fail
inside the data center, you are (unknowingly) blind.</p>

<p>So for Nagios, we can demonstrate monitoring from the developers (or operations dashboard) machine vs.
within the data center.  Because of the presence being visible from anywhere, monitoring configuration can happen
anywhere that you can pull out a git repository.</p>

<p>Examples of Nagios views are:</p>

<p><img src="http://markfussell.emenar.com/images/addstack-7/addstack7_nagios1.png" /></p>

<p><img src="http://markfussell.emenar.com/images/addstack-7/addstack7_nagios2.png" /></p>

<p>Where the lists of hosts to monitor and what to monitor comes from text configuration files.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>define host <span class="o">{</span>
</span><span class='line'>   host_name   <span class="o">{</span>host_name<span class="o">}</span>
</span><span class='line'>   use         <span class="o">{</span>node_type<span class="o">}</span>
</span><span class='line'>   <span class="nb">alias</span>       <span class="o">{</span>node_id<span class="o">}</span>
</span><span class='line'>   address     <span class="o">{</span>node_public_address<span class="o">}</span>
</span><span class='line'>   register    <span class="o">{</span>registration_order<span class="o">}</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>And these files can trivially be generated from the presence information, and updated if
anything changes.  An important aspect is to make sure to turn off the monitoring system
when a node is going down <em>intentionally</em>.  So the &#8216;node_state&#8217; status and &#8216;node_app_state&#8217;
status are critical to have come through the presence information for monitoring to
not be &#8216;noisy&#8217;.  A noisy monitor is a monitor that will quickly be forever ignored.</p>

<p>Although Nagios and Icinga have dashboards, everything should go into HipChat so everyone
can see the history and stability/instability of the system.  You can even publish the status
  publicly so your users will know there is a production problem. If you enable public chat
  in either HipChat or elsewhere, the users can both see the status and ask for predictions
  of when issues are resolved.  A much higher-touch relationship with users can make them
  longer users (this retention aspect was very true of Winster where the CEO was <em>online</em>
  and could be chatted with a good portion of the evening.  Kind of like walking the floors
  of the casino or Tim Cook being in the University Apple Store.).</p>

<h2>Conclusion</h2>

<p>Although it is more operational than &#8220;application stack&#8221;, the ability to monitor and analyze your
application&#8217;s performance and behavior is critical to any production deployment of it.  So you
should think about it early and not as an afterthought.  All logging should go into the logging pipeline
(no System.println or equivalent) and be searchable through that pipeline at one or more aggregators.
Start out with a metrics system like NewRelic to get a bunch  of valuable things for free
and you can later add in new application-specific metrics.
And get the basics of operational monitoring up early and you will know if the application and the
IT is reliable long before it gets into the production data center.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-6]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-6/"/>
    <updated>2015-10-17T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-6</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third dealt with the application stack (Grails and other technologies).
The fourth discussed UI alternatives.  The fifth added some major aspects to the stack: Semi-Structured Data, Templates,
and Dual or Isomorphic scripting.</p>

<h2>Which UI framework?</h2>

<p>The <a href="http://markfussell.emenar.com/blog/addstack-4/">fourth article</a> discussed UI alternatives, but it was mostly about &#8216;architectural&#8217; alternatives
 and did not recommend a particular framework to use.  I believe that is the correct order: <em>how you use</em> the framework
 is usually more important than the framework itself.  People can correctly and improperly use all kinds of different technology.
Use a hammer correctly and you might have a slight penalty (rubber vs. metal), but
use it wrong (your thumb is targetable) and you can be seriously hurt.</p>

<p>There are a number of popular frameworks:</p>

<ul>
<li>Angular</li>
<li>Ember</li>
<li>Backbone</li>
<li>Sencha</li>
<li>etc.</li>
</ul>


<p>And deciding between them may seem like it should be done as &#8220;which has the best features?&#8221; but unless
one of them has a killer feature  that you care about
(Sencha can run the same code with both a desktop and mobile UI), and is worth its penalties (Sencha
is proprietary and very &#8216;different&#8217;) then &#8216;best features&#8217; is basically meaningless.  A better question is &#8220;Which
one do I understand the best?&#8221; and &#8220;Which one can other people on the team learn and share-code the best?&#8221;.</p>

<!--more-->


<p>Taking out &#8216;Sencha&#8217; from the above and you get a few different viewpoints on the web:</p>

<ul>
<li><a href="http://blog.yodersolutions.com/why-i-recommend-emberjs-over-angularjs/">http://blog.yodersolutions.com/why-i-recommend-emberjs-over-angularjs/</a></li>
<li><a href="https://www.airpair.com/js/javascript-framework-comparison">https://www.airpair.com/js/javascript-framework-comparison</a></li>
<li><a href="https://www.quora.com/Is-Angular-js-or-Ember-js-the-better-choice-for-JavaScript-frameworks">https://www.quora.com/Is-Angular-js-or-Ember-js-the-better-choice-for-JavaScript-frameworks</a></li>
</ul>


<p>And dropping Backbone, the distinction is really:</p>

<ul>
<li>Angular – Powerful, dry, and scale-limited framework</li>
<li>Ember – Less dry, more opinionated, and more scalable</li>
</ul>


<p>With Angular you have the ability to shoot yourself more and get confused more.  With Ember you will likely
have to be more explicit, but the convention and the explicitness should make the code more readable and
maintainable.</p>

<p>Angular is so similar to Flex that it is very intuitive to me (even directives), but I have seen it used
in ways I think the Angular team would be shocked by.  Sencha is confusing but is so mature, documented,
and powerfully-fragile (do something wrong and you get a terribly visible break) that you can&#8217;t really use it wrong.
Ember appears to have the advantages of Rails and Grails&#8230; as the framework innately &#8216;works&#8217; you can&#8217;t
really deviate very much.  Also, Ember causes certain ripples (handlebars vs. dust) so you need to
decide early whether you want complete alignment.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-5]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-5/"/>
    <updated>2015-10-16T01:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-5</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third dealt with the application stack (Grails and other technologies).
The fourth discussed UI alternatives.</p>

<p>This article is about some fairly advanced capabilities, but capabilities that many projects find useful,
and so should be considered within the context of the overall context.  They are:</p>

<ul>
<li> Data Flexibility and Templating</li>
<li> Server Side Scripting</li>
</ul>


<h2>Data Flexibility and Template Systems</h2>

<p>One of the more interesting capability of an application is when users can control the content and presentation
of information.  Content is relatively easy given pure structured information is trivial to store in most
any database.  As the content becomes more unstructured you need to shift models and store it in a &#8216;meta&#8217;
structure like JSON.  As the content becomes bigger, you need the flexibility of very large objects (BLOBs and CLOBs)
stored either in the database or potentially within content repositories like S3.  Using the Annex model
discussed earlier, you can simply store a hash in the database and the actual content on S3, and then
<em>the client</em> can pull down the information without taxing your server network at all.</p>

<p>Having flexible data is not very useful unless you can present it.  If the data is in JSON, you need to
be able to take JSON and render it into text, HTML, or something the programming language can work with.
There are a number of template systems out there:</p>

<ul>
<li> Mustache</li>
<li> Jade</li>
<li> Dust</li>
</ul>


<!--more-->


<p>Deciding amongst them depends on who is going to be writing the template and &#8216;where&#8217; it is
going to execute.  But I recommend (a) making it language agnostic, (b) making it output agnostic,
and (c) making writing HTML templates a lot like writing HTML (and not something weird even if &#8220;more
powerful&#8221;).  I have seen a lot of developers argue that you should write HTML in some YAML like language.
That is like saying you should write Java in some LISP-like language.  It makes no sense to change
syntax that dramatically even if every language is computationally equivalent.  HTML is verbose
because people like that lack of ambiguity (The original SGML was much more ambiguous and powerful).
There are plenty of auto-complete tools out there that help with HTML.  And everyone can follow
&#8216;fragments&#8217; of HTML better because the fragment has so much redundant information.</p>

<p>Among the above, it seems that Dust <a href="http://dustjs.com/">http://dustjs.com/</a> is a well supported successor to Mustache / Handlebars.
Besides having LinkedIn support, it appears the company <a href="http://cloudcms.com/">http://cloudcms.com/</a> is using it as well.  There is
a comparison of frameworks at <a href="https://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more">Templating Throwdown</a></p>

<p>By combining an ability to retrieve arbitrary information with arbitrary templates, we can enable
a user to generate any page they want&#8230; either for themselves or for other people.</p>

<h3>Scary!</h3>

<p>OK, the above should seem both epic and <em>scary</em>.  A user can generate arbitrary HTML pages
including JavaScript?  Doesn&#8217;t that mean they could do <em>anything</em> including hijack another user?  Get
their password?  Stuff like that?</p>

<p>If you do it wrong&#8230; yes&#8230; yes they can.  Fortunately we have Facebook, MySpace and other companies that
show how to do it wrong and then fix the problem.  The general solution is:</p>

<ul>
<li>Users never authenticate with &#8216;The Page&#8217;.  They only authenticate with you.</li>
<li>You give the page a valid one-time token for that third party to contact you on behalf of a user</li>
<li>You make sure to verify the token before doing anything for the user, and only allow the page / third party to do things you (or the user) approve</li>
</ul>


<p>This model makes sure the third party is not doing anything dangerous to your site&#8230;
or at least not successfully doing anything.</p>

<h2>Server-Side Scripting</h2>

<p>Along with the data flexibility combined with templating described above, there is an even scarier and more powerful
option to enable within-server scripting.  This ability to have code be mutable at run-time enables some easy upgrades
and &#8216;forks&#8217; (customers doing their own thing) in exchange for much less surety that the code is running, some performance
trades, a more complex system model (flowing back and forth between JavaScript and Java), and potential for security
holes.  I have seen a number of systems have scripting and the most successful variations have been:</p>

<ul>
<li>Limited scripting to support customizing very controlled situations (e.g. Templating, Workflow, etc.)</li>
<li>Hog-wild scripting that enables customers to &#8216;fork&#8217; the code base, where that code base is being run on un-shared servers</li>
</ul>


<p>If you want to have a customizable product, the second approach is definitely very powerful.  Otherwise, the first is probably
safer and simpler.  An example of the benefits to server-side (and ultimately hybrid or &#8216;isomorphic&#8217;) is described well here:</p>

<ul>
<li> <a href="https://www.youtube.com/watch?v=pgvlHGi9VXM">https://www.youtube.com/watch?v=pgvlHGi9VXM</a></li>
<li> <a href="http://isomorphic.net">http://isomorphic.net</a></li>
</ul>


<h3>What scripting language?</h3>

<p>The obvious modern scripting language to use is JavaScript.  Because of its&#8217; pervasiveness in the browser, it is among
the better understood languages out there.  It also has a ridiculously simple and powerful language model (JS is a
(maybe accidental?) descendant of Self, which was an amazingly simple and powerful language too).  And although it does
not have a lot of libraries, running JavaScript via Nashorn enables you to call into the Java world.  A tutorial on
Nashorn is here:</p>

<ul>
<li><a href="http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/">http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/</a></li>
</ul>


<h2>Summary</h2>

<p>This article described augmenting both the server and the client by putting in three stack
&#8216;ingredients&#8217; that enable a lot of power (either broadly or in limited situations):</p>

<ul>
<li>Flexible/Semi-structured Data – JSON – On both the client and the server (and the database)</li>
<li>Templating – Dust – On both the client and the server (by the next one)</li>
<li>Scripting: Dual and Isomorphic – JavaScript / Nashorn – Both client and server can then have leverage the same scripting technologies, and potentially chose whether to run something on the server or on the client (or both to enhance SEO)</li>
</ul>


<p>These ingredients make for a much more powerful and flexible application.  These may be overkill for some projects, but
 they are definitely <em>generally useful</em> and whether &#8216;utilized&#8217; they should be considered &#8216;available&#8217; when needed.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ADD Stack [Part-4]]]></title>
    <link href="http://markfussell.emenar.com/blog/addstack-4/"/>
    <updated>2015-10-15T03:00:00-07:00</updated>
    <id>http://markfussell.emenar.com/blog/addstack-4</id>
    <content type="html"><![CDATA[<p>This is the second series describing the ADD: a radically more productive development and delivery environment.  The
first article is here: <a href="http://markfussell.emenar.com/blog/addstack-1/">Intro</a> and described the truth and lies about developing software.
The second article dealt with &#8216;Testing&#8217;.  The third with the application stack (Grails and other technologies).</p>

<h2>User Interface</h2>

<p>Of all the technologies that change, the User Interface is by far the most diverse and most evolved.  Modern
databases are actually pretty old technology.  Modern languages are not significantly different from ancestors
in the 1970s.  Computers have the same main components.  Programmers interact with them with keyboards and screens.
If you picked well, you are programming better (tens of thousands of hours help) but are sadly
on pretty much the same core concepts you learned in your first five thousand hours.  Sigh.</p>

<p>Except.  Except the User Interface.  The implementation of user interfaces has grown since the 70s (the
first bit-mapped and mouse-based UIs were built way back then) through Smalltalk, Objective-C, Flash, Flex,
Angular, and other paths.  But even the devices have changed.  An iPhone is not a computer.  An Apple Watch
is not an iPhone.  Times they are a changing&#8230; at least for &#8216;devices&#8217;.</p>

<h3>It&#8217;s your face</h3>

<p>The User Interface is also the &#8216;face&#8217; of a company.  It sells the company.  Whether to new customers, existing
customers, employees, stock holders, or potential investors.  A web site like Rumble&#8217;s:</p>

<ul>
<li><a href="http://rumblegames.com/">http://rumblegames.com/</a></li>
</ul>


<p><img src="http://markfussell.emenar.com/images/addstack-4/addstack4_ui1.png" /></p>

<p>And Rumble&#8217;s actual games are trying to appeal to a particular audience (middle aged men) and give
them something they want (to feel powerful and sophisticated).</p>

<p>A web site like PortaPlanter:</p>

<ul>
<li><a href="http://PortaPlanter.com/">http://PortaPlanter.com/</a></li>
</ul>


<p><img src="http://markfussell.emenar.com/images/addstack-4/addstack4_ui2.png" /></p>

<!--more-->


<p>is targeting a different audience (very broad, green-conscious, etc.) and trying to give them something they want
(to help the planet) where hopefully the product speaks mostly for itself so there are no &#8220;frills&#8221; on
the page.  The PortaPlanter site is currently a bit under-skinned, but even sophisticated product sites tend to
mostly <em>show the product</em> in isolation and in use.</p>

<p>The expense of the UI should never be under-estimated.  It is <em>by far</em> the most variable expense/investment a company
can control about their software products.  Like marketing.  Build everything <em>perfectly</em> and the UI will be
the only thing that can change the cost.  Well, next to &#8216;rapid feature changes&#8217; but that is more controllable
because you can turn it on and off.  The PortaPlanter web site cost a few thousand (mostly the pictures),
is trivial to maintain, and costs nothing to run (static hosting by GitHub).
The Rumble web site cost nearly a million dollars, is made from a very sophisticated PHP package
which costs thousands of dollars to do significant changes to, and hosting it costs thousands of dollars.
That is just the web site of the company, not the games themselves.</p>

<h3>What face do you want?</h3>

<p>The million-dollar Rumble site was primarily done by a company called Viget who came into Rumble and
showed us a bunch of different web sites based on certain aspects we told them we wanted.  The CEO
and his right hand were the primary &#8216;Customers&#8217; but we also had a graphic artist that has a great
eye for these things.  Working among the Rumble and Viget teams, we got what you see above.  It is
  implemented in Expression Engine (a PHP engine), but <em>the design</em> and <em>the capabilities</em> are the
  driving factor behind it&#8217;s cost not the implementation technology (although EE is overkill).</p>

<p>Using a firm like Viget is one approach, but another is to simply figure out what you want to look like.
Jerry Kaplan founded &#8216;Winster&#8217; to be an online gambling company.  That was originally illegal, so he
pivoted a bit, but if you look at the site&#8230; it looks like Vegas or Reno:</p>

<ul>
<li><a href="http://www.winster.com/">http://www.winster.com/</a></li>
</ul>


<p><img src="http://markfussell.emenar.com/images/addstack-4/addstack4_ui3.png" /></p>

<p>This is exactly what Jerry wanted.  He (the CEO) was the designer and the rest of us just implemented
 his vision (or face his wrath&#8230;)</p>

<p>Turns out this web site is somewhat expensive because it was initially built in Flash and Flex (and
when &#8216;converted&#8217; Jerry wanted to keep the feel).  So it needs to be quirkier than most web sites
 in spite of its graphic and content simplicity.</p>

<p>For all of my most recent startups, the Face was a huge part:</p>

<ul>
<li>Rumble – Powerful games for powerful people</li>
<li>PeerCase – Modern (iPad caliber), graphically elegant, but intuitive and medical (especially appealing to doctors)</li>
<li>Vive – Must make exercise seem like fun</li>
<li>FooMojo – Make sure virtual pets look as fun as real pets</li>
<li>Winster – Vegas or bust!</li>
</ul>


<p>and each one had a different front-end technology <em>in spite of</em> being written mostly by me and having fairly similar
 back-end technologies (Java, Rails, and Grails).  This isn&#8217;t because I like swapping out the front-end.  I offered
 to use Flex for all of them.  But Flex isn&#8217;t mobile.  And the mobile space was of concern to everyone but &#8216;Winster&#8217;.</p>

<h3>How do you implement?</h3>

<p>By now you may be groaning:</p>

<blockquote><p>OK. OK. I need to decide what &#8216;face&#8217; I want.  I will&#8230; I promise&#8230;
But what are the choices for implementation?
What is &#8216;plausibly&#8217; in the picture as a best implementation approach for the UI.</p></blockquote>

<p>This is pretty easy.  There are simply three productive and effective choices&#8230; with some variants within them.</p>

<ul>
<li>Static web site.  By far the most productive and effective if it fills your needs.  You don&#8217;t write HTML, but the site gets generated from a technology like Markdown.  This site is made that way.</li>
<li>Server-side rendering.  The next most productive and very effective if it fills your needs.  You don&#8217;t write HTML, you write something like GSPs which are templates that get expanded for each server hit.  The &#8216;petclinic&#8217; example is this kind of site.

<ul>
<li>Note this does not mean the client is doing nothing.  It may be doing a lot.  But the server is frequently interacted with to generate pages or partial-pages.</li>
</ul>
</li>
<li>Client-side rendering.  The most sophisticated (sort of) and if this can&#8217;t fill your need, you can always use either of the above.</li>
</ul>


<p>Some other approaches are &#8216;Native Application&#8217; or a &#8216;Native-enhanced web-app&#8217; but those need only be considered for very
particular needs.</p>

<p>Among the three main choices, only &#8216;Server&#8217; vs. &#8216;Client&#8217; lead down interesting paths.  There are lots of &#8216;static&#8217; tools so
that is more an experience and &#8216;taste&#8217; issue.  Markdown is great, but it isn&#8217;t for everyone.  And SAAS like SquareSpace
are very nice if they fill your needs.</p>

<h4>Server-side</h4>

<p>The interesting part about server-side rendering is it says <em>nothing</em> about the sophistication of the page.  Or the number
of pages (could be one&#8230; could be 1000).  I actually believe that server-side rendering must be considered the default
and then you can decide how much to branch off from there.  PeerCase was mostly a one-page-application (in Sencha) and
most of the client-server interaction was JSON.  But there were different versions of the one-page-application depending
on what kind of client hit the server.  The server bundled up the appropriate resources together and down-they-went.
Desktop clients made a lot a &#8216;asset&#8217; requests because they can handle them concurrently and cache them.
Mobile devices got a manifest and did an update in the background.</p>

<p>Grails is great at server-side rendering and can easily use Angular or any framework within each page.</p>

<p>An example of this is the &#8216;angular-grails3&#8217; project.  This is just a grails application that includes angular like this:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'><span class="cp">&lt;!DOCTYPE html&gt;</span>
</span><span class='line'><span class="nt">&lt;html</span> <span class="na">lang=</span><span class="s">&quot;en&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>  <span class="nt">&lt;head&gt;</span>
</span><span class='line'>      <span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">&quot;Content-Type&quot;</span> <span class="na">content=</span><span class="s">&quot;text/html; charset=UTF-8&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>      <span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">&quot;X-UA-Compatible&quot;</span> <span class="na">content=</span><span class="s">&quot;IE=edge,chrome=1&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>      <span class="nt">&lt;title&gt;&lt;g:layoutTitle</span> <span class="na">default=</span><span class="s">&quot;Grails&quot;</span><span class="nt">/&gt;&lt;/title&gt;</span>
</span><span class='line'>      <span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content=</span><span class="s">&quot;width=device-width, initial-scale=1.0&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>
</span><span class='line'>          <span class="nt">&lt;asset:stylesheet</span> <span class="na">src=</span><span class="s">&quot;application.css&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'>
</span><span class='line'>        <span class="nt">&lt;asset:script</span> <span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>            angular.module(&#39;myApp.core.constants&#39;)
</span><span class='line'>                .constant(&#39;rootUrl&#39;, &#39;${grailsApplication.config.angular.rootUrl}&#39;)
</span><span class='line'>                .constant(&#39;pageSize&#39;, &#39;${grailsApplication.config.angular.pageSize}&#39;)
</span><span class='line'>                .constant(&#39;dateFormat&#39;, &#39;${grailsApplication.config.angular.dateFormat}&#39;);
</span><span class='line'>        <span class="nt">&lt;/asset:script&gt;</span>
</span><span class='line'>
</span><span class='line'>        <span class="nt">&lt;asset:javascript</span> <span class="na">src=</span><span class="s">&quot;application.js&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'>        <span class="nt">&lt;asset:deferredScripts</span> <span class="nt">/&gt;</span>
</span><span class='line'>      <span class="nt">&lt;g:layoutHead/&gt;</span>
</span><span class='line'>  <span class="nt">&lt;/head&gt;</span>
</span><span class='line'>  <span class="nt">&lt;body</span> <span class="na">id=</span><span class="s">&quot;ng-app&quot;</span> <span class="na">ng-app=</span><span class="s">&quot;${pageProperty(name: &#39;body.ng-app&#39;) ?: &#39;myApp&#39;}&quot;</span><span class="nt">&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<p>and voilà, we have Angular running in a page that can access Grails configuration and application capabilities.</p>

<h4>Client-side</h4>

<p>Client-side rendering is really more like &#8216;separate client from server&#8217; development.
It is making &#8220;building the client&#8221; into somthing
that makes sense independent of the server.  Picking this over server-side rendering is making a few statements:</p>

<ul>
<li>We want to leverage &#8216;separate-client&#8217; technology</li>
<li>We may have people who are comfortable with &#8216;separate-client&#8217; technology and not with the server technology</li>
<li>We want to increase the chance that we don&#8217;t do something stupid that prevents us from swapping server or client</li>
</ul>


<p>An example of this approach is the &#8216;grails3-angular-duo&#8217; project which has a:</p>

<ul>
<li>backend – In grails</li>
<li>frontend – In Angular + Gulp, Bower, Karma, etc.</li>
</ul>


<p>And although you &#8216;hit the backend&#8217; to get your first web page, that actual page comes from
the frontend build system.  And in this case the &#8216;api&#8217; is pure REST.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
</pre></td><td class='code'><pre><code class='groovy'><span class='line'><span class="kd">class</span> <span class="nc">UrlMappings</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'>    <span class="kd">static</span> <span class="n">mappings</span> <span class="o">=</span> <span class="o">{</span>
</span><span class='line'>        <span class="s2">&quot;/$controller/$action?/$id?(.$format)?&quot;</span><span class="o">{</span>
</span><span class='line'>            <span class="n">constraints</span> <span class="o">{</span>
</span><span class='line'>                <span class="c1">// apply constraints here</span>
</span><span class='line'>            <span class="o">}</span>
</span><span class='line'>        <span class="o">}</span>
</span><span class='line'>
</span><span class='line'>        <span class="s2">&quot;/&quot;</span><span class="o">(</span><span class="nl">redirect:</span><span class="s2">&quot;/frontend/index.html&quot;</span><span class="o">)</span>
</span><span class='line'>        <span class="s2">&quot;500&quot;</span><span class="o">(</span><span class="nl">view:</span><span class="s1">&#39;/error&#39;</span><span class="o">)</span>
</span><span class='line'>        <span class="s2">&quot;404&quot;</span><span class="o">(</span><span class="nl">view:</span><span class="s1">&#39;/notFound&#39;</span><span class="o">)</span>
</span><span class='line'>
</span><span class='line'>        <span class="s2">&quot;/api/books&quot;</span><span class="o">(</span><span class="nl">resources:</span><span class="s2">&quot;book&quot;</span><span class="o">)</span>
</span><span class='line'>        <span class="s2">&quot;/api/authors&quot;</span><span class="o">(</span><span class="nl">resources:</span><span class="s2">&quot;author&quot;</span><span class="o">)</span>
</span><span class='line'>
</span><span class='line'>    <span class="o">}</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Interestingly, the front-end is now a mostly-static web site.  The content isn&#8217;t static because it depends on JSON,
but most everything else is locked down.  So this is in some ways <em>less</em> flexible than the server side rendering.
Fewer things can change without building another page and sending it out (deploying and referencing it).</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
<span class='line-number'>55</span>
<span class='line-number'>56</span>
<span class='line-number'>57</span>
<span class='line-number'>58</span>
<span class='line-number'>59</span>
<span class='line-number'>60</span>
<span class='line-number'>61</span>
<span class='line-number'>62</span>
<span class='line-number'>63</span>
<span class='line-number'>64</span>
<span class='line-number'>65</span>
<span class='line-number'>66</span>
<span class='line-number'>67</span>
<span class='line-number'>68</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'><span class="cp">&lt;!doctype html&gt;</span>
</span><span class='line'>  <span class="nt">&lt;head&gt;</span>
</span><span class='line'>    <span class="nt">&lt;meta</span> <span class="na">charset=</span><span class="s">&quot;utf-8&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">&quot;X-UA-Compatible&quot;</span> <span class="na">content=</span><span class="s">&quot;IE=edge&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="nt">&lt;title&gt;&lt;/title&gt;</span>
</span><span class='line'>    <span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">&quot;description&quot;</span> <span class="na">content=</span><span class="s">&quot;&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content=</span><span class="s">&quot;width=device-width&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">&quot;shortcut icon&quot;</span> <span class="na">href=</span><span class="s">&quot;favicon.ico&quot;</span> <span class="na">type=</span><span class="s">&quot;image/x-icon&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- build:css styles/vendor.css --&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- bower:css --&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- endbower --&gt;</span>
</span><span class='line'>    <span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href=</span><span class="s">&quot;bower_components/bootstrap/dist/css/bootstrap.css&quot;</span> <span class="nt">/&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- endbuild --&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- build:css({.tmp,app}) styles/main.css --&gt;</span>
</span><span class='line'>    <span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href=</span><span class="s">&quot;styles/main.css&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- endbuild --&gt;</span>
</span><span class='line'>  <span class="nt">&lt;/head&gt;</span>
</span><span class='line'>  <span class="nt">&lt;body</span> <span class="na">ng-app=</span><span class="s">&quot;duo&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>    <span class="c">&lt;!--[if lt IE 7]&gt;</span>
</span><span class='line'><span class="c">      &lt;p class=&quot;browsehappy&quot;&gt;You are using an &lt;strong&gt;outdated&lt;/strong&gt; browser. Please &lt;a href=&quot;http://browsehappy.com/&quot;&gt;upgrade your browser&lt;/a&gt; to improve your experience.&lt;/p&gt;</span>
</span><span class='line'><span class="c">    &lt;![endif]--&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;header&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>      <span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">&quot;nav nav-pills pull-right&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>        <span class="nt">&lt;li</span> <span class="na">class=</span><span class="s">&quot;active&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">ng-href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;</span>Home<span class="nt">&lt;/a&gt;&lt;/li&gt;</span>
</span><span class='line'>        <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">ng-href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;</span>About<span class="nt">&lt;/a&gt;&lt;/li&gt;</span>
</span><span class='line'>        <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">ng-href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;</span>Contact<span class="nt">&lt;/a&gt;&lt;/li&gt;</span>
</span><span class='line'>      <span class="nt">&lt;/ul&gt;</span>
</span><span class='line'>      <span class="nt">&lt;h3</span> <span class="na">class=</span><span class="s">&quot;text-muted&quot;</span><span class="nt">&gt;</span>DUO<span class="nt">&lt;/h3&gt;</span>
</span><span class='line'>    <span class="nt">&lt;/div&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;jumbotron&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>      <span class="nt">&lt;h1&gt;</span>Grails Angular Duo Sample<span class="nt">&lt;/h1&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="c">&lt;!-- Add your site or application content here --&gt;</span>
</span><span class='line'>    <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;container&quot;</span> <span class="na">ng-view=</span><span class="s">&quot;&quot;</span><span class="nt">&gt;&lt;/div&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="nt">&lt;/div&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;footer&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>      <span class="nt">&lt;p&gt;</span>Using : AngularJS, ngRoute, Restangular<span class="nt">&lt;/p&gt;</span>
</span><span class='line'>    <span class="nt">&lt;/div&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="c">&lt;!-- build:js scripts/vendor.js --&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- bower:js --&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/jquery/dist/jquery.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular/angular.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-animate/angular-animate.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-aria/angular-aria.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-cookies/angular-cookies.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-messages/angular-messages.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-route/angular-route.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-sanitize/angular-sanitize.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/angular-touch/angular-touch.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/bootstrap/dist/js/bootstrap.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/lodash/lodash.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;bower_components/restangular/dist/restangular.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- endbower --&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- endbuild --&gt;</span>
</span><span class='line'>
</span><span class='line'>    <span class="c">&lt;!-- build:js({.tmp,app}) scripts/scripts.js --&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;scripts/app.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;scripts/controllers/list-author.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;scripts/controllers/create-author.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;scripts/controllers/edit-author.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</span><span class='line'>    <span class="c">&lt;!-- endbuild --&gt;</span>
</span><span class='line'><span class="nt">&lt;/body&gt;</span>
</span><span class='line'><span class="nt">&lt;/html&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<h4>Hybrid</h4>

<p>OK, so I simplified above to get through the main concepts.  Both server-side and separate-client can be
transformed into the most powerful approach known to man&#8230; the &#8216;anything goes&#8217; or &#8216;hybrid&#8217; approach.</p>

<p>Render client, render server, send JSON, receive JSON, send POST, receive POST, open up a direct socket,
send data or HTML both directions, hook into the device&#8217;s capabilities. take over the camera and capture
 photos of the user, post to twitter, etc.</p>

<p>The problems with Hybrid approaches are:</p>

<ul>
<li>To quantify &#8220;What is allowed&#8221; and &#8220;What is not&#8221;</li>
<li>To have a coherent model</li>
<li>To have people understand the model</li>
</ul>


<p>Winster had a very good hybrid model by the time I left (product development had basically ended and Jerry was working solely on Marketing)</p>

<ul>
<li>You hit a Java server</li>
<li>It sends you a Flex application</li>
<li>Most communication is based on JSON calls to the server</li>
<li>But updates to games, chats, and presence come through an open socket</li>
</ul>


<p>The reason for the socket is that you needed to be told of <em>other people&#8217;s</em> actions.  Some technology (e.g. comet or the socket)
that can &#8220;push&#8221; updates to the client had to be used for this.  Early on, a previous architect picked sockets, and although the protocol through the socket
improved / evolved, the actual use-of-socket was not swapped out.</p>

<p>Rumble had an extreme hybrid model involving mostly open sockets to game servers,
but also ejabberd (XMPP), JSON, and a slew of different technologies solving different problems.
The drawback of using third-party technologies is that they bring in different approaches to client-server
communication.</p>

<h3>Conclusion</h3>

<p>The goal of the UI is to present a good, cost-effective, consistent, and sufficiently capable &#8216;face&#8217; to your
 users and prospects.  There are a number of different approaches that have different benefits.</p>

<p> I recommend
 starting from the position of server-side rendering because that gives a lot of power with almost no extra cost.  It makes people
 work with the entire application and reduces chances of &#8216;schisms&#8217; within the development team.  On the
 other hand, &#8216;separate client&#8217; technologies are quite good and by thinking &#8216;separate client&#8217; you may produce
 a somewhat better API.  But a &#8216;schism&#8217; is more likely, testing is harder, and the separate client is
 less flexible in how it can integrate with the server (at least for &#8216;free&#8217;).</p>
]]></content>
  </entry>
  
</feed>
