<?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 Nick Clark on Medium]]></title>
        <description><![CDATA[Stories by Nick Clark on Medium]]></description>
        <link>https://medium.com/@nclarx?source=rss-ecf4bfd92b50------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nP4P4UWrZ-vgkl5ezIwsXQ@2x.jpeg</url>
            <title>Stories by Nick Clark on Medium</title>
            <link>https://medium.com/@nclarx?source=rss-ecf4bfd92b50------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:42:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nclarx/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[Camel Case]]></title>
            <link>https://medium.com/@nclarx/camel-case-96643ebc3aa1?source=rss-ecf4bfd92b50------2</link>
            <guid isPermaLink="false">https://medium.com/p/96643ebc3aa1</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nick Clark]]></dc:creator>
            <pubDate>Sun, 10 Mar 2019 09:08:14 GMT</pubDate>
            <atom:updated>2019-03-10T09:14:53.313Z</atom:updated>
            <content:encoded><![CDATA[<p><em>TL;DR: people who write code to teach others should annotate it.</em></p><p>When learning coding a junior developer sometimes finds it difficult to understand a single line of code, let alone provide a reason why a whole chunk of 10 lines of code is there and why it is the best way to do something.</p><p>Often learning resources for coding don’t give line-by-line explanations and the reason why it is the best way to do something — <a href="https://stackoverflow.com/">Stack Overflow</a> is amazing, but does not always provide the most educationally sound explanation about the code you’re pasting into your project.¹</p><blockquote>A very effective way that teachers and mentors can help to build understanding is to provide annotated examples.</blockquote><p>The following two versions of the same explanation about naming variables and camel case shows the difference between an annotated example and a less detailed example.</p><h3>Example One: Not So Detailed</h3><pre>/*<br>* Why is it important to use a naming <br>* convention for variables? Because <br>* when you work on a dev team, or when <br>* you do pair programming. You need to <br>* be on the same page as your colleagues.<br>* Keywords: camel-case, variable, declaration<br>*/</pre><pre>// DON&#39;T:<br><strong>const</strong> p = <strong>3.14</strong>;</pre><pre>// CONSIDER: <br><strong>const</strong> pi = <strong>3.14</strong>;<br><strong>const</strong> valueOfPi = <strong>3.14</strong>; // This is better!</pre><pre>// DON&#39;T: <br><strong>const</strong> theValueOfPiToTwoDecimalPlaces = <strong>3.14</strong>;</pre><pre>/*<br>* The moral of the story is: please use camel case.<br>* It&#39;s good practice and makes your variable declarations<br>* more readable and easily understood.<br>*/</pre><p>Even if you aren’t a developer you could understand the reasoning behind some of the above. It’s easy to see why theValueOfPiToTwoDecimalPlaces is a silly, difficult to read name.</p><p>But what about the contrast between pi and valueOfPi … why is valueOfPi better? Why can’t I use a single letter as a variable name? <em>Isn’t that what we did in Year 9 Algebra? ²</em></p><h3>Example Two: Explanation Every Step of the Way</h3><pre>/*<br>* Why is it important to use a naming <br>* convention for variables? Because <br>* when you work on a dev team, or when <br>* you do pair programming. You need to <br>* be on the same page as your colleagues.<br>* Keywords: camel-case, variable, declaration<br>*/</pre><pre>// DON&#39;T: Use single letters as variable names<br><strong>const</strong> p = <strong>3.14</strong>; // because it is unclear at<br>                // a glance what they are for.</pre><pre>// CONSIDER, Giving some context to<br>//           help others understand:</pre><pre><strong>const</strong> pi = <strong>3.14</strong>; // is not as clear as:<br><strong>const</strong> valueOfPi = <strong>3.14</strong>; // Use camel case</pre><pre>// DON&#39;T: do this, it&#39;s an abomination and abuse <br>// of camel case:<br>// If you are unsure about length...try to remember that <br>// typically, Camels only have a maximum of 2 humps!<br><strong>const</strong> theValueOfPiToTwoDecimalPlaces = <strong>3.14</strong>; <br>// How many capital letters (humps) does this variable name have?</pre><pre>/*<br>* The moral of the story is: please use camel case.<br>* It&#39;s good practice and makes your variable declarations<br>* more readable and easily understood.<br>*/</pre><p><em>A very simple and effective way that teachers and mentors can help to build understanding is to provide annotated examples.</em> If you are teaching something, you will be able to do this with a bit of practice, and if it’s your first time teaching something (we’ve all been there), annotating an example is the best way you can be a few steps ahead, and see the gaps in your own knowledge.</p><p><em>FYI — Camels do in fact have two humps.³ But there are two different kinds, and I did not know that before embarking on writing this thing.</em></p><ol><li>You shouldn’t be pasting code from Stack Overflow into your project if you don’t know what it does.</li><li>Thankfully, coding gives some form and purpose to the abstraction, but if you would like to wallow in the misery of Year 9 <a href="https://www.reddit.com/r/teenagers/comments/8e8lrg/i_fucking_hate_algebra/">r/teenagers</a> has some contemporary misery on the topic. We didn’t all have a teacher like <a href="https://twitter.com/misterwootube">Eddie</a>. SOB.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YfplTxUfe1uDSvYV" /><figcaption>Pictured: a Bactrian Camel</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96643ebc3aa1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[History Week 2017 — Angular App]]></title>
            <link>https://medium.com/@nclarx/history-week-2017-angular-app-c90fdbaa5ad8?source=rss-ecf4bfd92b50------2</link>
            <guid isPermaLink="false">https://medium.com/p/c90fdbaa5ad8</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[bootstrap-4]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Nick Clark]]></dc:creator>
            <pubDate>Sun, 13 Aug 2017 09:41:37 GMT</pubDate>
            <atom:updated>2017-08-13T12:40:43.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sldSR1RJSbvnYbORdqrmg.jpeg" /></figure><p><a href="http://www.historyweek.com.au/"><em>History Week</em></a><em> is an annual festival of historical events coordinated and run by the </em><a href="http://www.historycouncilnsw.org.au/"><em>History Council of NSW</em></a><em>. The History Council is a small not-for-profit organisation that works very hard to promote all sorts of history in NSW, from partnering with major cultural institutions like the State Library of NSW, to working with community organisations to promote history and give historians a way to communicate their work to the general public.</em></p><h3>The TL;DR</h3><p>I made a simple website that lists History Week Events using the newly released <a href="http://www.getbootstrap.com/">Bootstrap 4 Beta</a> (<a href="http://blog.getbootstrap.com/2017/08/10/bootstrap-4-beta/">i’ve been waiting for this to drop for ages</a>!), Angular (v4) w/ the <a href="https://github.com/angular/angular-cli">CLI</a>, and <a href="http://fontawesome.io/">Font Awesome</a>, using <a href="https://github.com/angular/angularfire2">AngularFire2</a> with <a href="https://firebase.google.com/">Firebase</a> as the backend.</p><p>The application takes a csv file exported from Google Sheets, parses the data and creates an event list.</p><p>This app is worth looking at if you want to see how to create a simple data driven website using Angular and Firebase.</p><p><strong>See the </strong><a href="http://events.historyweek.com.au/"><strong>website</strong></a><strong>, or clone the repo on </strong><a href="https://github.com/nclarx/history-week-events"><strong>Github</strong></a><strong>.</strong></p><h3>Making Lists</h3><p>Everything on the internet is a list. Facebook and Twitter feeds, Google search results, even news sites now have their fair share of dot-pointed content.</p><p>The most important thing about a list is that you can scan through and get to what you want as quickly as possible. Each list item in this website is a <a href="https://getbootstrap.com/docs/4.0/components/card/">Bootstrap Card</a> component with a header and body, that has essential details for an event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WtoGhSzdRapoWxoZcBTDrw.png" /></figure><h3>Workflow: from Spreadsheet to Database</h3><p>The History Council staff had prepared a spreadsheet of all the events which I exported as a CSV and wrote a component which parsed the data and pushed each event to Firebase.</p><p>The most intricate part of this was dealing with values which contained commas — there were some other issues with formatting date and time values, as well as general consistency in the dataset for addresses and blurbs, but overall: writing a component which parsed the spreadsheet and pushed it to the database was much more efficient than creating a form for the staff to enter data manually. The only rule I enforced was no “” characters.</p><p>We used the following process so the staff could update the event details quickly and easily:</p><ol><li>Staff make changes or additions to the spreadsheet.</li><li>CSV sent to me by email.</li><li>Developer uses component to parse data (literally takes &lt; 0.1 of a second)</li><li>Data is live on the website.</li></ol><p>Writing the component to parse the data was initially a bit of work for me to figure out the issue of handling commas within the values— but it was worth the time because it is a feature that can be added without much trouble to turn this into an application that can be continuously updated by the client themselves.</p><h3>Filtering</h3><p>There wasn’t anything remarkable about the sorting and filtering in this application. History Week events take place in many different regions across NSW, and a drop down was the simplest way to filter the events by region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l7QOaaKrmYkuS4CExLTexw.png" /></figure><p>There were also requirements to show featured events, sort by date, and toggle sort direction.</p><p>I wrapped all this functionality into a <a href="https://gist.github.com/nclarx/ca0a3c766146e0d38c54b7a623fb99a1">single pipe</a>.</p><h3>Google Analytics</h3><p>It’s critically important for an organisation like the History Council NSW to get numbers on usage and what events people were clicking on.</p><p>I followed a <a href="http://www.surfdew.com/using-google-analytics-with-your-spa-angular-2-web-app/">tutorial from Surfdew Software</a> explaining how to integrate the Google Analytics (GA) library into Angular to push button click, filter change and sort events to GA. This was remarkably easy to do following the tutorial — but I’m hoping Google will release the GA library modularised in TypeScript soon.</p><h3>Visual Design</h3><p>I had the History Week 2017 banner to work from which set the colour palette. The rest of the visual design elements are from Bootstrap, with the exception of a few custom button background colours and hovers to match the colour palette.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sldSR1RJSbvnYbORdqrmg.jpeg" /><figcaption>The colour palette: #28512, #149F9C, #873C6D, #694477</figcaption></figure><p>I used the the Bootstrap <a href="https://getbootstrap.com/docs/4.0/content/typography/#responsive-typography">responsive typography mix-ins</a> and found these worked well to handle text size for mobile devices after a bit of tweaking.</p><p><a href="http://fontawesome.io/">Font Awesome</a> is an excellent library for adding some visual interest. Even though I only used two icons <em>fa-star</em> and <em>fa-map-pin</em> these finish off the visual design nicely. The people behind Font Awesome are about to push out an update and have <a href="https://fontawesome.com/?utm_source=font_awesome_homepage&amp;utm_medium=display&amp;utm_content=banner&amp;utm_campaign=promo_4.7_update">individual licences</a> for $40. Definitely going to acquire one of these for future projects.</p><h3>Would Be Nice: could make this better?</h3><p>I had limited time to work on this and it was essential that the core function of an events list was fast, reliable, and that the visual design was right.</p><p>Adding authentication to the project was beyond the brief, but it would allow the following:</p><ul><li>a simple back-end where an authenticated user can user an updated CSV file to update the data</li><li>a way for users to save their own list of events and view these across multiple devices</li></ul><p>I think the simplicity of the design is a strong feature of this website, although it would be great if there was a “week view” that functioned as a filter. If this were to be made a more generic system, a calendar view to selected events by, week, month or day could be hidden in a slide out element beneath the filter/sort area.</p><p><strong><em>See the finished website at </em></strong><a href="http://events.historyweek.com.au/"><strong><em>http://events.historyweek.com.au</em></strong></a><strong><em> and clone the repo on </em></strong><a href="https://github.com/nclarx/history-week-events"><strong><em>GitHub</em></strong></a><strong><em>.</em></strong></p><p><a href="https://github.com/nclarx/history-week-events-2017">nclarx/history-week-events-2017</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c90fdbaa5ad8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>