<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Clarity Hub, Inc on Medium]]></title>
        <description><![CDATA[Stories by Clarity Hub, Inc on Medium]]></description>
        <link>https://medium.com/@clarityhub_owl?source=rss-a60c999779a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*16XjCIMYR5FrVT7X6uF2eg.png</url>
            <title>Stories by Clarity Hub, Inc on Medium</title>
            <link>https://medium.com/@clarityhub_owl?source=rss-a60c999779a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 09:40:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@clarityhub_owl/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writing Your Own Authentication React Components for Meteor]]></title>
            <link>https://medium.com/@clarityhub_owl/writing-your-own-authentication-react-components-for-meteor-ab793a3ad009?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab793a3ad009</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Fri, 08 Sep 2017 16:41:01 GMT</pubDate>
            <atom:updated>2017-09-08T16:41:01.072Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on February 29, 2017 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>With Meteor new separating their accounts logic from Blaze, you might be wondering how to get your React Meteor app wired up to log users in and register new users.</p><p>What I usually do, is completely throw out the Blaze Account UI template that is usually provided and instead role my own.</p><h3>The Login Form</h3><p>Let’s start by implementing a login component in React that will just login the user using Meteor’s authentication:</p><pre>import React, { Component } from &#39;react&#39;;<br>import { Meteor } from &#39;meteor/meteor&#39;;<br>export default class Login extends Component {<br>  handleSubmit = (event) =&gt; {<br>    event.preventDefault();<br>    <br>    Meteor.loginWithPassword(this.email.value, this.password.value);<br>  }<br> <br>  render() {<br>    return (<br>      &lt;form onSubmit={this.handleSubmit}&gt;<br>        &lt;label&gt;<br>          Email<br>          &lt;input<br>            type=&quot;email&quot;<br>            ref={(email) =&gt; this.email = email}<br>          /&gt;<br>        &lt;/label&gt;<br>        &lt;label&gt;<br>          Password<br>          &lt;input<br>            type=&quot;password&quot;<br>            ref={(password) =&gt; this.password = password}<br>          /&gt;<br>        &lt;/label&gt;<br>      &lt;/form&gt;<br>    );<br>  }<br>}</pre><p>This will log the user in with their password.</p><h3>The Registration Form</h3><p>For registering a user, you’ll need to <strong>accounts-base</strong>:</p><pre>import React, { Component } from &#39;react&#39;;<br>import { Accounts } from &#39;meteor/accounts-base&#39;;<br>export default class Register extends Component {<br>  handleSubmit = (event) =&gt; {<br>    event.preventDefault();<br>    <br>    Accounts.createUser(this.email.value, this.password.value);<br>  }<br> <br>  render() {<br>    return (<br>      &lt;form onSubmit={this.handleSubmit}&gt;<br>        &lt;label&gt;<br>          Email<br>          &lt;input<br>            type=&quot;email&quot;<br>            ref={(email) =&gt; this.email = email}<br>          /&gt;<br>        &lt;/label&gt;<br>        &lt;label&gt;<br>          Password<br>          &lt;input<br>            type=&quot;password&quot;<br>            ref={(password) =&gt; this.password = password}<br>          /&gt;<br>        &lt;/label&gt;<br>      &lt;/form&gt;<br>    );<br>  }<br>}</pre><h3>Checking If Logged In</h3><p>If you are using React Router, you’ll probably want to check that the user is logged in for certain routes. You can do that by adding a Route with an <strong>onEnter</strong> callback:</p><pre>&lt;Route onEnter={requireAuth}&gt;<br>   {/* my auth routes */}<br> &lt;/Route&gt;</pre><p>The <strong>requireAuth</strong> function will look something like:</p><pre>const requireAuth = (nextState, replace) =&gt; {<br>  if (isLoggedOut()) {<br>    replace({<br>      pathname: &#39;/login&#39;,<br>      state: { nextPathname: nextState.location.pathname },<br>    });<br>  }<br>};</pre><p><strong>isLoggedOut</strong> is a small helper function I wrote, along with <strong>isLoggedIn</strong>:</p><pre>import { Meteor } from &#39;meteor/meteor&#39;;<br>export const isLoggedIn = () =&gt; {<br>  return Boolean(Meteor.userId());<br>};<br>export const isLoggedOut = () =&gt; {<br>  return !Meteor.userId();<br>};</pre><p>Using these building blocks, you can role your own login and registration forms that use passwords. Similar methods are used to login the user using Facebook, Twitter, etc which you can find documentation for on <a href="http://docs.meteor.com/api/accounts.html">the Meteor docs</a>.</p><p>This method provides much greater flexibility in your forms and allows you to remove the Blaze dependency from your React Meteor apps!</p><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab793a3ad009" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices using Lumen and Homestead]]></title>
            <link>https://medium.com/@clarityhub_owl/microservices-using-lumen-and-homestead-f53d0d0512ef?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f53d0d0512ef</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Thu, 07 Sep 2017 16:31:01 GMT</pubDate>
            <atom:updated>2017-09-07T16:31:01.155Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on August 2, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>Microservices are small services that make up a single application. They run on their own processes and communicate with lightweight mechanisms.</p><p>In this article, we’ll explore how to setup a project with many different microservices, and also how to distribute those microservices so that developers can work on them with minimal set up.</p><p>For a working example, see <a href="https://github.com/CapsuleCat/LumenMicroserviceExample">our Github</a>.</p><h3>Setting Up Your Project</h3><p>We’ll set up our project by splitting up our microservices into different folders. Each folder will have a different installation of Lumen in it. Our reasoning here is that each microservice should be self-sufficient. If one service wants to use PostgreSQL and another wants to use MongoDB, they should be independently able to. The other bonus here is that each service can be deployed on it’s own, which allows us to scale services independently of each other.</p><p>For example, if we creating a chat application called <strong>awesome-chat</strong>, we may want to split up the application into:</p><ul><li>authentication — for registering and logging users in;</li><li>chat — for handling rooms, messages, and reading users that belong to those rooms;</li><li>rtc — for handling our real time connections, which will read and create messages, rooms, and users in real time;</li><li>mail — for sending confirmation emails, invitations, and password reset emails;</li><li>.homstead — this is where we will put our configuration for our Homestead instance.</li></ul><pre>awesome-chat<br>│ README.md<br>│<br>├ .homestead<br>└ services<br>  ├ auth<br>  ├ chat<br>  ├ rtc<br>  └ mail</pre><p>Each folder has it’s own Lumen installation.</p><p>In the next section, we’ll use Homestead and Vagrant deploy all of these services locally and be able to hit each one from our host machine.</p><h3>Setting Up Homestead</h3><p>Homestead gives two different ways we can install it: globally so that we can work on many different projects in the same environment, or per project, so that we can make a specific configuration for our project. In our case, what we will do since we are developing locally is create one Homestead Vagrant configuration that any developer can launch. The instance will have all our microservices running on it.</p><p>In our .homestead directory, we will initialize Homestead and make some changes to our Homestead.yaml file.</p><pre>vagrant box add laravel/homestead<br>cd .homestead<br>composer require laravel/homestead — dev</pre><p>Then, open up the Homestead.yaml file. I suggest you change the hostname, name, and databases to reflect your project’s name. Then, change your folders and sites to the following:</p><pre>folders:<br>    - map: &quot;../services/auth&quot;<br>      to: &quot;/home/vagrant/awesome-chat/auth&quot;<br>    - map: &quot;../services/chat&quot;<br>      to: &quot;/home/vagrant/awesome-chat/chat&quot;<br>    - map: &quot;../services/rtc&quot;<br>      to: &quot;/home/vagrant/awesome-chat/rtc&quot;<br>    - map: &quot;../services/mail&quot;<br>      to: &quot;/home/vagrant/awesome-chat/mail&quot;<br>sites:<br>    - map: auth.awesome-chat.app<br>      to: &quot;/home/vagrant/awesome-chat/auth/public&quot;<br>    - map: chat.awesome-chat.app<br>      to: &quot;/home/vagrant/awesome-chat/chat/public&quot;<br>    - map: rtc.awesome-chat.app<br>      to: &quot;/home/vagrant/awesome-chat/rtc/public&quot;<br>    - map: mail.awesome-chat.app<br>      to: &quot;/home/vagrant/awesome-chat/mail/public&quot;</pre><h3>Running the Environment</h3><p>In order to actually run the Homestead Vagrant machine, you’ll need to update your hosts file. We’ll simply add entries for all of our subdomains to point to our Vagrant box.</p><p>If you are on Mac or Linux machine, updating your hosts file is easy:</p><pre>sudo vi /etc/hosts</pre><p>Then add the following entries:</p><pre>192.168.10.10   auth.project.app<br>192.168.10.10   chat.awesome-chat.app<br>192.168.10.10   rtc.awesome-chat.app<br>192.168.10.10   mail.awesome-chat.app</pre><p>Once the configuration is saved, you can simply run vagrant up and navigate to auth.awesome-chat.app in your web browser to see the services respond.</p><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f53d0d0512ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Mini Series 1 — What is React?]]></title>
            <link>https://medium.com/@clarityhub_owl/react-mini-series-1-what-is-react-5f846594bbe2?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f846594bbe2</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Thu, 07 Sep 2017 15:36:43 GMT</pubDate>
            <atom:updated>2017-09-07T15:36:43.323Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on September 27, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>React is an amazing web technology that I use daily. It’s paradigm of breaking your app up into components, keeping your HTML near your JavaScript, and using props and state to track data has been extremely helpful while developing small and large applications.</p><p>I have started creating a tutorial mini-series on React, with the goal being short, concise video tutorials covering ReactJS. These tutorials will be on Youtube, and will go over React fundamentals, just as what a component is, how the component lifecycle works, when to use shouldComponentUpdate, and writing composeable, reusable components.</p><p>Here is a link to <a href="https://youtu.be/OOIk-jmcjac">the first video in the series</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOOIk-jmcjac%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOOIk-jmcjac&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOOIk-jmcjac%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4a3a529800f12a49fb3b1ca0ef70c64/href">https://medium.com/media/a4a3a529800f12a49fb3b1ca0ef70c64/href</a></iframe><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f846594bbe2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Testing With Cucumber JS]]></title>
            <link>https://medium.com/@clarityhub_owl/automating-testing-with-cucumber-js-82f21393af1c?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/82f21393af1c</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Wed, 06 Sep 2017 17:26:00 GMT</pubDate>
            <atom:updated>2017-09-06T17:26:00.921Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on June 28, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>With any website or app, you usually do some amount of testing, wether that be from a QA team or just giving your app a once over. Testing can greatly improve the quality of an app and ensure a smoother launch of a product. After all the more eyes on something the more likely it is you’ll find a problem before a potential user does.</p><p>However testing can be time consuming, expensive and even boring. You can only run through the login process so many times before you wonder if there is a better way or if it’s even worth the time.</p><p>To answer these rhetorical questions, testing is worth the time, and there is a better way. For much of your testing, you can automate the process using <a href="https://cucumber.io/docs/reference">Cucumber</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*saeoUPWJRtd7ciEx.png" /></figure><h3>What is Cucumber?</h3><p>Cucumber is a <a href="https://en.wikipedia.org/wiki/Behavior-driven_development">Behavior Driven Development</a> tool used to automate repetitive test actions taken by the user. Cucumber uses the browser to complete user actions, such as clicking submitting a form and entering text. It does so by finding elements by their classes, ids, and values (ect). Once found, it then completes a given action on that element.</p><p>Cucumber runs through tests on a step by step basis, where if a single step in a feature fails, it will skip the remaining steps in that feature but then continue on with the remaining tests. This lets you quickly run through repetitive tests without worrying if some of them fail.</p><p>While we will go over these in a little more detail later, here is an example of a basic feature file and it’s matching step definition file.</p><pre>Feature: Search the Web<br>  As a human<br>  I want to test cucumber<br>  So I can work<br>  <a href="http://twitter.com/watch">@watch</a><br>  Scenario: Learn this<br>    Given I have visited Google<br>    When I search for &quot;cucumber.io&quot;<br>    And I click on the first result<br>    Then I see &quot;cucumber.io&quot;</pre><p>And here is the matching step definition file. Each step in the above feature has a matching step definition which Cucumber runs when it sees the step in the feature file.</p><pre>module.exports = function() {<br>  this.Given(/^I have visited Google$/, function () {<br>    client.url(https://medium.com/&#39;%3Ca%20href=%22/service/http://blog.capsulecat.com/&#39;%22%3Ehttp://blog.capsulecat.com/&#39;%3C/a%3E);<br>  });<br>  this.When(/^I search for &quot;([^&quot;]*)&quot;$/, function (searchTerm) {<br>    client.setValue(&#39;input[name=&quot;q&quot;]&#39;, searchTerm);<br>    client.keys([U+E006]);<br>    client.keys([&#39;Enter&#39;]);<br>    client.pause(3000);<br>  });<br>  this.When(/^I click on the first result$/, function () {<br>    client.keys(&#39;Return&#39;);<br>    client.pause(3000);<br>  });<br>  this.Then(/^I see &quot;([^&quot;]*)&quot;$/, function (link) {<br>    var currentURL = client.getUrl();<br>    if(currentURL != &#39;<a href="http://blog.capsulecat.com/&#39;">http://blog.capsulecat.com/&#39;</a>) {<br>      console.log(&#39;failed&#39;);<br>    }<br>  });<br>};</pre><p>Now before you go looking at Cucumber’s site for more information, know their documentation is terrible. <a href="https://chimp.readme.io/docs/tutorial">Chimp JS</a> actually has a nice tutorial on both Cucumber and Chimp, which is a great tool that I’d recommend using along with Cucumber.</p><h3>Installing Cucumber</h3><p>Cucumber is relatively easy to install as <a href="https://www.npmjs.com/package/cucumber">it is on npm</a>. So if you have both Node.js and NPM, you can install a global version of Cucumber JS by running this command in your terminal:</p><p>npm install -g cucumber</p><p>If you want a tool to test your apps with, but do not know or are not a fan of Javascript, Cucumber supports and can be written in <a href="https://cucumber.io/docs">many other languages</a>, however we will only be going over Javascript.</p><p>Cucumber is not the be all end all for automation testing, like with most things programing, there are always other methods and tools you could use. However it is easy to learn, fun to do and it has built in documentation features that makes it maintainable.</p><p>If you’re interested in QA and want to advance your technical knowledge using tools that pertain to QA, this is a great technology to learn and use.</p><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82f21393af1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cucumber Automation tests: Gherkin Features and Step Definitions]]></title>
            <link>https://medium.com/@clarityhub_owl/cucumber-automation-tests-gherkin-features-and-step-definitions-585e15ac97eb?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/585e15ac97eb</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Wed, 06 Sep 2017 16:31:01 GMT</pubDate>
            <atom:updated>2017-09-06T16:31:01.244Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on July 2, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>Cucumber works by using features, and step definitions. Features are written in <a href="https://github.com/cucumber/cucumber/wiki/Gherkin">Gherkin</a> which reads like plain text, and step definitions are written in javascript. Cucumber looks through your feature file, and runs the matching step definition function when it sees a matching pair.</p><h3>Gettings Started With Cucumber: Gherkin</h3><p>Cucumber lets you write your features in Gherkin, a language that reads similar to plain English, making features double as documentation. Each feature file consists of a single feature as well as multiple scenarios for that feature. An example can be seen bellow:</p><pre>Feature: Be a cool cat<br>  <br>  Scenario: Become a cool cat<br>      Given I am not cool<br>      When I read Capsule Cat<br>      Then I become a cool cat<br>  <br>  Scneario: Continue being a cool cat<br>    Given I am already cool<br>    When I read Capsule Cat<br>    Then I continue being cool</pre><p>There are a few things to note in the above format. The Scenario is writin using single steps, where each step consists of a single, simple action the user can take. Typically they follow the given, when, then format. Given a certain state, when the user does this action, then they should see this result. In it’s simplicity, it manages to cover nearly all possible options when testing.</p><p>However there are additional options such as and and but, as well as more advanced options such as adding a background that runs before all scenarios. To see more on these take a look at the <a href="https://cucumber.io/docs/reference">Cucumber docs</a>.</p><p>Cucumber doesn’t distiguish between the given, when, then, and or butkeywords. It only marks them as being the start to a new step. They are mostly used for documentation purpose, so feel free to use whichever keyword fits your step best.</p><p>It is best to keep the number of steps in a scenario between 3–5 to keep things simple, and to have a better idea of where failures are happening. It is also a good idea to keep steps as simple as possible, so if you find you are using any keywords mid step, such as:</p><p>When I enter my username and my password</p><p>It’s best to split the step into multiple steps, even if you pushes your scenario past 5 steps:</p><p>When I enter my username<br>And I enter my password</p><h3>Gettings Started With Cucumber: Step Definition</h3><p>While the Gherkin Features and Scenarios are great for documentation and readability, Cucumber doesn’t run them out of the box. There is one more step you will need to do in order to run your features, and that is write some step definitions. While Cucumber <a href="https://cucumber.io/docs">supports many languages</a>, we’ll be going over JS.</p><p>All step definitions in a step definition file are wrapped in the following function:</p><pre>module.exports = function() {<br>}</pre><p>You can place as many steps in a step definition file, as long as they are all placed inside of your module.exports function. Here is a simple step definition to the step: Given I visit &quot;www.capsulecat.com&quot;:</p><pre>module.exports = function() {<br>  this.Given(/^I visit &quot;([^&quot;]*)&quot;$/, function (searchTerm) {<br>    client.url(https://medium.com/searchTerm);<br>  });<br>}</pre><p>Notice in the definition, you replace what is in the quotations in the step, with &quot;([^&quot;]*)&quot;. And the function takes in a paramiter, which in this case is searchTerm. You can then call on that paramiter in the function like you normally would. Cucumber will take what is in the quotations in the step and pass them into the function as the paramiter. Step definitions don’t need to take a paramiter, the above definition could also be written like this:</p><pre>module.exports = function() {<br>  this.Given(/^I have visited Capsule Cat$/, function () {<br>    client.url(https://medium.com/&quot;%3Ca%20href=%22/service/http://capsulecat.com/%22%3Ehttp://capsulecat.com/%3C/a%3E&quot;);<br>  });<br>}</pre><p>Similarly to steps, step definitions do not care if you use the given, when, then, and or but keywords. But the keyword you use in your step needs to match the one you used in your step definition.</p><p>Now that you know about step definitions, know that there are many ways to automaticlly generate these definitions. Tools like <a href="https://chimp.readme.io/docs/tutorial">Chimp JS</a> take in your Feature files and give you back empty step definitions, which makes things go by a lot faster, as writing step definitions can be timley.</p><h3>Folder Structure</h3><p>While there is no set standard on how to organize your Cucumber files, there is a minimum for what you need. All tests need to be in a “features” folder, but other then that, you can organize them however you’d like.</p><p>While it’s nice to have a loose structure, this is so loose that it’s complicated. It’s hard to have feature files and step deffinitions that both don’t get so long they’re impossible to read, or they are so seperated that they overlap. While it’s not perfect, there is a managable format you can try when starting out:</p><pre>peoject folder<br>|  project folder ext.<br>|  features<br>|  |  specs<br>|  |  |  stepdefinitions.js<br>|  |  feature.feature</pre><p>All step definitions files go in the specs folder, and all feature files go in the feature folder. Your step definition files can get rather long, but with good, standard naming methods, it is managable.</p><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=585e15ac97eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Abstract Factory Pattern]]></title>
            <link>https://medium.com/@clarityhub_owl/the-abstract-factory-pattern-ef4df4824dd1?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef4df4824dd1</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Tue, 05 Sep 2017 16:26:01 GMT</pubDate>
            <atom:updated>2017-09-05T16:26:01.410Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on June 23, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>An Abstract Factory provides an interface for creating families of related or dependent objects without specifying their concrete classes.</p><h3>Why It’s Useful</h3><p>Before we get into the dry definition of the Abstract Factory Pattern, let’s investigate a scenario where it would be useful. When we are going through this situation and solution, we will be using JavaScript — specifically ES6 to make our classes more readable.</p><p>Imagine we want to draw some shapes to an HTML5 Canvas. We’ll want to draw some common shapes like a Circle and a Square to the canvas, but we don’t want to bind our main code to the classes for a Circle and a Square. What we would like to do is have another class that knows how to make our shapes.</p><h3>Some Code</h3><p>Let’s write some simple code that models this situation. We’ll keep our implementation simple so that we can focus on the Abstract Factory Pattern instead of how Circles and Squares get drawn onto a canvas.</p><p>The HTML code:</p><pre><strong>&lt;canvas</strong> id<strong>=</strong>”canvas” width<strong>=</strong>”500px” height<strong>=</strong>”500px”<strong>&gt;&lt;/canvas&gt;</strong></pre><p>This CSS code:</p><pre>canvas {<br>  background-color: white;<br>  border: 1px solid black;<br>}</pre><p>The JavaScript code (the important stuff):</p><pre>class Shape {<br>  constructor(ctx) { this.ctx = ctx; }<br>  draw() { throw new Expection(&quot;Not implemented&quot;); }<br>}<br>class Circle extends Shape {<br>  draw() {<br>    this.ctx.beginPath();<br>    this.ctx.arc(100, 75, 50, 0, 2*Math.PI);<br>    this.ctx.stroke();<br>  }<br>}<br>class Square extends Shape {<br>  draw() {<br>    this.ctx.rect(20,20,100,100);<br>    this.ctx.stroke();<br>  }<br>}<br>class ShapeFactory {<br>  getShape(type, ctx) {<br>    switch(type) {<br>    case &quot;Circle&quot;:<br>      return new Circle(ctx);<br>    case &quot;Square&quot;:<br>      return new Square(ctx);<br>    default:<br>      throw new Exception(&quot;Type not found&quot;);<br>    }<br>  }<br>}<br>// Imagine this is in another file, that has no access to Shape, Square, or Circle,<br>// but does have access to ShapeFactory<br>const c = document.getElementById(&quot;canvas&quot;);<br>const ctx = c.getContext(&quot;2d&quot;);<br>const sf = new ShapeFactory();<br>const circle = sf.getShape(&quot;Circle&quot;, ctx);<br>const square = sf.getShape(&quot;Square&quot;, ctx);<br>circle.draw();<br>square.draw();</pre><p>A runnable JSFiddle for you to preview the results:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2F9tkxkrfr%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2F9tkxkrfr%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c6350360e6035e7b135b9c5213e137e/href">https://medium.com/media/9c6350360e6035e7b135b9c5213e137e/href</a></iframe><h3>The Pattern</h3><p>In the previous code, we used a ShapeFactory to create objects of type Shape. Our main code was thus decoupled from the implementation details of a Circle or a Square. Our main code didn’t need to know how to make a Circle or a Square, it only needed to know about the ShapeFactory.</p><p>Generalizing this, the abstract factory pattern provides a way to create objects of a common theme by grouping individual factories together. When using the factory, your code doesn’t have to know which concrete object actually gets created by the internal factories. It only ends up using the generic interface of the theme.</p><p>This is part of our <a href="http://blog.capsulecat.com/tag/programming-patterns">programming patterns</a> series!</p><p>Learn more about design patterns with <a href="http://amzn.to/1ZXJi1F">Design Patterns: Elements of Reusable Object-Oriented Software</a>.</p><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef4df4824dd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prepping for your App Launch]]></title>
            <link>https://medium.com/@clarityhub_owl/prepping-for-your-app-launch-e53154c36b30?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e53154c36b30</guid>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[launch]]></category>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Mon, 04 Sep 2017 15:16:00 GMT</pubDate>
            <atom:updated>2017-09-04T15:16:00.862Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on June 21, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>There comes a point where you need to launch your app. The app may not be perfect or pretty, but as long as you can provide value to your customers, your app is ready. Apps are never really done. There is always a new feature to add or a bug to fix — but, no matter what, you need to define a point where the app is “good enough” for users to use. Usually, the “good enough” for the creator of the app is when the app is perfect. But for the customer, “good enough” is when he or she can get value out of the app.</p><h3>“Okay it’s time to launch”</h3><p>It’s hard to say that it’s time to launch since you’ll always want to improve your product. Every app needs to be released into the wild for you to truly understand how customers will use it and what features they will actually be looking for. You can waste a lot of time trying to guess how the product will be used, adding features no one will ever use, and delaying your launch way past the point that you needed to start onboarding customers.</p><p>Finding that minimum feature product that provides your users with value is important. Identifying a release date is a defining step towards getting users to start using your app.</p><h3>Before You Launch</h3><p>Before launching your app there are some key steps you should take in order to maximize the benefit of your launch. Sure, getting customers to actually download and use your app is important, but making sure that there is exposure to your app and a way of collecting feedback is just as important.</p><p>Set up a feedback loop. Find a way to collect valuable positive <strong>and </strong>negative feedback from your customers. User reviews of your app on the App stores is an easy way to collect feedback, but unfortunately, the Apple App store does not provide a way for you to respond to user reviews. If you want to collect and respond to negative reviews, consider using a system where you ask the user if they like the app, or if they want to report an issue. The “like the app” option takes them to the App Store review, while the “report an issue” button takes them to a custom form that feeds into your own database. Consider following up with users that find bugs in your app, and let users know that you care about them by releasing fixes and adding new features to your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*BApOxeJPAUVMZJ0f.png" /></figure><p>Set up your app descriptions. Make sure your app is discoverable by providing clear descriptions for the App stores. Use keywords to help your app get discovered by potential users. Think about what users might be searching for and how they might be searching for it. Are they going to use the words “workout” or “exercise”? Determine which keywords your target audience will use.</p><p>Get your marketing materials together. Plan to post on your website or blog. Post on your Twitter, Instagram, Facebook, and any other social media accounts. Add a sign up newsletter on your website. Generate a press kit and send it to writers for other blogs and news sites that write about your app’s niche.</p><h3>Launch!</h3><p>If you are releasing a mobile app, make sure you’ve submitted your app to the app stores two weeks before the launch date. The approval process takes time, and you don’t want pending review statuses delaying your launch plans. Once you’re ready to go, start advertising! Make sure all of your advertising materials are ready. Send out your press kits. Message everyone you know. Generate as much buzz as you can!</p><h3>Now What?</h3><p>Now that you’ve launched, use this time to start getting feedback and planning your next steps. You’ve done a lot of the upfront work with building the first version of your app, but it’s important to keep that momentum going.</p><p>Get user feedback. Engage with your users and get feedback and find common complaints and requests for new features. Focus on working on the smallest changes that deliver the most value. Make sure you tell your users that you have released new features and squashed bugs when you do a release. If you have a newsletter, let people know that you have made a new version and highlight the changes in it.</p><p>Gather metrics on your customers. Figure how your daily and monthly active users. Determine the retention rate. Figure out your average revenue per customer. Get a good idea about your customers life time value. Are your customers leaving too quickly to provide a return on the investment of getting them to download the app? Answer that question early on and focus on making your customer acquisition sustainable.</p><p>Learn more about launching your startup with <a href="http://amzn.to/1ru6Tez">The Lean Startup by Eric Ries</a></p><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e53154c36b30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Usability Questions to Ask Yourself when Making your Website]]></title>
            <link>https://medium.com/@clarityhub_owl/usability-questions-to-ask-yourself-when-making-your-website-4a405922c338?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a405922c338</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Sun, 03 Sep 2017 16:11:00 GMT</pubDate>
            <atom:updated>2017-09-03T16:11:00.899Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on May 24, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>Usability is importable to customers when they are using your website; so it should be your concern too when you are designing and creating your website.</p><p>Consider these questions from the point of view of your visitors:</p><p><strong>Usability</strong></p><ol><li>Is your site easy to use?</li><li>Are you able to find what you need quickly for this website?</li><li>Is the site enjoyable?</li><li>Is it easy to navigate?</li><li>is the website slow?</li></ol><p><strong>Credibility (Trust, Value, and Comfort)</strong></p><ol><li>Do I feel comfortable purchasing from this website?</li><li>Does this website convey a sense of trust?</li><li>Can this website keep the promised it is making to me?</li><li>Is the information in this website valuable?</li><li>Does the website help me find what I am looking for?</li></ol><p><strong>Loyalty</strong></p><ol><li>How likely will I recommend this website to a friend or colleague?</li><li>Will I visit this website in the future?</li></ol><p><strong>Appearance</strong></p><ol><li>Did I find this website to be attractive?</li><li>Does the website have a clean and simple presentation?</li></ol><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a405922c338" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apollo and GraphQL]]></title>
            <link>https://medium.com/@clarityhub_owl/apollo-and-graphql-168800f97463?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/168800f97463</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Sat, 02 Sep 2017 16:11:01 GMT</pubDate>
            <atom:updated>2017-09-02T16:11:01.540Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on May 5, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p><a href="https://docs.google.com/presentation/d/1mE42nftq3DsqPKmmSo4TAH3JjqQohwcfXs_J2l0kpvM/embed?start=false&amp;loop=false&amp;delayms=3000">Apollo: Meteors Answer to JavaScript Fatigue</a></p><p>Special thanks to Sashko for making a lot of the slides that are used in the above presentation and for working on Apollo!</p><p>Apollo is the new GraphQL based stack that the Meteor Development group has been working on. Recently, they have released a technical preview of the Apollo platform, so now we can get a feel for what the architecture of an Apollo-based app will look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MjHVBWTVQGCn2HYE.png" /></figure><p>A lot is happening in the JavaScript community today. There are a plethora of front end frameworks for rendering views. There are frameworks for handling data flow. New tools for querying data. Tons of build tools to pick from.</p><p>But, if we look back, we can see where Meteor started from, what the underlying goal was, and how that goal applies looking forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bxBosyJsNP5sam3C.png" /></figure><p>The MDG group has been focusing their efforts on the Meteor framework and the Galaxy cloud platform. Meteor does a lot of things. When it started 4 years ago, the JavaScript world was a completely different place. Client-side rendering was a concept that was just gaining traction, NodeJS was just becoming popular, and single page apps were starting to become a reality. Meteor came out of the box with a lot of custom tools to fill in all the things you needed to build a complete application entirely in JavaScript.</p><p>The most exciting part of the Meteor experience has always been the data. Meteor achieved this with the Distributed Data Protocol (DDP), mini-Mongo on the client, and MongoDB on the backend.</p><p>Meteor has built Blaze and these build tools because they didn’t exist back 4 years ago. Now, there are a variety of options for the view layer and tons of build tools. The data system, on the other hand, is something where many new tools are springing up in the JavaScript ecosystem. The goal is to keep the data part of Meteor magical. In Meteor, you often write code as if the data you need is already on the client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0JhISYAvO7sAy1Pc.png" /></figure><p>Let’s go over some of the main properties of Meteor’s data system, from a developer productivity point of view:</p><p>Meteor is declarative — you can tell the server what information you are interested in via subscriptions, and the server figures out how to get it to the client in the most efficient manner.</p><p>Meteor is semantic — instead of blobs of JSON fetched from endpoints, data in Meteor is organized into collections where each object has an ID (leveraging the ids in Mongo). You always have a way of referring to a specific object.</p><p>Meteor is stateful and includes caching: Meteor doesn’t load the same data twice, since both the client and the server are aware of what has already been sent over the network. This means you can preload a lot of data and rely on the system to only send diffs, making prolonged interaction with the app more effecient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tYnXk3yQ8F5jJLcY.png" /></figure><p>The goal for the Apollo project is is bring these properties that make Meteor so nice to work with to every app. Whether that app is written in Rails or Express, or has a Microsoft SQL server database or Dynamo DB.</p><p>The goal is to start with JavaScript as the client, but to also branch out and provide libraries for Swift and Java.</p><p>In order to achieve a system like this, MDG had to look for or create a language for decoupling the database from the views that use it. Luckily, Facebook has released GraphQL, a query language where views can request only the data they need from the server to render their view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6_81hf4T1rOVEM1s.png" /></figure><p>The query language is agnostic of the database or databases that drive it. When a view queries for a user, the user data might be pulled in from MongoDB, or MySQL, or PostgreSQL or all three.</p><p>So what is GraphQL?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yeNolVERX68GJLbA.png" /></figure><p>GraphQL is a way of making queries that get interpreted by the server. The server will respond only with the data that you asked for.</p><p>GraphQL is made up of schemas and resolvers. Schemas have types and types can be nested. Here in this example, a user can be type, and the profile picture is another type. Our front end may request a user with a profile picture — but it doesn’t care where those pieces of data come from. The user data may be in MySQL, and the profile picture might be in Postgres. The resolvers on the server are in charge of mapping these type requests to database requests and responding with the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bUF7RtiuwDd4TDD6.png" /></figure><p>Here is how a complex application may use Apollo from a 10,000 foot view. There can be many clients and backends working together that the Apollo server would sit inbetween. It would take GraphQL requests and resolve to to their data sources and respond with the data that the client asked for.</p><p>Apollo gives you a principled, unified, and scalable API for all of your client apps, agnostic of what is going on in the backend.</p><p>So what happens when the client make a request?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UsZoO7KmCqjV8LZq.png" /></figure><p>While you can get a lot of benefits of using GraphQL through simply sending POST requests to your server, it becomes much better once you have a smarter client that can avoid fetching data you already have, and give you other features that we’ll talk about below. Let’s compare what we’re thinking about with Apollo and GraphQL to Meteor’s current data stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hXsgBGQdtjZ_G5V6.png" /></figure><p>For more information, see:</p><ul><li><a href="https://github.com/apollostack/apollo">https://github.com/apollostack/apollo</a></li><li><a href="http://www.apollostack.com/">http://www.apollostack.com/</a></li><li><a href="http://graphql.org/docs/validation/">http://graphql.org/docs/validation/</a></li><li><a href="http://docs.apollostack.com/apollo-server/guide.html">http://docs.apollostack.com/apollo-server/guide.html</a></li><li><a href="https://github.com/apollostack/eslint-plugin-graphql">https://github.com/apollostack/eslint-plugin-graphql</a></li></ul><p>Thanks for reading! If you liked this article, feel free to <a href="https://twitter.com/clairvoyanceio">follow us on Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=168800f97463" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Planning for Accessibility in Your Site]]></title>
            <link>https://medium.com/@clarityhub_owl/planning-for-accessibility-in-your-site-8249f6913c25?source=rss-a60c999779a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8249f6913c25</guid>
            <dc:creator><![CDATA[Clarity Hub, Inc]]></dc:creator>
            <pubDate>Fri, 01 Sep 2017 17:11:02 GMT</pubDate>
            <atom:updated>2017-09-01T17:11:02.421Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article was originally published on March 31, 2016 on The Capsule Cat Blog. For archive purposes, we moved it here!</em></p><p>The web should be open and usable by all — this includes people with disabilities. Web accessibility means that the millions of people with disabilities that use the web can interact, understand, navigate, and contribute to websites.</p><p>Here are a few easy questions to ask yourself to check if your website is accessible to people with visual, auditory, speech, and other impairments.</p><h3>Is your site accessible via screen readers?</h3><p>Check to make sure your website is navigable from screen readers.</p><p>Your website should be navigable via using the TAB key. If you have a large menu at the top, add a hidden <a href="http://blog.capsulecat.com/2016/03/29/skip-links/">skip link</a> so that users can TAB and hit ENTER to skip to the content of your page.</p><p>Twitter Bootstrap is a popular framework for setting up styling and scaffolding for a site,. If you are using <a href="http://getbootstrap.com/">Twitter Bootstrap</a>, look into the <a href="http://paypal.github.io/bootstrap-accessibility-plugin/">Bootstrap accessibility plugin</a>.</p><p>Another alternative to Bootstrap, is Foundation. If you are using <a href="http://foundation.zurb.com/">Foundation</a>, look into how <a href="http://zurb.com/article/1337/foundation-now-helps-you-build-accessible">Foundation is built around accessibility</a>.</p><h3>Do your Positive, Negative, and Neutral Buttons look different?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*15sRD5YpnsR3jgXo0pYfTg.png" /><figcaption>Image from <a href="http://uxmovement.com/buttons/how-button-color-contrast-guides-users-to-action/">UX Movement</a>.</figcaption></figure><p>Have your Positive Action buttons and your Neutral and Negative Action buttons look distinctly different. Notice that in the above example, not only are the colors different, but one is bordered and ther other is filled in, making it <a href="http://idmontie.github.io/WebApplicationsBlog/accessibility">accessible</a> to those with color-blindness.</p><h3>&lt;i&gt;, &lt;em&gt;, &lt;b&gt; and &lt;strong&gt; tags</h3><p>Know when to use each of these tags!</p><ul><li>&lt;i&gt; – <em>“alternate voice”</em>; transliterated foreign words, technical terms, and typographically italicized text.</li><li>&lt;em&gt; – <em>“stress emphasis”</em>; something you’d pronounce differently.</li><li>&lt;b&gt; – <em>“stylistically offset”</em>; keywords and typographically emboldened text.</li><li>&lt;strong&gt; – <em>“strong importance”</em>;</li></ul><p>See <a href="http://html5doctor.com/i-b-em-strong-element/">this HTML5 Doctor post</a> for more information.</p><p>If you keep all these tips in mind, your website will be a little more friendly and semantic for users with disabilities!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8249f6913c25" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>