<?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 John Apostolidis on Medium]]></title>
        <description><![CDATA[Stories by John Apostolidis on Medium]]></description>
        <link>https://medium.com/@yiannisapostolidis?source=rss-1946532216a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*LXZiIOpIGnZ0Hx53.jpg</url>
            <title>Stories by John Apostolidis on Medium</title>
            <link>https://medium.com/@yiannisapostolidis?source=rss-1946532216a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:16:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yiannisapostolidis/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[Create an RSS feed application with embedded article content]]></title>
            <link>https://medium.com/@yiannisapostolidis/create-an-rss-feed-application-with-embedded-article-content-1a579a3f2c69?source=rss-1946532216a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a579a3f2c69</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[application-development]]></category>
            <category><![CDATA[rss]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[John Apostolidis]]></dc:creator>
            <pubDate>Sun, 31 May 2020 18:37:45 GMT</pubDate>
            <atom:updated>2020-05-31T18:41:45.020Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this article we will describe the current state of the RSS clients, we will provide our solution and we will discuss the deeper technical details.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*jReU8_L5jBBCV0LVjZlo-w.jpeg" /><figcaption>RSS pipeline</figcaption></figure><p>Website <a href="https://www.wiregoose.com/">https://wiregoose.com</a></p><p><a href="https://en.wikipedia.org/wiki/RSS">RSS</a> seems an old technology that is heavily used by a lot of people. There are many RSS clients that contain pre-registered sources or allow the user to add his own links. Even with the large variety of solutions in the market, there are some aspects that have not covered yet.</p><p>When the user clicks an article, the RSS clients redirect the user to the article source. Then, the user lands on the origin page and usually waits a couple of seconds in order to load the contents, close the popup adds, accept the page&#39;s policy, and deny the notifications prompt. Less popular languages like greek have not dedicated RSS clients. Latin-oriented clients are trying to cover the gap.</p><p>What we were really trying to do is to create a very fast RSS application that provides a simple, minimalistic, and modern experience. An application that provides all the news in almost real-time. Divided into categories and sources, so it is easy to choose exactly the type of news that he wants to read. Αssist the user with an integrated article reader so the user will not have to wait for the original article to load. All of this implemented in a cut edge, mobile-first application.</p><p>So, let’s mention the required ingredients.</p><ul><li>Backend app</li><li>RSS crawler</li><li>Article extractor</li><li>SSR (server-side rendering) for the social media SEO</li><li>Image proxy</li><li>Frontend app</li><li>Services orchestrator</li></ul><p>The rule separation of the services is clear from the beginning. There are some initial observations regarding the implementation. Our needs are different from a classic backend-frontend app. We had to create our own infrastructure and avoid using a server-as-service solution. Some of the main reasons are:</p><ol><li>The <a href="https://en.wikipedia.org/wiki/RSS">RSS</a> crawler consists of an infinite-loop functionality that never stops fetching and processing external resources. Hence, if we deploy it in a <a href="https://en.wikipedia.org/wiki/Software_as_a_service">SAS</a> infrastructure the cost will be enormous.</li><li>The RSS crawler is completely different from the backend app. If we put it in the same monolithic application, it will cause performance problems in the entire infrastructure.</li></ol><p>Considering the above-mentioned, we decided to create a stack with 4 microservices, a frontend app, and an orchestrator.</p><h4>RSS crawler</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*PTHH5lM94VwWhFQapE2MrQ.jpeg" /></figure><p>This is the application that does the core job of the RSS fetching. It iterates the list of the RSS registrations. For each registration, it fetches the RSS link, extracts the necessary fields, and applies some transformations. The process is an infinite loop and there are many seconds delay between each fetch, so we will not be banned from the sources. We also track and log the acceptance and parse rate for every registration.</p><h4>Article extractor</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*6IBfh8qgVH1ulLRxWeYdQg.jpeg" /></figure><p>This is a functionality that we don’t see usually in the industry. Our target is to extract only the useful article content from the page, without the adv/sidebars/popups. The useful content that we define in an article page is the combination of text, heading, images, and videos. After a lot of research, we concluded that this functionality is already happening in modern browsers. The name of the functionality is the article “readability”. It already exists as an extension in Chrome and Firefox inside the browser execution context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*hjOlbbTo3Aq9UZ3WRwe--A.jpeg" /><figcaption>Useful Content</figcaption></figure><ul><li><a href="https://chrome.google.com/webstore/detail/reader-view/ecabifbgmdmgdllomnfinbmaellmclnh">Chrome Reader View</a></li><li><a href="https://chrome.google.com/webstore/detail/just-read/dgmanlpmmkibanfdgjocnabmcaclkmod">Chrome Just Read</a></li><li><a href="https://addons.mozilla.org/el/firefox/addon/reader-view/">Firefox Reader View</a></li></ul><p>What we had to do is to fetch the article in the server, add it to a server-dom (<a href="https://www.npmjs.com/package/jsdom">jsdom</a>) implementation and use the <a href="https://github.com/mozilla/readability">readability library</a> in order to extract the useful segments of the page. After some experiments the result was amazing. The success rate was quite acceptable, even the fact that the language of the page was non-Latin. Sometimes there are some false positives but the result is not annoying. There are 2 observations in this process:</p><ol><li>This is a heavy process, so we had to add a caching mechanism.</li><li>The success of the process is not guaranteed. Many steps can lead to wrong results, from the download step of the article page to the article content extraction. So, a nice error page should be implemented in the frontend.</li><li>The feeds are too many, we cannot do this procedure for every feed, so we do it on demand.</li></ol><h4>Image proxy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KOT9cPC7JrRDZD1VEttPxQ.jpeg" /><figcaption>Image Proxy Architecture</figcaption></figure><p>Images are a basic requirement for this kind of application. It is a fundamental feature for both of the article preview and content. All the images of the sources exist in their own domain. We cannot download all the assets of every article in the crawler service because they are too many. So, once again, we have to do it on the fly. The steps here are:</p><ol><li>The frontend app requires the source image from our image proxy service with optionally width and height dimensions.</li><li>Our service downloads the image in a temporary folder and applies the required transformations in the size and dimensions.</li><li>Caches the image using an in-memory <a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)">LRU policy</a>.</li><li>Sends the image to the frontend application</li></ol><h4>SSR</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*as8C3K07B5V5Dd4O0MXRTw.jpeg" /><figcaption>SSR Architecture</figcaption></figure><p>A must-to-have functionality for every modern application. Unfortunately, we cannot live without it. It is the only way to make a <a href="https://en.wikipedia.org/wiki/Single-page_application">SPA</a> reachable by the bots of Google and the preview mechanisms of Twitter, <a href="https://developers.facebook.com/tools/debug/">Facebook</a>, etc. We did a lot of research here on what we can do in order to make this functionality as lightweight as possible. All the ready for production solutions were not working as expected.</p><ol><li>The <a href="https://reactjs.org/docs/react-dom-server.html">renderToString</a> method only renders the initial state. There are some alternatives to yield the suspended loaders, but it needs too much customization.</li><li>The third-party libraries that use async renderToString methods are not working as expected. They either don’t update property the state or does not support some native browser functions.</li></ol><p>We ended up that the best solution is to use a <a href="https://en.wikipedia.org/wiki/Headless_browser">headless browser</a>, evaluate the page in the headless context, and send back the rendered HTML. <a href="https://github.com/puppeteer/puppeteer">Puppeteer</a> is by far the best solution for this scenario because it uses the real chrome engine under the hood. The steps for the procedure are:</p><ol><li>Use the <a href="https://github.com/nfl/react-helmet">react helmet</a> in the frontend in order to inject all the SEO tags on every page. Title, image, description, etc.</li><li>Start-up a puppeteer page instance in the SSR service.</li><li>Open the URL in the page and wait until the network is idle. Then, we assume that the page is read for the snapshot.</li><li>Send back the inner HTML of the page and cache it.</li></ol><h4>Backend app</h4><p>A straightforward implementation that provides all the necessary information to the front-end. Nothing tricky here.</p><h4>Database</h4><p>We are using <a href="https://www.mongodb.com/">MongoDB</a> as the primary database for our needs. The entire application is processing sequences and streams of data. The RSS feeds are stored sequentially, and the timeline of the frontend app depicts the same structure as it is stored in the database. A document-oriented database like MongoDB fits well in our needs.</p><h4>Frontend app</h4><p>There was a lot of work here in order to make it very fast, progressively, and easy to use. This section is an iteration that never stops, we can always find something to improve. We will mention the technologies:</p><ul><li><a href="https://reactjs.org/docs/create-a-new-react-app.html">Create react app</a> for scaffolding</li><li><a href="https://v2.grommet.io/">Grommet js</a>, UI library</li><li>React context, state management</li><li><a href="https://github.com/bvaughn/react-virtualized">React-Virtualized</a>, (infinite scroll, window scroll)</li><li><a href="https://github.com/nfl/react-helmet">React-helmet</a>, SEO tags injection</li></ul><h4>The services orchestrator</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*WZWaumX_UhZwaYWixQrasA.jpeg" /><figcaption>Application Architecture</figcaption></figure><p>There are many segments of the services that we did not explain yet. How all of these services communicate with each other and how they are deployed in production. We used <a href="https://www.nginx.com/">Nginx</a> for our services orchestrator. All the services are NodeJS applications. The applications that are working as public servers are using the <a href="https://expressjs.com/">ExpressJS</a> framework. Nginx does the following processes:</p><ul><li>The public services are protected by reverse proxy.</li><li>The image proxy service lives under the img.wiregoose.com domain.</li><li>The backend services live under the api.wiregoose.com domain.</li><li>The frontend app is a static bundle of files. It redirects all the requests to the index.html of the static files if there is not any matching file in the <em>wiregoose.com/*</em></li><li>Nginx checks the request agent and decides if it is a crawler/bot or a normal request. The normal request is served from the static files. The bots are redirected to the SSR service. This technique is quite similar to the <a href="https://gist.github.com/thoop/8165802">prerender.io Nginx configuration</a>.</li><li>The domains are certified by the <a href="https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/">let’s decrypt plugin</a> that is dedicated to the Nginx.</li></ul><p>We have set up the configuration so the NodeJS is handling the core job and the Nginx is handling all the trivial parts of the services communication. We also wrap the NodeJS instances under the <a href="https://pm2.io/">PM2</a> process manager. That way we keep the load of the NodeJS instances as thin as possible and prevent downtimes. All the services are launched in production using a docker-compose configuration.</p><p>Website <a href="https://www.wiregoose.com/">https://www.wiregoose.com/</a><br>Github <a href="https://github.com/apostolidhs/wiregoose2">https://github.com/apostolidhs/wiregoose2</a><br>Facebook page <a href="https://www.facebook.com/wiregoose/">https://www.facebook.com/wiregoose/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCjoHJAsfdkjkt3ivrDOUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*pY1-6FST_PDPfQu6ZjhvXQ.png" /><figcaption>Desktop/Mobile view</figcaption></figure><h4>References</h4><ul><li>RSS technology, <a href="https://en.wikipedia.org/wiki/RSS">https://en.wikipedia.org/wiki/RSS</a></li><li>SAS, <a href="https://en.wikipedia.org/wiki/Software_as_a_service">https://en.wikipedia.org/wiki/Software_as_a_service</a></li><li>Web Crawler, <a href="https://en.wikipedia.org/wiki/Web_crawler">https://en.wikipedia.org/wiki/Web_crawler</a></li><li>Firefox Reader, <a href="https://addons.mozilla.org/el/firefox/addon/reader-view/">https://addons.mozilla.org/el/firefox/addon/reader-view/</a></li><li>Chrome Just Read, <a href="https://chrome.google.com/webstore/detail/just-read/dgmanlpmmkibanfdgjocnabmcaclkmod">https://chrome.google.com/webstore/detail/just-read/dgmanlpmmkibanfdgjocnabmcaclkmod</a></li><li>Chrome Reader View, <a href="https://chrome.google.com/webstore/detail/reader-view/ecabifbgmdmgdllomnfinbmaellmclnh">https://chrome.google.com/webstore/detail/reader-view/ecabifbgmdmgdllomnfinbmaellmclnh</a></li><li>Virtual dom implementation in NodeJS, <a href="https://www.npmjs.com/package/jsdom">https://www.npmjs.com/package/jsdom</a></li><li>Mozilla Readability library, <a href="https://github.com/mozilla/readability">https://github.com/mozilla/readability</a></li><li>LRU Cache Policy, <a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)">https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)</a></li><li>SPA, <a href="https://en.wikipedia.org/wiki/Single-page_application">https://en.wikipedia.org/wiki/Single-page_application</a></li><li>Facebook Sharing Debugging Tool, <a href="https://developers.facebook.com/tools/debug/">https://developers.facebook.com/tools/debug/</a></li><li>React renderToString method, <a href="https://reactjs.org/docs/react-dom-server.html">https://reactjs.org/docs/react-dom-server.html</a></li><li>Headless browser, <a href="https://en.wikipedia.org/wiki/Headless_browser">https://en.wikipedia.org/wiki/Headless_browser</a></li><li>PuppeteerBrowser, <a href="https://github.com/puppeteer/puppeteer">https://github.com/puppeteer/puppeteer</a></li><li>React Hamlet for head tags injection, <a href="https://github.com/nfl/react-helmet">https://github.com/nfl/react-helmet</a></li><li>Grommet UI Library, <a href="https://v2.grommet.io/">https://v2.grommet.io/</a></li><li>Virtualized list, <a href="https://github.com/bvaughn/react-virtualized">https://github.com/bvaughn/react-virtualized</a></li><li>Nginx lets encrypt, <a href="https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/">https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/</a></li><li>PM2 process manager, <a href="https://pm2.io/">https://pm2.io/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a579a3f2c69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bulk Operations in a Restful API]]></title>
            <link>https://codeburst.io/bulk-operations-in-a-restful-api-67a0db237e1b?source=rss-1946532216a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/67a0db237e1b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[John Apostolidis]]></dc:creator>
            <pubDate>Tue, 04 Jul 2017 11:28:36 GMT</pubDate>
            <atom:updated>2017-07-05T11:39:35.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*-mqZpcxR4VCoR5UbRfGXcQ.png" /><figcaption>Gmail Bulk Action</figcaption></figure><h3>Introduction</h3><h3>Restful API</h3><p>This paper will not get involved on how to create a robust restful api. We focus on how to apply bulk operations on a restful api. We based on the straightforward approach about the restful api. We assume that if we want to solely operate on a collection, we will use the following routes:</p><ul><li>/user, POST, Create a user</li><li>/user GET, Get, all users</li><li>/user/:id, GET, Get the user with the specific <em>id</em></li><li>/user/:id, PATCH/PUT, Update the user with the specific <em>id</em></li><li>/user/:id DELETE Delete the user with the specific <em>id</em></li></ul><p>For instance, if we want to update a user, we can PATCH a request on /user/:id, providing the fields that we want to update as JSON object in the body of the request.</p><pre>PATCH /user/:id <br>Content-Type: application/json <br>{ <br>  &quot;firstName&quot;: &quot;my first name&quot; <br>}</pre><h3>Bulk Operation</h3><p>The discussion under a bulk operation comes when we have to apply the same functionality in more than one entries.</p><p>A trivial approach is to send one request for each entry. Obviously, this is a waste of resources and it is too slow. What we are searching for, is a way to use one request for a bundle of entries.</p><p>There are many articles on how to organize a bulk operation. We will approach the bulk architecture from different aspects.</p><p><strong>Difference with batch operation</strong></p><p>We do not want to confuse with the batch operations. A batch operation is a bundle of different actions and routes in one request. Those routes does not have any coherence. Potentially, each route could be completely different from the others. A bulk request is usually <em>a bundle of entries that we want to apply the same functionality in one request</em>.</p><h3>Examples From the real world</h3><p><strong>Facebook</strong></p><p><a href="https://developers.facebook.com/docs/graph-api/making-multiple-requests">graph-api</a></p><p>Facebook does not support bulk operations. It only uses batch operations.</p><pre>curl \ <br>  -F ‘access_token=…’ \ <br>  -F ‘batch=[{“method”:”GET”, “relative_url”:”me”},{“method”:”GET”, “relative_url”:”me/friends?limit=50”}]’ \ <br> <a href="https://graph.facebook.com/">https://graph.facebook.com</a></pre><p><strong>Jira</strong></p><p><a href="https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-createIssues">create-issues</a></p><ul><li>Route: Uses additional links, /rest/api/2/issue/bulk.</li><li>Request parameters: The request provides an array of entries.</li></ul><pre>{ <br>  &quot;issueUpdates&quot;: [<br>    { <br>      &quot;update&quot;: { <br>        &quot;worklog&quot;: ... <br>      } <br>    } <br>  ] <br>}</pre><p><strong>Zendesk</strong></p><p><a href="https://developer.zendesk.com/blog/from-100-requests-to-1-introducing-our-new-bulk-and-batch-apis">new bulk api</a></p><ul><li>Route: Comma separated ids on url.</li><li>Request parameters: One entry as body parameter that will be applied to the ids.</li></ul><pre>curl https://{subdomain}.zendesk.com/api/v2/organizations/update_many.json?external_ids=external_1,external_2 \ <br>-H &quot;Content-Type: application/json&quot; -X PUT\ <br>-v -u {email_address}:{password} \<br>-d &#39;{&quot;organization&quot;: {&quot;notes&quot;: &quot;Something interesting&quot;\}\}&#39;</pre><p><strong>Gmail</strong></p><p>Mark as unread</p><ul><li>Route: Uses a special parameter to set the bulk action.</li><li>Request parameters: Ids in the body of request as form data.</li></ul><pre>https://mail.google.com/mail/u/0/?ui=2&amp;ik=3g4f2h34j23&amp;rid=mail%3Amau.4ef1.1.0&amp;at=sdfgasfsdvfsdvfasd&amp;view=up&amp;act=ur&amp;_reqid=2344&amp;pcd=1&amp;mb=0&amp;rt=j&amp;search=inbox </pre><pre>form data: <br>t:3452524524534 <br>t:3453453453454</pre><p><strong>Workable</strong></p><p><a href="https://encodegroup.workable.com/backend/api/activities/bulk">all bulk activities</a></p><ul><li>Route: A single route that commit all the bulk actions.</li><li>Request parameters: The bulk actions are described by a JSON object.</li></ul><pre>https://encodegroup.workable.com/backend/api/activities/bulk </pre><pre>{ <br>  &quot;bulk_action&quot;: &quot;read&quot;, <br>  &quot;activity_ids&quot;: [ <br>    41928042, <br>    41886730 <br>  ], <br>  &quot;include_archived&quot;: true <br>}</pre><p><strong>Gitlab</strong></p><p><a href="https://gitlab.encode.local/enorasys-sa/enorasys-sa-webui/issues/bulk_update">issues bulk update</a></p><ul><li>Route: Additional route for the bulk operation.</li><li>Request parameters: Ids are provided via form data.</li></ul><pre>https://gitlab.encode.local/enorasys-sa/enorasys-sa-webui/issues/bulk_update </pre><pre>update[issuable_ids]:2330,2327 <br>update[add_label_ids][]:41</pre><h3>Flexibility</h3><p>There are two approaches regarding the bulk flexibility.</p><h3>Strict</h3><p>Apply only one action on many ids.<br> The request payload decreases because we send only the fields to be updated and the ids to be applied.</p><h3>Flexible</h3><p>Apply different actions on many ids.<br> The request payload increases because we send an array of fields to be updated for each id.</p><h3>Reuse</h3><p>Either reuse the same route for a single operation (with different parameters) or create a completely different route.</p><h3>Same route</h3><p>Reuse the same route that we use for the single operation and separate the singularity with additional parameters. Those parameters could be:</p><ul><li>Array of the objects on the body of the request (For bulk operation), instant of one object (For single operation)</li><li>Parameters on the request header. For instance, use one header argument to define the bulk or the singularity.</li></ul><h3>Different route</h3><p>Create one additional route for each single route in order to apply the bulk operation.</p><h3>Proposal</h3><p>My proposal is to reuse the same routes for the bulk operations. The only difference in comparison with a single operation is that the url for the route will not contain the /:idsuffix. The /:id is useless because the action will be applied on many requests.</p><p>The requests will be marked with the X-Action: bulk header. The header provides an additional intuition that the request addresses a bulk operation.</p><p>The body of the request will contain an array of objects, in JSON format. Each object in one entry, in the same format with a single action. The entry will contain:</p><ul><li>Create, POST, The fields of the entry to be created</li><li>Update, PATCH, The updated fields for each entry, including the id</li><li>Delete, DELETE, Only the id of the entry</li></ul><h3>Bulk Update Example</h3><p>Apply update on many entries, selected by id</p><pre>PATCH /user<br>X-Action: bulk<br>[<br>    {<br>        &quot;firstName&quot;: &quot;my first name (1)&quot;,<br>        &quot;Id&quot;: &quot;id1&quot;<br>    },<br>    {<br>        &quot;firstName&quot;: &quot;my first name (2)&quot;,<br>        &quot;Id&quot;: &quot;id2&quot;<br>    }    <br>]</pre><p>Apply update on a group of entries</p><pre>PATCH /user?optionallyFilter1=value1<br>X-Action: bulk<br>{<br>    &quot;firstName&quot;: &quot;my first name (1)&quot;<br>}</pre><h3>References</h3><ul><li>Implementing bulk updates within restful services, <a href="http://restlet.com/blog/2015/05/18/implementing-bulk-updates-within-restful-services/">http://restlet.com/blog/2015/05/18/implementing-bulk-updates-within-restful-services/</a></li><li>Facebook multiple-requests, <a href="https://developers.facebook.com/docs/graph-api/making-multiple-requests)">https://developers.facebook.com/docs/graph-api/making-multiple-requests)</a></li><li>Foursquare multi api, <a href="https://developer.foursquare.com/docs/multi/multi">https://developer.foursquare.com/docs/multi/multi</a></li><li>Zendesk bulk api, <a href="https://developer.zendesk.com/blog/from-100-requests-to-1-introducing-our-new-bulk-and-batch-apis">https://developer.zendesk.com/blog/from-100-requests-to-1-introducing-our-new-bulk-and-batch-apis</a></li><li>Jira api section, <a href="https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-createIssues">https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-createIssues</a></li><li>Gmail, <a href="https://mail.google.com/">https://mail.google.com</a></li><li>Workable api, <a href="https://workable.readme.io/docs">https://workable.readme.io/docs</a></li><li>Gitlab api, <a href="https://docs.gitlab.com/ee/api/README.html">https://docs.gitlab.com/ee/api/README.html</a></li><li>Taptica api, <a href="http://wiki.taptica.com/index.php/Bulk_API">http://wiki.taptica.com/index.php/Bulk_API</a></li><li>Stackoverflow discussions: <a href="http://stackoverflow.com/questions/28638071/how-to-update-a-rest-resource-collection">http://stackoverflow.com/questions/28638071/how-to-update-a-rest-resource-collection</a><br><a href="http://stackoverflow.com/a/33768160">http://stackoverflow.com/a/33768160</a><br><a href="http://stackoverflow.com/a/1630897">http://stackoverflow.com/a/1630897</a></li></ul><p><em>Originally published at </em><a href="http://apostolidis.me/bulk-operations/"><em>apostolidis.me</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67a0db237e1b" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/bulk-operations-in-a-restful-api-67a0db237e1b">Bulk Operations in a Restful API</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Kind of Alerts/Notifications Should I Use?]]></title>
            <link>https://medium.com/@yiannisapostolidis/what-kind-of-alerts-notifications-should-i-use-94aa09a523f0?source=rss-1946532216a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/94aa09a523f0</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[John Apostolidis]]></dc:creator>
            <pubDate>Thu, 29 Jun 2017 11:30:22 GMT</pubDate>
            <atom:updated>2017-07-04T11:34:12.540Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*buTq91NKHkr6EL1zoBlBXw.png" /></figure><p>Notifications and Alerts are essential parts of a concrete application. All the applications should inform the user about an unexpected error or provide some feedback about the result of an action.</p><blockquote><em>Every action should have a corresponding reaction.</em></blockquote><p>The problem is that in a modern web environment there are endless ways to create a notification. There are unlimited collections of alert and notification libraries. We will try to distinguish our requirements and pick the right tool for our needs.</p><blockquote><em>Users want to stay informed while using your web or mobile applications. Always use the opportunity to show your users well-formed and clear notifications. If needed (e.g. error message notifications), add extra information about the specific nature of a problem and a way to solve it. Try to keep your notifications simple and straight to the point. Your users will love knowing exactly what is going on and being able to get themselves out of a tight spot.</em></blockquote><p><a href="https://infinum.co/the-capsized-eight/articles/ux-quick-tip-the-proper-way-of-handling-notifications">read more</a></p><h3>What type of notifications do we focus on?</h3><p>During our daily interaction with our devices we meet notifications everywhere. Emails and SMS are an easy way to have a notification. A popover window on our running application is also a notification.</p><p>As we can see, there is a huge variety of notification types. We separate in 2 categories, the <em>internal</em> and <em>external</em>. Internal notifications are created directly during our interaction with the application. External notifications are usually indirect. We meet in emails, sms, or a messaging section in our application. In this article we focus on the <strong>internal</strong> notifications. Aiming that the other type of notifications are more straightforward.</p><h3>Why should we create a notification?</h3><p>It is very helpful to identify when and why we have to create a notification. In a modern application there are a lot of processes that take place during the interaction of the user. The user applies some actions on the UI. The actions usually triggers reactions in the entire stack of the application. Those reactions can cause a variety of failures. (server error, connection issues, etc). When the user performs a mutable operation, the application should inform him about the result. The result could be accomplishment successful or unsuccessful. This is a meaningful usage of a notification.</p><p>In the other hand, it is very easy to overuse the notifications. When we pipe it with any logging process. When we use it for errors that can automatic resolved. The verbosity can decrease the usability of an application.</p><h3>Notification Scope</h3><p>A critical design decision regards the proper placement of the notification. This decision differentiate according to the running environment. Each OS and Platform creates different notifications. We will try to take an universal choice, in order to cover as many requirements as possible. We will categorize the notification placement in ascending scope.</p><h3>Local Notification Scope</h3><p>We find local notification scopes is cases like a form, that we notify the user about the existence of his username. This notification can placed on top of the username input field. Another example is when we apply an action by clicking a button, we could change the text of the button, or append some text near the button, in order to inform the user about the result.</p><p>Most of the time, we use local notification scopes in unique reactions. I cases that there is no effect on the entire application.</p><p><strong>Positives</strong><br>It is quite aesthetic and user friendly as the user receive instant feedback for his actions. Aiming that when the user clicks a button, he receive feedback close to the button area.</p><p><strong>Negatives</strong><br>It needs special treatment for each place that is going to run. It creates a lot of code, and special cases that are difficult to maintain. Additionally, it adds a respectable amount of time on each design iteration and develop process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*uN8en9Qk-Ox9WXGthpVRAA.png" /><figcaption>Local Notification</figcaption></figure><h3>Section Notification Scope</h3><p>We can find this type of notifications on the top of an entire view section. For instance, we can place the notification of a successfully submitted form, on top of the form.</p><p><strong>Positives</strong><br>Notifies the user that an action has accomplished on a specific segment of the page. It can also adjust the notification view for more specific purposes.</p><p><strong>Negatives</strong><br>Programmer should implement each segments of the page that contain the notifications. This process adds an significant amount of code and generates additionally ui decisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*iP14pI-CedJPzS7LsLtrbw.png" /><figcaption>Section Notification Scope</figcaption></figure><h3>Global Notification Scope</h3><p>Usually, global notifications created in a fixed place on the application layout. They can be triggered by any component of the application. Global notifications are very easy to use. Whatever is happening in your system,<br> you can call the global notification module and launch a notification. We meet this notifications as</p><ul><li>Popup windows</li><li>Alerts</li><li>Modals</li><li>After header</li></ul><p><strong>Positives</strong><br>Very easy to use.</p><p><strong>Negatives</strong><br>Can easily overused and verbose the user with an unnecessary stack notifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CEmQfcb1SiHwmnJz2nOftA.png" /><figcaption>Global Notification Scope</figcaption></figure><h3>Message Options</h3><h4>Colors Scheme</h4><p>As a convention, we usually use the same names that bootstrap uses for the notification types.</p><p>Type Color primary (or default) page’s default color scheme success Green info Blue warning Orange danger Red</p><p>There is a discussion under the proper usage of the red color. The red color is for danger. Usually, we meet it in critical errors that effect the application stability. This kind of errors are server errors or connection timeouts. Red color takes all the user’s notice. It makes him feel unconformable. Warning color scheme is an elegant alternative. Even the fact that it provides the feeling that something is going wrong, it does not scare the user.</p><blockquote><em>Red is the most common color used to highlight error fields. It’s effective in making them visible, but it can also overstimulate users and raise their pulse rate, making them feel like they’ve seriously screwed up on the form. Red is also associated with danger, which is not what you want users to feel when they make a mistake.</em></blockquote><p><a href="http://uxmovement.com/forms/how-to-make-your-form-error-messages-more-reassuring/">read more</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*84JwPENmaaw84UOqiJD5bw.png" /><figcaption>Gmail uses warning color for major errors</figcaption></figure><h4>Notification Duration (lifecycle)</h4><p>The notification lifecycle has 3 fundamental states.</p><p>The lifecycle of a message can vary on duration and way of removal. It can be dismissed after:</p><ul><li>A time period</li><li>By another notification</li><li>By user</li><li>Page change</li></ul><p>Usually, notifications that are dismissed after a time period, are used to notify the user for a non-important action. It is friendly for the user because he knows that it is not something major and it will disappear after some period.</p><p>If only one notification allowed to be displayed in the application, then it is a <em>singleton notification</em>. Singleton notifications are unique solutions in some systems. For instance, if the notifications are based on modals, then only one modal can be shown on the entire application.</p><p>On global scope, <em>multiple notifications</em> are more functional. Multiple notifications have the ability to show more than one notification in a time frame. It prevents the application from some minor bugs. For instance, if 2 errors occurred simultaneously, then the user will be informed for both of them. As a result, there will be any notification overlapping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZ0B3par89H5E1nUrO1vgA.png" /><figcaption>Multiple Notifications</figcaption></figure><h4>Position and Smaller Screens</h4><p>The position of notifications is not a straightforward issue. In the web, we meet many different combinations. The most common are:</p><p><strong>Small Popup Windows</strong><br>Are placed in the edge of the screen, usually with small dimensions. Most of the times, in the right side.</p><p><strong>Modals</strong><br>Covers the entire screen. Popover a window in aligned in the center of the screen.</p><p><strong>Page Segment</strong><br>It is inside the body of the application. Usually, we meet it after the header of the page, and it covers the entire width. There are 2 approaches for this implementation. First, the notifications will be sawn in a sticky form, so the user will be able to see it independent to his current scroll position. Second, non sticky form. Apparently, a mechanism that notifies the user about the notification should be implemented. The auto-scroll on the notification section is useful option.</p><p>In smaller screens or mobile environments, small popup windows are user-unfriendly. It is not easy see them and it goes against the mobile design principles. Modals are acceptable, but it is a singleton approach. Sticky-header notifications that are placed after the header, with auto-scroll functionality is the save solution for many reasons.</p><ul><li>Multiple notifications can be launched.</li><li>The message is very clear and works fine in small screen environments.</li><li>User is able to browse the application while the notifications are shown.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*hUUeaMRyHixPh4OOhhFC6w.jpeg" /><figcaption>Alerts Notifications</figcaption></figure><h3>Browser API Notifications</h3><p>Apart from the main implementation of the notifications, there are a lot of tools in the browser API. Assisting to achieve an integrated notification workflow.</p><p><strong>Page Title</strong><br>&lt;title&gt;Your app (1)&lt;/title&gt;<br>Special text, that indicates the notification, can added in the document’s title.</p><p>titled notification</p><p><strong>Browser Theme Color</strong><br>&lt;meta name=&quot;theme-color&quot; content=&quot;#db5945&quot;&gt;<br>The browser’s theme color can changed due to a notification. The color can also combined with the message’s type color scheme.</p><p><strong>Notification</strong><br>new Notification(&#39;Hi there!&#39;)<br><em>Notifications</em> is a relative new feature in the browser API. It does exactly our job, but in this article we focus on the internal notifications. This api is owns on the external notification tools.</p><p><strong>window.alert</strong><br>window.alert(&#39;Hi there!&#39;);<br>The most easy way to notify the user. It can be categorize on the singleton notification approaches. Even the fact that it is exactly the tool that we need, the current browser implementations are not so elegant. A poor popup window covers the entire screen, without any possibility to style it. In cases that we would like to use this API, there are many wrapping libraries over the window.alert(). It is heavily suggested to gain the benefits of those libraries that support:</p><ul><li>Html content</li><li>Promises implementation. So the current running thread will not be blocked.</li><li>Theme customization</li></ul><p><strong>Vibration API</strong><br>A modern API, dedicated mostly for mobile devices. It allows you use the vibration hardware. The usage of this kind of tools is forbidden, because it agitates the user, in a manner worst than the <a href="http://apostolidis.me/web-application-alerts-and-notifications/#colors-scheme">red color</a>.</p><h3>References</h3><ul><li><a href="https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android">Browser color theme</a></li><li><a href="https://developer.mozilla.org/en/docs/Web/API/notification">Browser Notification API</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API">Browser Vibration API</a></li><li><a href="https://infinum.co/the-capsized-eight/articles/ux-quick-tip-the-proper-way-of-handling-notifications">Handling Notifications</a></li><li><a href="http://uxmovement.com/forms/how-to-make-your-form-error-messages-more-reassuring/">Form Error Messages</a></li></ul><p><em>Originally published at </em><a href="http://apostolidis.me/web-application-alerts-and-notifications/"><em>apostolidis.me</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94aa09a523f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[KlarkJS, Dependency Injection on NodeJS]]></title>
            <link>https://medium.com/@yiannisapostolidis/klarkjs-dependency-injection-on-nodejs-542680cb8784?source=rss-1946532216a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/542680cb8784</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[John Apostolidis]]></dc:creator>
            <pubDate>Tue, 20 Jun 2017 09:51:05 GMT</pubDate>
            <atom:updated>2017-07-04T11:36:07.174Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*KYcFzMGpOsXOQFy1-YOM0g.png" /><figcaption>KlarkJS</figcaption></figure><p>A module loader (plugin system) based on dependency injection for NodeJS applications.</p><p>Forget the</p><ul><li>relative paths</li><li><em>require()</em> boilerplate code</li><li>large-scale project entropy</li><li>unorganized NodeJS structure</li></ul><p><strong>KlarkJS</strong> is a novel system for NodeJS module dependency management that handles the creation of the modules, resolves their internal and external dependencies, and provides them to other modules.</p><p>It works with dependency injection based on function parameters in order to define the components dependencies. This architecture decreases dramatically the boiler plate code of an ordinary NodeJS application.</p><p>We inspired from 2 main tools:</p><ul><li>Angular 1 dependency injection</li><li>Architect js package management</li></ul><blockquote><em>npm install –save klark-js</em></blockquote><h3>Main Idea</h3><p>Potentially, all the NodeJS modules are isolated plugins. Each plugin depends on other plugin. The other plugins could either be external (from node_modules folder) or internal (another plugin in our source code tree). Thus, we can simply define a plugin providing the plugin name and the dependencies. The following is a typical KlarkJS module declaration:</p><pre>KlarkModule(<br>  module, <br>  ‘myModuleName1’,  <br>  function($nodeModule1, myModuleName2) {</pre><pre>  return {<br>    log: function() { <br>      console.log(‘Hello from module myModuleName1’);<br>    };<br>  }<br>});</pre><p>KlarkModule is a global function provided by KlarkJS in order to register a module. The module registration requires 3 parameters.</p><ol><li>The NodeJS native <a href="https://nodejs.org/api/modules.html#modules_the_module_object">module</a></li><li>The name of the module</li><li>The module’s <a href="http://apostolidis.me/klarkjs/#klarkjs-controller-function">controller</a></li></ol><p>The dependencies of the module are defined by the controller parameter names. The names of the modules are always camel case and the external modules (node_modules) are always prefixed by $.</p><h3>Benefits</h3><p>On the following excerpts we depict a simple NodeJS application in pure NodeJS modules and a NodeJS application in KlarkJS. We will observe the simplicity and the minimalism that KlarkJS provides.</p><h3>Pure NodeJS implementation</h3><pre>/////////////////////<br>// ./app/app.js</pre><pre>var express = require(&#39;express&#39;);<br>var mongoose = require(&#39;mongoose&#39;);<br>var config = require(&#39;../config&#39;);<br>var db = mongoose.connect(config.MONGODB_URL);<br>var app = express();</pre><pre>app.get(&#39;/&#39;, function(req, res){<br>  db.collection(&#39;myCollection&#39;)<br>    .find().toArray(function(err, items) {<br>      res.send(items);<br>    });<br>});</pre><pre>app.listen(config.PORT);</pre><pre>/////////////////////<br>// ./config.js</pre><pre>module.exports = {<br>  MONGODB_URL: &#39;mongodb://localhost:27017/my-db&#39;,<br>  PORT: 3000<br>};</pre><pre>/////////////////////<br>// ./index.js</pre><pre>require(&#39;./app/app.js&#39;);</pre><h3>KlarkJS implementation</h3><pre>/////////////////////<br>// /plugins/app/index.js</pre><pre>KlarkModule(module, &#39;app&#39;, function($express, $mongoose, config) {<br>  var db = $mongoose.connect(config.MONGODB_URL);<br>  var app = $express();<br>  app.get(&#39;/&#39;, function(req, res){<br>    db.collection(&#39;myCollection&#39;)<br>      .find().toArray(function(err, items) {<br>        res.send(items);<br>      });<br>  });<br>  app.listen(config.PORT);<br>});</pre><pre>/////////////////////<br>// /plugins/config/index.js</pre><pre>KlarkModule(module, &#39;config&#39;, function() {<br>  return {<br>    MONGODB_URL: &#39;mongodb://localhost:27017/my-db&#39;,<br>    PORT: 3000<br>  };<br>});</pre><pre>/////////////////////<br>// ./index.js</pre><pre>var klark = require(&#39;klark-js&#39;);<br>klark.run();</pre><h3>Comparison</h3><h4>Boilerplate Code</h4><pre>// pure NodeJS <br>var express = require(&#39;express&#39;); <br>var app = express(); ... </pre><pre>// Kark JS <br>KlarkModule(module, &#39;app&#39;, function($express) {</pre><p>In pure NodeJS version, when we want to use an external dependency, we have to repeat the dependency name 3 times.</p><ol><li>require(&#39;express&#39;);</li><li>var express</li><li>express();</li></ol><p>In KlarkJS version, we define the dependency only once, as the parameter of the function.</p><h4>Relative Path Avoidance</h4><pre>// pure NodeJS <br>var mongooseConnector = require(&#39;./db/mongoose-connector.js&#39;); </pre><pre>// Klark JS <br>KlarkModule(module, &#39;app&#39;, function(dbMongooseConnector) { ...</pre><p>In pure NodeJS version, we define the internal dependencies using the relative path from the current file location to the dependency’s file location. This pattern generates an organization issue. When our source files increases, and we want to change the location of a file, we have to track all the files that depends on the this file, and change the relative path.<br> In KlarkJS version, we refer on the file with a unique name. The location of the file inside the source tree does not effect the inclusion process.</p><h4>Code Guidance</h4><p>The module registration function KlarkModule forces the programmer to follow a standard pattern for the module definition. For instance, we always know that the dependencies of the module are defined on the controller’s parameters. In pure NodeJS the dependencies of the module can be written in many different ways.</p><h3>API</h3><pre>var klark = require(&#39;klark-js&#39;); <br>klark.run();</pre><h3>run([config])</h3><p>Starts the Klark engine. It loads the files, creates the modules dependencies, instantiates the modules.</p><ul><li>config | {Object} | (optionally)</li><li>return | Promise&lt;KlarkAPI&gt;</li></ul><h4>config</h4><ul><li>predicateFilePicker | Function -&gt; Array&lt;string&gt; | A function that returns the file path patterns that the modules are located. <a href="https://github.com/sindresorhus/globby#globbing-patterns">Read more about the file patterns</a>. Default:</li></ul><pre>predicateFilePicker: function() { <br>  return [ <br>    &#39;plugins/**/index.js&#39;, <br>    &#39;plugins/**/*.module.js&#39; <br>  ]; <br>}</pre><ul><li>globalRegistrationModuleName | String | The name of the global function that registers the KlarkJS modules. Default: KlarkModule.</li><li>base | String | The root location of the application. The predicateFilePicker search for files under the base folder. Default: process.cwd().</li><li>logLevel | String | The verbose level of KlarkJS logging. When we want to debug the module loading process, we can yield the logger on high and observe the sequence of loading. It is enumerated by: high, middle, low, off (Default).</li><li>moduleAlias | Object&lt;String, String&gt; | Alias name for the modules. If you provide an alias name for a module, you can either refer to it with the original name, or the alias name. For instance, we could take a look on the Default object:</li></ul><pre>moduleAlias: { <br>  &#39;_&#39;: &#39;$lodash&#39; <br>}</pre><p>When we define the alias name, we can either refer on external library with the name _ or $lodash</p><pre>KlarkModule(module, &#39;..&#39;, function($lodash) {</pre><p>or &#39;_&#39;</p><pre>KlarkModule(module, &#39;..&#39;, function(_) {</pre><h3>KlarkJS Controller Function</h3><pre>KlarkModule(<br>  module, <br>  &#39;myModule1&#39;, <br>  function($lodash, myModule2, $simpleNodeLogger) { <br>    return { <br>      doSomething: function() { return &#39;something&#39;; } <br>    }; <br>  }<br>);</pre><p>The KlarkJS function controller is the third argument on the KlarkModule registration. The argument names of the controller defines the dependencies.</p><h4>Internal Dependencies</h4><p>The internal dependencies should consist of camel case string. The name matches directly the name of the dependency module. In our case, if our argument variable is myModule2, the KlarkJS will search for the myModule2 module. If the myModule2 does not exists, an error will be thrown.</p><h4>External Dependencies</h4><p>We define the external dependencies with the prefix $. This way separates the external with the internal dependencies. The KlarkJS engine translate the real name from the argument and searches on the node_modules to find the package. An error will be thrown if the package does not exists. The name resolution process is the following <em>(Argument -&gt; Real Name)</em>:</p><ul><li>$lodash -&gt; lodash</li><li>_ (<em>using alias</em>) -&gt; lodash</li><li>$simpleNodeLogger -&gt; simple-node-logger</li></ul><h4>Return Value</h4><p>A KlarkJS module instance is the result of the return value of the controller function. It is somehow similar on the module.exports. For example, the instance of the KlarkJS module ‘myModule1’ will be the object:</p><pre>{ doSomething: function() { return &#39;something&#39;; } }</pre><h3>KlarkAPI</h3><h4>getModule(name)</h4><p>Searches on the internal and the external modules.</p><ul><li>name String. The name of the module.</li><li>return: the instance of the module.</li></ul><h4>getInternalModule(name)</h4><p>Searches on the internal modules.</p><ul><li>name String. The name of the module.</li><li>return: the instance of the module.</li></ul><h4>getExternalModule(name)</h4><p>Searches on the external modules.</p><ul><li>name String. The name of the module. String format: <a href="http://apostolidis.me/klarkjs/#external-dependencies">external Dependencies</a>.</li><li>return: the instance of the module.</li></ul><h4>injectInternalModuleFromMetadata(moduleName, controller)</h4><p>Creates and inserts in the internal dependency chain a new module with the name moduleName and the controller controller.</p><ul><li>moduleName String. The name of the module.</li><li>controller Function. The controller of the module.</li><li>return: Promise&lt;ModuleInstance&gt;</li></ul><h4>injectInternalModuleFromFilepath(filepath)</h4><p>Creates and inserts in the internal dependency chain a new module from the file on filepath.<br> The content of the file file should follow the KlarkJS module registration pattern.</p><ul><li>filepath String. The filepath of the file, absolute path is required. Keep in mind that config.base contains the application’s root folder.</li><li>return: Promise&lt;ModuleInstance&gt;</li></ul><h4>injectExternalModule(name)</h4><p>Creates and inserts in the external dependency chain a new module with the name moduleName.<br> This module should already exists in the external dependencies (<em>nome_modules</em>)</p><ul><li>name String. The name of the module. String format: <a href="http://apostolidis.me/klarkjs/#external-dependencies">external Dependencies</a>.</li><li>return: the instance of the module.</li></ul><h4>getApplicationDependenciesGraph()</h4><p>Returns the internal and external dependencies of the application’s modules in a graph form.</p><pre>{ <br>  innerModule1: [ { isExternal: true, name: &#39;lodash&#39; } ],<br>  innerModule2: [ { isExternal: false, name: &#39;innerModule1&#39; } ] <br>}</pre><h4>config</h4><p>Access the klark <a href="http://apostolidis.me/klarkjs/#config">configuration object</a></p><h3>Plugin System</h3><p>We can take advantage of the injection API methods and plug-in modules on the fly.<br> Those modules can either be loaded from a file in the file system, or from a pure JS function.</p><h3>Unit Tests</h3><p>From the bibliography, there are many ways to structure the unit testing process. We will Follow a common used pattern that works fine on a large-scale source code tree. Essentially, we will test each plugin separately. In order to accomplish the isolated testing, we will create at least one testing file on each plugin. For instance, our /plugins/db/mongoose-connector/ folder could consists from the following files:</p><ul><li>index.js , that contains the functionality of mongoose-connector.</li><li>index-test.js, that tests the index.js functionality.</li></ul><p>Example of index-test.js:</p><pre>var $$config;<br>var $$_;<br>var expect;</pre><pre>KlarkModule(module, &#39;configTest&#39;, function($chai, _, config) {<br>  $$config = config;<br>  $$_ = _;<br>  expect = $chai.expect;<br>});</pre><pre>describe(&#39;config&#39;, function() {<br>  it(&#39;Should configure a port&#39;, function() {<br>    expect($$_.isNumber($$config.PORT)).to.equal(true);<br>  });<br>});</pre><p>For consistency all the unit testing files should postfixed by the `-test` name.<br>If we follow the above pattern, we can easily modify the KlarkJS predicateFilePicker (see <strong>config</strong> section), to exclude the -test files when we run the application, and include the -test files when we are testing the application.</p><pre>klark.run({<br>  predicateFilePicker: function() {<br>    var files = [‘plugins/**/index.js’];<br>    if (isTesting) {<br>      files = files.concat(‘plugins/**/*-test.js’);<br>    }<br>    return files;<br>  }<br>});</pre><p><strong>KlarkJS Development</strong></p><ul><li>npm test. Runs the tests located on /test folder, creates a test coverage report on /coverage folder and send it on <a href="https://coveralls.io/">coveralls.io</a>.</li><li>npm run unit-test. Merely runs the tests.</li></ul><p><strong>References</strong></p><ul><li><a href="https://github.com/c9/architect">Architect JS</a></li><li><a href="https://docs.angularjs.org/guide/di">Angular Dependency Injection</a></li><li><a href="https://en.wikipedia.org/wiki/Dependency_injection">Wiki Dependency Injection</a></li></ul><p>Fork it on <a href="https://github.com/apostolidhs/klark-js">Github</a><br>Use it on <a href="https://www.npmjs.com/package/klark-js">Npm</a></p><p><em>Originally published at </em><a href="http://apostolidis.me/klarkjs/"><em>apostolidis.me</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=542680cb8784" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Filtering a List View]]></title>
            <link>https://medium.com/@yiannisapostolidis/filtering-a-list-view-dd437f543153?source=rss-1946532216a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd437f543153</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ux-design]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[John Apostolidis]]></dc:creator>
            <pubDate>Wed, 14 Jun 2017 16:10:10 GMT</pubDate>
            <atom:updated>2017-07-04T11:37:58.101Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*F5G4DXdepKRDB3zWddjD3Q.png" /></figure><p>The filtering functionality on a list view is a frequently but not trivial process. Many websites from different categories required this functionality in order to narrow down the results. Unfortunately, this commonly used pattern is used incorrectly from many applications. This misuse-ability effects dramatically the user experience. As a result, the user cannot find what he is looking for. We will emphasis on some useful patterns regarding the filtering process. We will define some rules (guides) that are essential for a proper filtering experience.</p><ul><li>Active filters should always be visible.</li><li>User should easily close the active filters.</li><li>Filter type should always reflect the data type.</li><li>User should always see the most common filters first.</li><li>If there are many filters, meaningful collapsion.</li><li>Layout and space between the filters.</li></ul><h3>Active filter should always be visible</h3><p>A clear way to show all the active filters is by using tags on a separate section. Those tags considered of a colon separated key — value pair. The key will be the name of the filter and the value will by the value of the filter.</p><h3>User should easily close the active filters</h3><p>Each active filter tag should contain a small closing icon that will close the active filter.</p><h3>Filter type should always reflect the data type</h3><p>Bellow we plot the most common data types with the corresponding filtering UI.</p><p><strong>Number</strong></p><p><em>input[type=”number”]</em>, If minimum and maximum values are provided, we can use a range picker. If the minimum value is quite smaller than the maximum value, we can use heuristics methodologies like logarithmic scaling or stepping</p><p><strong>Range Number</strong></p><p><em>Range picker</em></p><p><strong>String</strong></p><p><em>input[type=”number”]</em></p><p><strong>Enumeration (single selection)</strong></p><p>Dropdown with autocomplete field</p><p><strong>Enumeration (multi selection)</strong></p><p>Dropdown with autocomplete field, the selected values could shown as comma separated string</p><p><strong>Date range</strong></p><p>If the date range is usually less than 3 months, one calendar with ranges in the dates is fine. 2 date input fields in other case</p><h3>User should always see the most common filters first</h3><p>In a common application, we can search a record with many different criteria. Although, in many cases we search the specific record by providing 2–3 filters. We should run some tests with users that are going to use the application, and identify the most used filters. Those filters should always be on top of our filtering structure.</p><h3>If there are many filters, meaningful collapsion</h3><p>Considering a filtering view of 14 different filters. This is a nightmare for a user that will only use the basic filters. We could hide the non-frequently filters, providing the intuition that if you want to apply a more advanced search, you can expand the entire filter view.</p><h3>Layout and space between the filters</h3><p>This is a difficult section. We can endlessly discuss about the gaps, the layout and the structure. I don’t thing that there is a clear guide regarding this issue. My proposal, considering the user’s reaction on different combinations, is to be as minimalistic as possible.</p><h3>Layout</h3><p>The horizontal structure is more readable than the vertical structure. The vertical structure, in contrary with the horizontal, forces the user to scroll down in order to see all the applicable filters.</p><h3>Labels</h3><p>We observed that the labels on the filters increases the filter view space by 40%. This is weird, considering that the user must search on a bigger segment in order to find the appropriate filter. Our cases shown that the placeholder can play the role of the label. If we remove the labels and wisely use the placeholders, we can release a lot of useful space.</p><h3>Mockups</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hi4hEDO_qmKOx_Kn_Q6piw.png" /><figcaption><strong>Filters Blank Collapsed</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-InwlyD3jzpT1kkYtQlFwg.png" /><figcaption><strong>Filters Blank</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BZ6EfgMi1tnLI_hyilS2JA.png" /><figcaption><strong>Filters Applied Collapsed</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTK5gHuym54u2yehhwAKvw.png" /><figcaption><strong>Filters Applied</strong></figcaption></figure><p><em>Originally published at </em><a href="http://apostolidis.me/filtering-a-list-view/"><em>apostolidis.me</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd437f543153" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>