<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Layman's Guide to Computing - Season 02</title><link href="https://ngjunsiang.github.io/laymansguide/" rel="alternate"></link><link href="https://ngjunsiang.github.io/laymansguide/feeds/season-02.atom.xml" rel="self"></link><id>https://ngjunsiang.github.io/laymansguide/</id><updated>2019-06-15T08:00:00+08:00</updated><entry><title>Issue 26: Software distribution</title><link href="https://ngjunsiang.github.io/laymansguide/issue026.html" rel="alternate"></link><published>2019-06-15T08:00:00+08:00</published><updated>2019-06-15T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-06-15:/laymansguide/issue026.html</id><summary type="html">&lt;p&gt;A developer can simply put up a download on a webpage and hope people download it and figure out how to get the app on their devices. But often, the more popular way is to publish the app to a repository (also known as an app store, for mobile devices). Before this can be done, the code or application needs to be packaged according to the requirements of the&amp;nbsp;repository.&lt;/p&gt;</summary><content type="html">&lt;p&gt;In the past 12 issues I’ve talked a bit about different kinds of programs (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue014.html"&gt;web, desktop, mobile, …&lt;/a&gt;)), different kinds of code (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue014.html"&gt;frontend, backend&lt;/a&gt;)), tools that programmers use while programming (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue015.html"&gt;command line&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue017.html"&gt;libraries&lt;/a&gt;) and &lt;a href="https://ngjunsiang.github.io/laymansguide/issue018.html"&gt;frameworks&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue019.html"&gt;version control&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue024.html"&gt;bug/issue trackers&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue025.html"&gt;text editors and integrated development environments&lt;/a&gt;)), and ideas they use to work more efficiently (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue023.html"&gt;specifications&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue020.html"&gt;testing&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue022.html"&gt;continuous integration&lt;/a&gt;)).&lt;/p&gt;
&lt;p&gt;To wrap this up, let’s answer one final question: how do they actually get their code out to the rest of the&amp;nbsp;world?&lt;/p&gt;
&lt;h2&gt;Mobile&amp;nbsp;apps&lt;/h2&gt;
&lt;p&gt;Let’s start with the easiest: mobile apps, of course, get published to the app store (&lt;a href="https://www.apple.com/sg/ios/app-store/"&gt;Apple App Store&lt;/a&gt;, or &lt;a href="https://play.google.com/store"&gt;Google Play&lt;/a&gt;, for most phones). Programmers could, of course, encourage people to enable installation of third-party apps and ask them to download and open an installation file … but how many people are going to do&amp;nbsp;that?&lt;/p&gt;
&lt;p&gt;The process of putting an app onto the app store is known as &lt;strong&gt;publishing&lt;/strong&gt;. This often involves lots of steps—see &lt;a href="https://developer.android.com/studio/publish"&gt;Google Play’s publishing process&lt;/a&gt;—including adding images and writing for the app’s&amp;nbsp;page.&lt;/p&gt;
&lt;p&gt;Before a program can be uploaded, a lot of extra information is needed by the app store: the app author’s name and particulars, the version number, minimum &lt;span class="caps"&gt;OS&lt;/span&gt; requirements (e.g. some apps won’t work on Android versions older than 4.4), and so on. The app store may also need a manifest, a list of files in the app. The process of adding all this information and organising the files into something that can be uploaded to an app store is known as &lt;strong&gt;packaging&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;How is code for other platforms packaged and released? That depends, really, on the&amp;nbsp;community.&lt;/p&gt;
&lt;h2&gt;Linux: software&amp;nbsp;repositories&lt;/h2&gt;
&lt;p&gt;On Linux, in the old days, you had to download the source code, compile it into an application (&lt;em&gt;self-note: this needs explaining in a future issue&lt;/em&gt;), and install updates for each application individually … this soon became a gargantuan effort for a user. Then some smart people got together and thought: why don’t we make a list of applications, and where they can be found? And then automate it so that a computer can download the source code and compile it automatically? Or, even better, have a central place containing compiled applications that can be downloaded, ready to use? And thus the software repository was born. (don’t confuse this with a code repository, which I introduced in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue019.html"&gt;Issue 19&lt;/a&gt;).)&lt;/p&gt;
&lt;p&gt;Each Linux distribution (&lt;a href="https://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt;, &lt;a href="https://www.gnome.org/"&gt;&lt;span class="caps"&gt;GNOME&lt;/span&gt;&lt;/a&gt;, &lt;a href="https://linuxmint.com/"&gt;Linux Mint&lt;/a&gt; are some of the more popular ones) has its own software repositories (also known as &lt;strong&gt;repos&lt;/strong&gt;). These repositories contain the most important or popular applications that their users need, and are updated and maintained regularly by &lt;strong&gt;maintainers&lt;/strong&gt;, developers who take on the role of testing code for compatibility. The maintainers often have to make changes, some little and some big, for the applications to run well with their distribution (also known as &lt;strong&gt;distro&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;Linux distros will often have multiple repositories to organise the huge list of applications available, and users can configure which repositories they want to use. They can edit the list of repositories directly, but most users will use a &lt;strong&gt;package manager&lt;/strong&gt;, a program that helps users search for, install, and update the applications on their computer. Many of these package managers are command line applications, but there are graphical package managers available as&amp;nbsp;well.&lt;/p&gt;
&lt;h2&gt;Plugins: it depends&amp;nbsp;…&lt;/h2&gt;
&lt;p&gt;Really popular software that allows users to write and release their own plugins will often also have a way for users to search for them. For instance, Wordpress has a Plugins page for Wordpress users to add plugins to their Wordpress blog. Depending on what kind of plugins you are writing, the release process will vary widely. Sometimes this plugin repository is run by a community, sometimes it is run by the application developer, and sometimes it is run by a heroic volunteer, so … it depends&amp;nbsp;:)&lt;/p&gt;
&lt;h2&gt;Libraries: package&amp;nbsp;repositories&lt;/h2&gt;
&lt;p&gt;If you are learning a programming language, chances are you will have to use at least one third-party library. The easiest way to find them is with a package repository. These are the most popular package/gem repositories for the most popular programming&amp;nbsp;languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python: &lt;a href="https://pypi.org/"&gt;PyPI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ruby: &lt;a href="https://rubygems.org/"&gt;RubyGem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;NodeJS: &lt;a href="https://www.npmjs.com/"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Javascript: uhh, wow … there’s just so many specialised ones and no single central repository. But &lt;a href="https://yarnpkg.com/en/"&gt;yarn&lt;/a&gt; is an up-and-rising&amp;nbsp;one&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A developer can simply put up a download on a webpage and hope people download it and figure out how to get the app on their devices. But often, the more popular way is to publish the app to a repository (also known as an app store, for mobile devices). Before this can be done, the code or application needs to be packaged according to the requirements of the&amp;nbsp;repository.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;It’s the end of Season 2 of Layman’s Guide. I hope the programmer’s world looks a little less murky now, even if it looks a lot more&amp;nbsp;complex!&lt;/p&gt;
&lt;p&gt;Many programming courses tell their students that they can just jump into programming without worrying about all these. And they often set up their courses minimally, introducing Github or a package repository on occasion when they can’t avoid it. But for the most part, they don’t explain what these parts of the programmer’s world are and how to use&amp;nbsp;them.&lt;/p&gt;
&lt;p&gt;To me, that’s like bringing a friend from overseas to your country and not explaining how the transportation system works, how to buy things, what the most popular methods of payment are, how to cross the road … you can kind of hole yourself up at home and maybe venture out to the convenience store down the street, but what fun is&amp;nbsp;that?&lt;/p&gt;
&lt;p&gt;These are tools and ideas you can learn and use separately from programming (I’m using Github to get version control on Layman’s Guide, in fact), and you can get really good with them while knowing very minimal programming. And if you learned anything from Season 2 that really rocked your world, gave you an idea for how to improve things, or changed your view of the way things are done, please drop me an email and let me know&amp;nbsp;:)&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next season:&lt;/strong&gt; Data?&amp;nbsp;Cloud?&lt;/p&gt;
&lt;p&gt;Pick your own adventure! Let me know what you’d like me to write about&amp;nbsp;next:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Data&lt;/strong&gt;: different types of data (text, images, video, code). Why JPGs are so small and BMPs are so huge and PNGs are kinda in-between. Why video files are so huge and so difficult to compress. How do cloud companies prevent losing data when a hard disk goes kaput? Things like&amp;nbsp;that.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cloud&lt;/strong&gt;: What happens to all the images I upload on Instagram? How does data actually travel from wherever it is to my laptop or smartphone? How do people actually start making their programs use the cloud? Things like&amp;nbsp;that.&lt;/p&gt;
&lt;p&gt;I’ll take another break next weekend to get Season 3 hashed out. Expect the first issue&amp;nbsp;end-June!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;ASCII&lt;/span&gt;? [Issue&amp;nbsp;23]&lt;/li&gt;
&lt;li&gt;compiling code into an application [Issue&amp;nbsp;26]?&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category><category term="app"></category></entry><entry><title>Issue 25: Text Editors and Integrated Development Environments</title><link href="https://ngjunsiang.github.io/laymansguide/issue025.html" rel="alternate"></link><published>2019-06-01T08:00:00+08:00</published><updated>2019-06-01T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-06-01:/laymansguide/issue025.html</id><summary type="html">&lt;p&gt;A text editor helps programmers to edit their code. An &lt;span class="caps"&gt;IDE&lt;/span&gt; (integrated development environment) helps programmers to see what’s going on in their code, test their code’s performance, and provide almost all the necessary tools in one&amp;nbsp;package.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last week, I introduced issue trackers, which are software tools that developers use to keep track of problems and issues with their software. Issue trackers are usually places that users can submit bug reports to help out the developers in tracking down a&amp;nbsp;bug.&lt;/p&gt;
&lt;p&gt;In the second-last issue of this season, I&amp;#8217;m going to do a little detour to talk about what developers use to edit their code. Yeah, the actual software they type their code&amp;nbsp;into.&lt;/p&gt;
&lt;h2&gt;Editor: something used to edit&amp;nbsp;text&lt;/h2&gt;
&lt;p&gt;Newspaper editors, book editors, photo editors … nope we’re not talking about those. Text editors are software that is used to edit text. The simplest example you know of is probably Notepad. On the other end of the scale you can have really fancy editors like &lt;a href="https://www.sublimetext.com/"&gt;Sublime Text&lt;/a&gt; or &lt;a href="https://notepad-plus-plus.org/"&gt;Notepad++&lt;/a&gt;, or &lt;a href="https://atom.io/"&gt;Atom&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Sublime Text" src="https://ngjunsiang.github.io/laymansguide/issue025_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Sublime&amp;nbsp;Text&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Every programmer has their own favourite. They can get prickly and defensive about their text editors of choice, so be careful what you say about their preferred text&amp;nbsp;editors.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Notepad++" src="https://ngjunsiang.github.io/laymansguide/issue025_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Notepad++&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;&lt;img alt="Github Atom" src="https://ngjunsiang.github.io/laymansguide/issue025_03.png" /&gt;&lt;br /&gt;
&lt;em&gt;Github&amp;nbsp;Atom&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Text editors do what is written on the box: they let you edit text. Often (but not always), that means code. It may have nice features that help you autocomplete words, or close your brackets for you, or highlight keywords to make the code easier to read, but it doesn’t help you think about the flow of logic in your code. For that you need&amp;nbsp;…&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;IDE&lt;/span&gt;: an Integrated Development&amp;nbsp;Environment&lt;/h2&gt;
&lt;p&gt;An &lt;span class="caps"&gt;IDE&lt;/span&gt; is rather different. Yes, it probably has a big window for you to edit your code. But it has to do much more. It is called a &lt;strong&gt;development environment&lt;/strong&gt; because it lets developers &lt;em&gt;explore&lt;/em&gt; their code. An &lt;span class="caps"&gt;IDE&lt;/span&gt; can run your code, show you the values of the variables within your code in real-time, or let you pause the code at a point so you can see what the program is doing before it exits or crashes. This helps greatly with the debugging&amp;nbsp;process.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Spyder" src="https://ngjunsiang.github.io/laymansguide/issue025_04.png" /&gt;&lt;br /&gt;
&lt;em&gt;Spyder &lt;span class="caps"&gt;IDE&lt;/span&gt;, showing its object inspector (for checking variables) and built-in console (where the code is&amp;nbsp;run)&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;An &lt;span class="caps"&gt;IDE&lt;/span&gt; can test the performance of your code to let you know where it is running slowly (a process known as &lt;strong&gt;profiling&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Netbeans" src="https://ngjunsiang.github.io/laymansguide/issue025_05.png" /&gt;&lt;br /&gt;
&lt;em&gt;Netbeans &lt;span class="caps"&gt;IDE&lt;/span&gt; showing its profiler at&amp;nbsp;work&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;An &lt;span class="caps"&gt;IDE&lt;/span&gt; integrates many tools into one software package so you can do your work mostly without having to switch around&amp;nbsp;windows.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A text editor helps programmers to edit their code. An &lt;span class="caps"&gt;IDE&lt;/span&gt; (integrated development environment) helps programmers to see what’s going on in their code, test their code’s performance, and provide almost all the necessary tools in one&amp;nbsp;package.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;This is a short issue that I wanted to write to answer questions I get on “where to start learning programming”? The usual answer they get is books and websites teaching you how to code, but I contend that the first piece of software you use is critically more&amp;nbsp;important.&lt;/p&gt;
&lt;p&gt;In every hobby or pursuit, the tools, gear, and equipment determine the pleasure you get out of it, and likely determine whether you continue to stick with it. Anyone beginning to learn programming should start with a good text editor, and gradually move on to an &lt;span class="caps"&gt;IDE&lt;/span&gt; if they’re working with complex&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;I will save the recommendations for other places; I don’t think a newsletter is appropriate for that. The best text editor for you is going to depend on your use case, your &lt;span class="caps"&gt;OS&lt;/span&gt;, your machine (laptop or workstation), and potentially many other&amp;nbsp;factors.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt;&amp;nbsp;???&lt;/p&gt;
&lt;p&gt;I haven’t quite decided what I’ll wrap up this season with. I said in Issue 14 that I started this season to help people understand what developers do, to build up their picture of Computing before they start trying to learn programming. Maybe I’ll do a short introduction to operating systems, or maybe we’ll talk about package distribution :) We’ll see next&amp;nbsp;week!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;ASCII&lt;/span&gt;? [Issue&amp;nbsp;23]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 24: Issue trackers, Bug trackers</title><link href="https://ngjunsiang.github.io/laymansguide/issue024.html" rel="alternate"></link><published>2019-05-25T13:18:00+08:00</published><updated>2019-05-25T13:18:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-05-25:/laymansguide/issue024.html</id><summary type="html">&lt;p&gt;A bug tracker, or issue tracker, is where users can submit problems they encounter with the software. To submit a helpful issue, users should understand the project’s philosophy and purpose, and read the contributing&amp;nbsp;guidelines.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last week, we talked about how developers plan out a project and describe specifically what needs to be done: they write out a specification, and then they write code to make their app meet the specification. Specifications are also used to standardise the way apps communicate, such as they way to report&amp;nbsp;time.&lt;/p&gt;
&lt;p&gt;So what happens when apps and programs do not follow the&amp;nbsp;specification?&lt;/p&gt;
&lt;h2&gt;Bugs, bugs, and more&amp;nbsp;bugs&lt;/h2&gt;
&lt;p&gt;There’s a reason for it, and that reason is usually a bug. A bug is a mistake in the software that causes it to not follow the specification. Sometimes it’s a little typo, sometimes it’s a logic error, sometimes it’s running code causing a computer to run out of resources (usually memory), sometimes a &lt;a href="https://ngjunsiang.github.io/laymansguide/issue017.html"&gt;library (Issue 17)&lt;/a&gt;) you rely on has changed, sometimes it’s just way-too-complex code that nobody can fully figure out … and often, you won’t know until you have spent enough time investigating&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;Software everywhere is full of bugs. They are like bacteria; you can kill them but there are always&amp;nbsp;more!&lt;/p&gt;
&lt;h2&gt;Why are they called bugs&amp;nbsp;anyway?&lt;/h2&gt;
&lt;p&gt;In the early days of electromechanical computers, which carried out computation through a mix of electrical and mechanical parts, problems that arose during the computer’s operation were not always caused by wrong instructions sent to the computer. In 1946, operators of the Harvard Mark &lt;span class="caps"&gt;II&lt;/span&gt; encountered an error that was eventually traced to a moth trapped in a relay. Bug hunting then was literal; today it is figurative, but the term has&amp;nbsp;stuck.&lt;/p&gt;
&lt;p&gt;&lt;img alt="A dead moth taped to a page" src="https://ngjunsiang.github.io/laymansguide/issue024_04.jpg" /&gt;&lt;br /&gt;
&lt;em&gt;A page from the Harvard Mark &lt;span class="caps"&gt;II&lt;/span&gt; electromechanical computer&amp;#8217;s log, featuring a dead moth that was removed from the device. &lt;a href="https://en.wikipedia.org/wiki/Software_bug"&gt;Source:&amp;nbsp;Wikipedia&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;h2&gt;How do developers keep track of so many&amp;nbsp;bugs?&lt;/h2&gt;
&lt;p&gt;This refrain should start to sound familiar … they do so with the help of machines&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;Software that helps to keep track of bugs are known as bug trackers. Today, when problems with software can sometimes go beyond bugs, such software may also be known as issue&amp;nbsp;trackers.&lt;/p&gt;
&lt;p&gt;Such features may also come with other software or services; Github has a built-in issue&amp;nbsp;tracker.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Github’s issue tracker" src="https://ngjunsiang.github.io/laymansguide/issue024_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Github’s issue tracker. From Kenneth&amp;nbsp;Reitz’s &lt;code&gt;requests&lt;/code&gt; package.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;This is where developers working on a piece of software can report bugs or issues they discovered. Often, these reports also come from users of the&amp;nbsp;software.&lt;/p&gt;
&lt;p&gt;Through the issue created in the issue tracker, developers can communicate with the user who reported the bug, ask for more information, clarify uses of the software, assign the problem to other developers, or close the issue if it is&amp;nbsp;resolved.&lt;/p&gt;
&lt;p&gt;&lt;img alt="An issue in Github’s issue tracker" src="https://ngjunsiang.github.io/laymansguide/issue024_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;What an issue in Github looks like. From Kenneth&amp;nbsp;Reitz’s &lt;code&gt;requests&lt;/code&gt; package.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Projects will often have a contributing guideline to help users understand how best to write a good bug report. Reading and understanding a bug report can be really trying, especially if it is unclear or does not provide enough information, and this can make the debugging work of developers an emotional&amp;nbsp;drain.&lt;/p&gt;
&lt;p&gt;It is considered polite to read the project intro and contributing guidelines to understand how the project is being managed and how to write a helpful bug&amp;nbsp;report.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Contribution guidelines for requests" src="https://ngjunsiang.github.io/laymansguide/issue024_03.png" /&gt;&lt;br /&gt;
&lt;em&gt;Contributing guidelines for Kenneth&amp;nbsp;Reitz’s &lt;code&gt;requests&lt;/code&gt; package.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Issue trackers are never empty. Popular software gets lots of attention from users, who will use it in all kinds of ways not considered or intended by the developers, so there is always something to be worked&amp;nbsp;on!&lt;/p&gt;
&lt;p&gt;If you found a bug in a piece of software you use, and don’t know where or how to inform the developers, try searching to see if it has a place to submit bug reports or issues. Most active projects do, and their issue trackers are often easier to find than their email addresses&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A bug tracker, or issue tracker, is where users can submit problems they encounter with the software. To submit a helpful issue, users should understand the project’s philosophy and purpose, and read the contributing&amp;nbsp;guidelines.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;This is a short one, and one I’ve been waiting to write. So many people don’t know that some of the software they use every day have issue trackers, and they can contribute to the healthy development of their favourite software by helping to submit issues they&amp;nbsp;encounter.&lt;/p&gt;
&lt;p&gt;How is your workplace keeping track of issues raised by staff? Are they doing it manually in a document? Would an issue tracker help make this job&amp;nbsp;easier?&lt;/p&gt;
&lt;p&gt;Next week, I’ll try to answer a question I sometimes get: why do developers like Notepad so much? (They don’t! Just because it is all text does not make it the same as Notepad!) We’ll talk about the kind of editing tools that developers&amp;nbsp;use.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; Editors and IDEs: what’s the&amp;nbsp;difference?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;ASCII&lt;/span&gt;? [Issue&amp;nbsp;23]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 23: Specifications in software</title><link href="https://ngjunsiang.github.io/laymansguide/issue023.html" rel="alternate"></link><published>2019-05-18T08:00:00+08:00</published><updated>2019-05-18T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-05-18:/laymansguide/issue023.html</id><summary type="html">&lt;p&gt;Specifications describe the details of how a piece of hardware/software should work in order to meet a set of requirements. When well written and well implemented, they aid the coordination of the multitude of devices across the world, enabling them to communicate seamlessly, unambiguously, and unnoticeably with each other. Your devices work because they follow&amp;nbsp;specifications.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last week, we took a look at part of the (heavily simplified) software development&amp;nbsp;pipeline:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;fork a repository → make changes → commit changes (and do automated testing) → merge changes when the branch is ready and all tests pass.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;At this point, it is time to ask a stupid question: how do developers know what they need to&amp;nbsp;do?&lt;/p&gt;
&lt;h2&gt;Software&amp;nbsp;requirements&lt;/h2&gt;
&lt;p&gt;When a project is first accepted, the customer will usually have at least a vague idea of what they want the software to do. Hopefully, they will also have a clearer idea of what they want. For example, if they want an online shopping website, they might have some idea of they want shopping categories, a shopping cart, a search bar (with or without advanced search?), the ability to add or customise promotions, guest checkout, and so&amp;nbsp;on.&lt;/p&gt;
&lt;p&gt;Fine decisions, such as the checkout page—the order in which the text fields are arranged, the kind of date/time picker to use for the delivery schedule page, how users should be alerted if there’s an error in the input (alert below the text field or in a warning box at the top), also need to be made. And very often, the customer doesn’t want to make these decisions (which is why they hired a firm like yours to make the website), and so it falls to you (or your designers) to make these decisions&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;What your customer wants—those are requirements. How the designers (or project lead, or whoever makes the decisions) decide to meet those requirements—those are called &lt;strong&gt;specifications&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Specifications&lt;/h2&gt;
&lt;p&gt;There are more kinds of specifications than I can cover in detail, but let’s talk about some of the ones you are already familiar&amp;nbsp;with.&lt;/p&gt;
&lt;h3&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Specification&amp;nbsp;(Hardware)&lt;/h3&gt;
&lt;p&gt;Did you know that &lt;span class="caps"&gt;USB&lt;/span&gt; was a specification? A group of engineers known as the &lt;a href="https://www.usb.org/"&gt;&lt;span class="caps"&gt;USB&lt;/span&gt; Implementers Forum&lt;/a&gt; decides the specifications that &lt;span class="caps"&gt;USB&lt;/span&gt; devices must meet before they can be certified as &lt;span class="caps"&gt;USB&lt;/span&gt;-compatible.&lt;/p&gt;
&lt;p&gt;The specification covers a few&amp;nbsp;categories:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/USB_hardware#Connectors"&gt;Hardware requirements&lt;/a&gt;: Shape and dimensions of connectors, which pins (those gold contacts on the &lt;span class="caps"&gt;USB&lt;/span&gt; connector) are for power and which are for data, how to implement backward compatibility with older &lt;span class="caps"&gt;USB&lt;/span&gt; sockets,&amp;nbsp;etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/USB#Release_versions"&gt;Performance requirements&lt;/a&gt;: Maximum data transfer rates, maximum charging power,&amp;nbsp;etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/USB#System_design"&gt;Operational requirements&lt;/a&gt;: How transfers are to be implemented and carried out, supported types of devices and the type of transfer modes to use, how different features are to be implemented (e.g. audio streaming),&amp;nbsp;etc.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt;&amp;nbsp;Specification&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://www.w3.org/Protocols/Specs.html"&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt; specifications&lt;/a&gt; are maintained by the &lt;a href="https://www.ietf.org/"&gt;Internet Engineering Task Force (&lt;span class="caps"&gt;IETF&lt;/span&gt;)&lt;/a&gt;, an open community of people who collectively make the technical decisions about what the Internet should be able to do, and how it is going to do&amp;nbsp;them.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.rfc-editor.org/standards"&gt;Take a look at some well-known specifications&lt;/a&gt; that they have produced (click the links that say “&lt;span class="caps"&gt;ASCII&lt;/span&gt;”—yeah we’ll talk about &lt;span class="caps"&gt;ASCII&lt;/span&gt; sometime). It’s going to be way over your head, but don’t worry about that. Here’s an example from &lt;span class="caps"&gt;TCP&lt;/span&gt;, the Transmission Control Protocol that describes how packets should be sent over the&amp;nbsp;internet:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c"&gt;3&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;1&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;  Header Format&lt;/span&gt;

&lt;span class="c"&gt;  TCP segments are sent as internet datagrams&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;  The Internet Protocol&lt;/span&gt;
&lt;span class="c"&gt;  header carries several information fields&lt;/span&gt;&lt;span class="nt"&gt;,&lt;/span&gt;&lt;span class="c"&gt; including the source and&lt;/span&gt;
&lt;span class="c"&gt;  destination host addresses &lt;/span&gt;&lt;span class="k"&gt;[&lt;/span&gt;&lt;span class="c"&gt;2&lt;/span&gt;&lt;span class="k"&gt;]&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;  A TCP header follows the internet&lt;/span&gt;
&lt;span class="c"&gt;  header&lt;/span&gt;&lt;span class="nt"&gt;,&lt;/span&gt;&lt;span class="c"&gt; supplying information specific to the TCP protocol&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;&lt;span class="c"&gt;  This&lt;/span&gt;
&lt;span class="c"&gt;  division allows for the existence of host level protocols other than&lt;/span&gt;
&lt;span class="c"&gt;  TCP&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;  TCP Header Format&lt;/span&gt;

&lt;span class="c"&gt;    0                   1                   2                   3   &lt;/span&gt;
&lt;span class="c"&gt;    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |          Source Port          |       Destination Port        |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |                        Sequence Number                        |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |                    Acknowledgment Number                      |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |  Data |           |U|A|P|R|S|F|                               |&lt;/span&gt;
&lt;span class="c"&gt;   | Offset| Reserved  |R|C|S|S|Y|I|            Window             |&lt;/span&gt;
&lt;span class="c"&gt;   |       |           |G|K|H|T|N|N|                               |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |           Checksum            |         Urgent Pointer        |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |                    Options                    |    Padding    |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;   |                             data                              |&lt;/span&gt;
&lt;span class="c"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/span&gt;
&lt;span class="c"&gt;                            TCP Header Format&lt;/span&gt;

&lt;span class="c"&gt;          Note that one tick mark represents one bit position&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;                               Figure 3&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;  Source Port:  16 bits&lt;/span&gt;
&lt;span class="c"&gt;    The source port number&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;  Destination Port:  16 bits&lt;/span&gt;
&lt;span class="c"&gt;    The destination port number&lt;/span&gt;&lt;span class="nt"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Look at how specific these documents are about how data should be transmitted and received! These documents are how developers and programmers resolve arguments about who is writing their code correctly and who is responsible for a bug. The requirements have to be specific enough that the expected behaviour for a scenario is clear, yet leave enough room for better implementations to replace old&amp;nbsp;ones.&lt;/p&gt;
&lt;h3&gt;&lt;span class="caps"&gt;API&lt;/span&gt;&amp;nbsp;Specifications&lt;/h3&gt;
&lt;p&gt;We &lt;a href="https://buttondown.email/laymansguide/archive/fe8b59fc-c5fd-49f2-9d01-9f21fa3df95c"&gt;discussed APIs in an earlier issue&lt;/a&gt;: an &lt;span class="caps"&gt;API&lt;/span&gt; describes how apps/programms should send and request information from each other. They are how web developers of online services know how to get you to use your Facebook account to log in, or how to access your phone contacts. APIs are another type of software specification: your app must communicate in a manner that fits the &lt;span class="caps"&gt;API&lt;/span&gt; specification, or it would not receive the desired response from the&amp;nbsp;server.&lt;/p&gt;
&lt;h3&gt;Time&amp;nbsp;Specifications&lt;/h3&gt;
&lt;p&gt;We don’t think about it very often, but when someone writes 02/03/19, how do we know if they mean March second or February third of 2019? Such ambiguity is often disastrous in software applications, so there are clear specifications about how apps should standardise the commmunication of time between apps and across the Internet (for internet applications, the standard is &lt;a href="https://www.ietf.org/rfc/rfc3339.txt"&gt;&lt;span class="caps"&gt;RFC3339&lt;/span&gt;&lt;/a&gt;). Because computers and humans do not process time the same way (&lt;a href="https://en.wikipedia.org/wiki/System_time"&gt;see Wikipedia’s System time page&lt;/a&gt;), there are specifications for how to do the conversion of machine representations to human-readable representations as well. And because this is applicable across many areas and not just in software, some of these specifications are called &lt;strong&gt;standards&lt;/strong&gt;: specifications which should be followed by everyone who wishes to communicate&amp;nbsp;clearly.&lt;/p&gt;
&lt;p&gt;Think there are only 24 time zones? Or that time zones are always 1 hour apart? Or that the current timezones are exactly the same as they were 20 years ago? Think a leap second is always one second? That calendar time always moves forwards? That February never has more than 29&amp;nbsp;days?&lt;/p&gt;
&lt;p&gt;I used to think these things too, until I read &lt;a href="https://zachholman.com/talk/utc-is-enough-for-everyone-right"&gt;Zach Holman’s detailed tract on &lt;span class="caps"&gt;UTC&lt;/span&gt;&lt;/a&gt;. Fascinating, and ever so slightly&amp;nbsp;disturbing.&lt;/p&gt;
&lt;h2&gt;Why are there so many&amp;nbsp;specifications?!&lt;/h2&gt;
&lt;p&gt;Because they are&amp;nbsp;useful!&lt;/p&gt;
&lt;p&gt;When a developer first learns about specifications, it can be really alarming to find out that they haven’t been following many of them. They may even start feeling oppressed by the number of specifications that must be&amp;nbsp;followed.&lt;/p&gt;
&lt;p&gt;And then the developer advances. They tackle more finicky problems. They tackle problems that require more precision: time to the nearest nanosecond, synchronisation within a fraction of a second, lag time of no more than 200 milliseconds, etc. When they run into sufficiently difficult problems and find that they need help (such as the aforementioned time representations), that is where they will welcome the specification overlords into their&amp;nbsp;life.&lt;/p&gt;
&lt;p&gt;Many specifications were written because similarly talented developers ran into the same issue. And if there is no need to reinvent the wheel, those specifications save you many hours hashing out a suitable specification and implementation (since other developers would have offered sample implementations online), and enable your app to communicate with others who follow the same&amp;nbsp;specification.&lt;/p&gt;
&lt;p&gt;Specifications are part of an engineer’s toolbox in the struggle to create order from chaos, and a well-written specification is a thing of&amp;nbsp;beauty.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Specifications describe the details of how a piece of hardware/software should work in order to meet a set of requirements. When well written and well implemented, they aid the coordination of the multitude of devices across the world, enabling them to communicate seamlessly, unambiguously, and unnoticeably with each other. Your devices work because they follow&amp;nbsp;specifications.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Yay, I finally cleared one item from the &amp;#8220;sometime in the future&amp;#8221; list! When I first started reading implementations, I found them really intimidating and impossible to get into. It was only when I started programming and having to do things like getting my data from an online service through an &lt;span class="caps"&gt;API&lt;/span&gt;, that specifications started making sense. Hardware specifications were useful too, in trying to understand whether a &lt;span class="caps"&gt;USB&lt;/span&gt; charger will be able to do quick charging or support higher rates of data transfer before I buy&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;Because making an app from scratch can be so stressful and annoying, developers usually separate the design work from the programming. Creating a specification and design for an app is both a science and an art, and when done well, can make programming a breeze. A developer just needs to read the relevant part of the specification, think about how to implement that section, and get it&amp;nbsp;done.&lt;/p&gt;
&lt;p&gt;Next week, we’ll look at something else that is part of a developer’s life as well:&amp;nbsp;debugging.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt;&amp;nbsp;Debugging&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;ASCII&lt;/span&gt;? [Issue&amp;nbsp;23]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 22: Continuous Integration in software</title><link href="https://ngjunsiang.github.io/laymansguide/issue022.html" rel="alternate"></link><published>2019-05-11T08:00:00+08:00</published><updated>2019-05-11T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-05-11:/laymansguide/issue022.html</id><summary type="html">&lt;p&gt;Continuous Integration means merging changes back to the main branch as often as possible. This means keeping code changes as small as possible, and using automated testing to speed up the development&amp;nbsp;process.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last week I introduced forking and merging, which are how developers ensure that they don&amp;#8217;t override other peoples’ work. They fork a repository to create their own copy, make the changes required to introduce the feature they want, and then merge it back with the main repository when it is ready, for the repository owner to&amp;nbsp;review.&lt;/p&gt;
&lt;p&gt;Two weeks ago I introduced the idea of testing, which in programming means writing more code that checks your code so that it is producing the correct output when you give it a certain&amp;nbsp;input.&lt;/p&gt;
&lt;p&gt;By now your idea of a developers’ workflow might look something like&amp;nbsp;this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fork a repository (which creates a &lt;strong&gt;branch&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Make changes to code on that&amp;nbsp;branch.&lt;/li&gt;
&lt;li&gt;Test the code on that&amp;nbsp;branch.&lt;/li&gt;
&lt;li&gt;If the tests pass, send a pull request to the repository owner to merge this branch with the main&amp;nbsp;branch.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt="A commit on Github" src="https://ngjunsiang.github.io/laymansguide/issue022_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Git branching. From &lt;a href="https://www.atlassian.com/git/tutorials/using-branches"&gt;Atlassian’s git branch tutorial&lt;/a&gt;.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;You can imagine that steps 2 and 3, the bread and butter of developers everywhere, is really tedious. Write code, test fails. Edit code, test fails again. On and on and&amp;nbsp;on.&lt;/p&gt;
&lt;p&gt;So engineers automate this part. Git (from Issue 19) can run little bits of code (called a &lt;strong&gt;hook&lt;/strong&gt;) when a commit is made to carry out this testing. So this lets developers set up repositories in a way that tests every single commit (or series of commits)). The above process now looks&amp;nbsp;like:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fork a repository (which creates a &lt;strong&gt;branch&lt;/strong&gt;).
2a. Make changes to code on that branch.
2b. Git tests the code on that branch and reports the&amp;nbsp;result.&lt;/li&gt;
&lt;li&gt;If the tests pass, send a pull request to the repository owner to merge this branch with the main&amp;nbsp;branch.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;One step less! But the part that developers dread is usually merging, which is where the code conflicts occur&amp;nbsp;…&lt;/p&gt;
&lt;h2&gt;Merge&amp;nbsp;conflicts&lt;/h2&gt;
&lt;p&gt;&lt;img alt="A commit on Github" src="https://ngjunsiang.github.io/laymansguide/issue022_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Git merging. From &lt;a href="https://www.atlassian.com/git/tutorials/using-branches/git-merge"&gt;Atlassian’s git merge tutorial&lt;/a&gt;.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Most development teams organise their work into (at least) 3 types of&amp;nbsp;branches:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;master&lt;/code&gt;, which is usually production code that is actually being run on the&amp;nbsp;servers.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dev&lt;/code&gt;, for code in development that the team is working&amp;nbsp;on.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;feature&lt;/code&gt;, for code forked from development which a developer or smaller team is&amp;nbsp;editing&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While Alice is working on&amp;nbsp;a &lt;code&gt;feature&lt;/code&gt; branch, Bob is working on&amp;nbsp;his &lt;code&gt;feature&lt;/code&gt; branch as well, and Charmaine is merging her change to&amp;nbsp;the &lt;code&gt;dev&lt;/code&gt; branch. Charmaine’s changes might cause problems with Alice’s code. Alice is not going to know about this until she tries to merge her branchc&amp;nbsp;with &lt;code&gt;dev&lt;/code&gt;! So her work process now looks&amp;nbsp;like:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fork a repository (which creates a &lt;strong&gt;branch&lt;/strong&gt;).
2a. Make changes to code on that branch.
2b. A git hook tests the code on that branch and reports the result.
2c. Pull any changes in the parent branch (automatically or manually) to keep the code&amp;nbsp;current.&lt;/li&gt;
&lt;li&gt;If the tests pass, send a pull request to the repository owner to merge this branch with the main&amp;nbsp;branch.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This means that on top of just testing her code, Alice (and Bob and Charmaine) need to pull in changes&amp;nbsp;from &lt;code&gt;dev&lt;/code&gt; whenever it is updated, to ensure that her own changes still work with the latest copy&amp;nbsp;of &lt;code&gt;dev&lt;/code&gt; branch. This can be automated with git hooks (those little bits of code mentioned earlier), but the mental stress from having the code change under you can be pretty&amp;nbsp;draining.&lt;/p&gt;
&lt;p&gt;Big features, in particular, suffer from problems like this because they involve many code changes that accumulate and affect many parts&amp;nbsp;of &lt;code&gt;dev&lt;/code&gt;. So some teams have taken to using a process called &lt;strong&gt;Continuous Integration&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Continuous&amp;nbsp;Integration&lt;/h2&gt;
&lt;p&gt;In a nutshell, continuous integration means to keep your code changes as small as possible, and merge your changes into the parent branch as often as possible, instead of letting them pile up to be released in one&amp;nbsp;day.&lt;/p&gt;
&lt;p&gt;Its main advantage is that it allows the process of making a change to be really short. Which then allows these changes to be merged as soon as possible, and be updated to other developers’ branches as soon as possible, so that the latest updates are synchronised to the team, and nobody is working in the dark with an unsynced copy of the base&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Continuous Integration means merging changes back to the main branch as often as possible. This means keeping code changes as small as possible, and using automated testing to speed up the development&amp;nbsp;process.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;When I first learnt about continuous integration, I thought this was something every organisation should know about! Have you had colleagues who tend to do things in the dark, and nobody really knew what they were doing and they seemed to be out of sync with the team? Yeah, continuous integration and help with&amp;nbsp;that.&lt;/p&gt;
&lt;p&gt;Understandably, nobody wants to spend more time in meetings and on communication that is otherwise necessary. But in workplaces where the team shares a common repository (like a shared network folder, or Dropbox folder, or Google Drive folder, …), why not try to automate some of the updates which are done by&amp;nbsp;hand?&lt;/p&gt;
&lt;p&gt;One example: I don’t like it when events are added to a calendar and I only find out much later. So I used &lt;a href="https://ifttt.com/"&gt;&lt;span class="caps"&gt;IFTTT&lt;/span&gt;&lt;/a&gt;, a web service that lets me set up automated processes, to send myself a Telegram message whenever an event is added to a&amp;nbsp;calendar.&lt;/p&gt;
&lt;p&gt;In a team, automating such updates means somebody is not wasting time typing out these updates to the team. What can your team automate today so that it is easier for everyone to be in&amp;nbsp;sync?&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; Specifications: how developers know what to work on&amp;nbsp;(finally!)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue 15]
&lt;del&gt;- a specification? [Issue 6,8]&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 21: Forking and merging</title><link href="https://ngjunsiang.github.io/laymansguide/issue021.html" rel="alternate"></link><published>2019-05-04T08:00:00+08:00</published><updated>2019-05-04T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-05-04:/laymansguide/issue021.html</id><summary type="html">&lt;p&gt;n git, forking a repository creates a copy of it for you to work on. Merging a repository with the original combines the commits from both so that they become one repository again. Conflicts arising from commits from both codepaths that affect the same part of the code will need to be resolved manually. Developers do most of this forking and merging in Github, an online platform for working on and talking about&amp;nbsp;code.&lt;/p&gt;</summary><content type="html">&lt;p&gt;So far I have been describing things as though only one developer was working on a project. What happens when two developers are involved? Any kind of collaboration between people working on one thing usually leads to issues coordinating their efforts. How do developers manage&amp;nbsp;this?&lt;/p&gt;
&lt;p&gt;Usually, by not working on the same part of the code at the same time. But in addition to that, developers have also come up with some good practices and work philosophies to minimise the friction involved in working&amp;nbsp;together.&lt;/p&gt;
&lt;p&gt;In this issue, I want to introduce &lt;strong&gt;forking&lt;/strong&gt; and &lt;strong&gt;merging&lt;/strong&gt;, key ideas behind version control systems and how they keep developers&amp;nbsp;sane.&lt;/p&gt;
&lt;h2&gt;How developers suggest&amp;nbsp;changes&lt;/h2&gt;
&lt;p&gt;One really cool thing about developers is how much they love to share their code online. When you see someone else’s code online and you can see improvements you’d love to make to the code, what can you&amp;nbsp;do?&lt;/p&gt;
&lt;p&gt;The typical non-developer way is to email them politely, spend a long hour thinking about what to write to explain your point of view, and ask them if they can consider incorporating your proposed change to the code which looks like&amp;nbsp;[attachment].&lt;/p&gt;
&lt;p&gt;The typical developer way is to fork their &lt;strong&gt;repository&lt;/strong&gt; and make a pull request (usually after dropping them a quick message to ask first). The repository is where they store their code, and this repository is managed by a &lt;a href="https://hackernoon.com/top-10-version-control-systems-4d314cf7adea"&gt;version control system (&lt;span class="caps"&gt;VCS&lt;/span&gt;)&lt;/a&gt;, typically&amp;nbsp;git.&lt;/p&gt;
&lt;h2&gt;Forking: making your own (copy of the)&amp;nbsp;world&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Forking&lt;/strong&gt;, simply speaking, is making a copy of their code. You need a complete copy of their code so that you can run the app and test the changes you make. It’s called a fork because it’s like coming to a fork in the path of coding. Now there are two paths: the original path, and the path you are about to&amp;nbsp;create.&lt;/p&gt;
&lt;p&gt;You could do it stealthily (just copy and paste!), but it’s best not to. Instead, &lt;a href="https://help.github.com/en/articles/fork-a-repo"&gt;you should do it through git&lt;/a&gt;. This informs the code owner that someone has forked their repository and is possibly working on changes to it. It also makes it easy for you to pull any subsequent changes the code owner has made to the code and merge it with your code automatically, so you can test your changes with the latest copy of the code. And more importantly, it allows git to help you with merging your code back into the main codepath (more on this&amp;nbsp;later).&lt;/p&gt;
&lt;p&gt;Forking somebody’s project is usually a compliment. It means you find their work interesting enough to want to fork it and work on&amp;nbsp;it!&lt;/p&gt;
&lt;h2&gt;Pull requests: joining the main codepath&amp;nbsp;again&lt;/h2&gt;
&lt;p&gt;It’s no fun just working on your own copy of the code. The best part is incorporating your changes back into the main codepath so others can enjoy your work&amp;nbsp;too.&lt;/p&gt;
&lt;p&gt;In git, this means &lt;strong&gt;merging&lt;/strong&gt;. When two codepaths are merged, git checks the commits of each codepath (see why version control is so important?), and automagically merges the commits into one path. In the process, it highlights any conflicts (when two commits change the same part of the code) which require human intervention—usually by the owner of the main&amp;nbsp;codepath.&lt;/p&gt;
&lt;p&gt;You know how much it drives you nuts when you arrange your stuff a certain way, and the person sharing your table rearranges it. Or when you are working on something and you have your tools set up a certain way, and someone else working on it with you changes the way things are&amp;nbsp;done.&lt;/p&gt;
&lt;p&gt;Git forking and merging allows contributions to take place in a saner and more controlled manner. But it does not eliminate the need for discussion and coordination; it just makes the collaboration much more sane and less&amp;nbsp;tedious.&lt;/p&gt;
&lt;h1&gt;Github: the social network + collaboration platform of&amp;nbsp;developers&lt;/h1&gt;
&lt;p&gt;Coordinating all this development work offline involves lots of emails and messages, and an online platform helps to ease that problem. Out of many such competing platforms, one particular platform has become the most talked-about: &lt;a href="https://github.com/about"&gt;Github&lt;/a&gt;, introduced in Issue&amp;nbsp;19.&lt;/p&gt;
&lt;p&gt;Github is like multiplayer git. It lets you create your own account, create your own projects (each one with its own git repository running on Github’s machines), lets you browse other people’s projects, comment on them, report issues and request features, and also fork their repository. Many developers use it to show the code they have been working on, to coordinate efforts for online projects, and to build code that is used around the&amp;nbsp;world.&lt;/p&gt;
&lt;p&gt;Why would developers want to do this, to make things for free and let others benefit from it and no cost? The history of open source development is interesting and important to the future of the Internet, but it’s far more than I can cover in one issue—perhaps I’ll do that in a future&amp;nbsp;season.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; In git, forking a repository creates a copy of it for you to work on. Merging a repository with the original combines the commits from both so that they become one repository again. Conflicts arising from commits from both codepaths that affect the same part of the code will need to be resolved manually. Developers do most of this forking and merging in Github, an online platform for working on and talking about&amp;nbsp;code.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I’ve simplified a &lt;em&gt;huge&lt;/em&gt; portion of how git works, which I think isn’t important to know about for laypeople, so as to focus on the key features of git and how it makes collaboration much saner for&amp;nbsp;developers.&lt;/p&gt;
&lt;p&gt;Do you use any online platforms for collaborating with others? If your work is primarily text-based and you would like a way to work on it more easily with people, Creating a git repository on Github is something you might want to try. It is a little less automated than Dropbox, but it gives you more control, especially when you need to roll back&amp;nbsp;changes.&lt;/p&gt;
&lt;p&gt;Sometimes, forking and merging can go bad.  For example, two codepaths could change parts of the same code so much that it is more effort than it is worth to combine the changes back again. Or sometime, legal issues stand in the way. In the next issue, I want to talk about one way that developers usually set things up to make it as easy as possible to edit code without breaking anything. It is called Continuous&amp;nbsp;Integration.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; Continuous Integration: how to not break software while working on&amp;nbsp;it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is/are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;li&gt;a good reason developers write code and give it away for free online? [Issue&amp;nbsp;21]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 20: Testing</title><link href="https://ngjunsiang.github.io/laymansguide/issue020.html" rel="alternate"></link><published>2019-04-27T08:00:00+08:00</published><updated>2019-04-27T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-04-27:/laymansguide/issue020.html</id><summary type="html">&lt;p&gt;Testing is the only way to know your app really works. Tests can be set up for the different parts of your app, from the basic building blocks to the main code and finally even the interface, including web&amp;nbsp;pages.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last issue, I introduced &lt;strong&gt;version control&lt;/strong&gt;, the idea that you can set things up in a way that lets you see the &lt;strong&gt;change history&lt;/strong&gt; of a document. This lets you undo changes which you later come to regret, and compare the document to a previous point in history. If you have a version control system (&lt;span class="caps"&gt;VCS&lt;/span&gt;) set up, you can commit changes to it and view a list of those changes&amp;nbsp;later.&lt;/p&gt;
&lt;p&gt;When one is just starting out in software development, one thing that often happens is this. You start writing code for an app-say, a todo list. You write code to set up a database, display a login and other stuff. You commit the changes to the code. You add core features: add/remove/update a todo item; commit. You come up with more ideas: subtasks, recurring items, tags, filters, and all that jazz. Commit, commit, commit. You now have a complete app with bells and whistles, but the code is a sprawling mess: when you finally test the app, there are strange bugs everywhere, the lists don&amp;#8217;t filter properly, and the database gets messier and&amp;nbsp;messier.&lt;/p&gt;
&lt;p&gt;Proper planning can make this more orderly to some extent, but it cannot eliminate one fact of programming: that there will always be bugs. And the only way to catch them is to test the&amp;nbsp;app.&lt;/p&gt;
&lt;h2&gt;Manual&amp;nbsp;testing&lt;/h2&gt;
&lt;p&gt;The most straightforward way is, of course, to get a human to test the app. This gets tiring quickly, for obvious reasons. Asking a human to repeatedly carry out a set of procedures to make sure the app returns the correct data is tedious … which makes it perfect for&amp;nbsp;automating!&lt;/p&gt;
&lt;p&gt;If you are testing an app manually, it is human nature to not want to run 200 tests by hand. This leads to people trying to keep the number of tests small, which leads to some bugs not being caught, or they try to go as long as possible without testing, which leads to bugs piling up. Furthermore, manual testing is just&amp;nbsp;slow.&lt;/p&gt;
&lt;p&gt;Being able to speed up the testing rate, and have something else do the testing for you, eliminates these problems and lets you focus on writing code rather than typing inputs and checking&amp;nbsp;outputs.&lt;/p&gt;
&lt;h2&gt;Web&amp;nbsp;testing&lt;/h2&gt;
&lt;p&gt;How exactly do you test a website? While there is no replacement (yet) for a human when it comes to judging look and feel, you can rely on software to get the functional parts tested. Software such as &lt;a href="https://www.seleniumhq.org/"&gt;Selenium&lt;/a&gt; have a built-in browser that is able to &lt;a href="https://buttondown.email/laymansguide/archive/a6941efd-86bf-4fd8-92c9-009fe14a8c2a"&gt;request webpages&lt;/a&gt; and check the webpage code to see if what is supposed to be there is actually&amp;nbsp;there.&lt;/p&gt;
&lt;p&gt;For example, after I perform a login, I should be in my Home screen, the main section should display a welcome, my avatar should be in the top right hand corner, etc. All of this can be tested for in the&amp;nbsp;code.&lt;/p&gt;
&lt;h2&gt;Test suites and automated&amp;nbsp;testing&lt;/h2&gt;
&lt;p&gt;So after we have a bunch of tests, what happens? Write code, run the &lt;strong&gt;test suite&lt;/strong&gt; (a collection of tests), check the result, and commit the code if the test passes. What happens when we have over 200 tests? Won’t that take a&amp;nbsp;while?&lt;/p&gt;
&lt;p&gt;Yeah it would, but why do you need to test parts of the app that haven’t changed? You can set up your testing so that the basic bits of code (units conversion, time conversion, data cleaning, …) have their own tests. Then the next layer, the main code (data management, login, setup, etc) each have their own tests. The complete app then has more tests. Each layer tests for bugs specific to its&amp;nbsp;level.&lt;/p&gt;
&lt;p&gt;Now you can just run the relevant tests when you change one small part of your code. Or not; you could set your tests up so that once you try to commit, the testing software detects which parts of the code has changed, runs tests for those parts, and only lets your commit through if it passes all the&amp;nbsp;tests.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Testing is the only way to know your app really works. Tests can be set up for the different parts of your app, from the basic building blocks to the main code and finally even the interface, including web&amp;nbsp;pages.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Yeah, almost nobody liked tests and exams in school, I know. But in software, testing is the only way to know your app &lt;em&gt;really&lt;/em&gt; works, and not just because you say/think it&amp;nbsp;does.&lt;/p&gt;
&lt;p&gt;Tests are one of those things that beginning programmers tend to neglect until they learn their first hard lessons. I can see there are many ways to apply it outside of programming, particularly in areas where lots of vetting is needed—vetting really is just human testing, isn’t it? When vetting relies on clear rules and has an outcome that you know in advance, you can think of it as a test. Wouldn’t it be nice if parts of that could be automated, so that you can focus on applying human&amp;nbsp;judgement?&lt;/p&gt;
&lt;p&gt;Last issue, I realised that the issues were taking me 1.5 hrs to write, which I think means I am cramming too much content. I promised to keep each issue short and digestible; they are now back to being 1 hour of writing. Again, if you do actually prefer longer issues, drop me an email and let me&amp;nbsp;know!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; Multiplayer git, and how git stops people from wanting to kill each&amp;nbsp;other&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 19: Version control and git</title><link href="https://ngjunsiang.github.io/laymansguide/issue019.html" rel="alternate"></link><published>2019-04-20T08:00:00+08:00</published><updated>2019-04-20T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-04-20:/laymansguide/issue019.html</id><summary type="html">&lt;p&gt;A &lt;strong&gt;version control system&lt;/strong&gt; (&lt;span class="caps"&gt;VCS&lt;/span&gt;) tracks changes to documents. Git is a version control system for source code. Keeping a change history enables a &lt;span class="caps"&gt;VCS&lt;/span&gt; to roll back code in a previous point in time. A change history can also be used in areas other than&amp;nbsp;coding.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Have you ever worked on a large document with a team of people before? If you have, did it go well? Did people get along and not get into conflict with each other over conflicting ideas or changes? If it did, please drop me an email and let me know! In my experience it is so frustrating and I have difficulty seeing how it can be done without some kind of standardised, automated process for keeping everyone&amp;nbsp;updated.&lt;/p&gt;
&lt;p&gt;In the past, when documents were still mostly managed manually (before the Internet happened), important documents used to be in a file for everyone to reference. Maybe there were multiple copies for VIPs. Whenever that document got updated, it had to have a &lt;strong&gt;change log&lt;/strong&gt; attached to say what had changed and when. You still see this sometimes today, in some reference documents, and in software updates. The idea behind being able to see the &lt;em&gt;history&lt;/em&gt; of a document—a record of how it has changed over time—is an idea that has survived and been passed down to each generation of makers. We often refer to such inherited ideas as wisdom, and the modern form of this idea is known as &lt;strong&gt;version control&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Version control in software&amp;nbsp;today&lt;/h2&gt;
&lt;p&gt;Some examples you may or may not be familiar&amp;nbsp;with:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Google Docs/Sheets/Slides has a line beside the document title, “All changes saved in Drive”. That is &lt;a href="https://support.google.com/docs/answer/190843?co=GENIE.Platform%3DDesktop&amp;amp;hl=en"&gt;a link that shows you the &lt;strong&gt;version history&lt;/strong&gt;&lt;/a&gt; (also known as &lt;strong&gt;change history&lt;/strong&gt;) of the&amp;nbsp;document.&lt;/li&gt;
&lt;li&gt;Microsoft Word &lt;a href="https://support.office.com/en-us/article/view-the-version-history-of-an-item-or-file-in-a-list-or-library-53262060-5092-424d-a50b-c798b0ec32b1"&gt;has something similar&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.dropbox.com/security/version-history-overview"&gt;Dropbox keeps a file version history&lt;/a&gt; (for 30 days on the free plan) so that you can recover deleted files, or restore a file to an earlier state. Each time you change a file inside Dropbox but keep the filename the same, the file version history is&amp;nbsp;updated.&lt;/li&gt;
&lt;li&gt;Wikipedia keeps a change history of every article, as well as the discussion page for that article. &lt;a href="https://en.wikipedia.org/w/index.php?title=Git&amp;amp;action=history"&gt;Here’s the change history of the Wikipedia page on Git&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This is version control simplified for the everyday person, and if you were already aware of these features, you might already have benefited from being able to roll back a document you accidentally overwrote, or undeleting something you thought you no longer&amp;nbsp;needed.&lt;/p&gt;
&lt;p&gt;But what about software, which often consists of more than one file? The addition of a significant feature may involve changes in more than one file, and those changes must be considered together to make any sense of it. How do programmers do&amp;nbsp;that?&lt;/p&gt;
&lt;h2&gt;Git: modern version&amp;nbsp;control&lt;/h2&gt;
&lt;p&gt;The modern-day tool which (almost) all developers have standardised on is called git, and it was &lt;a href="https://en.wikipedia.org/wiki/Git#History"&gt;made in 2005&lt;/a&gt;. Its name is Git, and it was written by Linus Torvalds, the same man who first began working on the Linux&amp;nbsp;kernel.&lt;/p&gt;
&lt;p&gt;Git tracks changes across &lt;em&gt;multiple files&lt;/em&gt;. For example, if you added a new About page to your project, it may involve adding a new file about.html (the actual content), updating app.py (to create a new route so people can access the &lt;span class="caps"&gt;URL&lt;/span&gt;), and adding a new line to the changelog (so other members of your team have an easy-to-read changelog). You inform the git server (we covered clients and servers in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue007.html"&gt;Issue 7&lt;/a&gt;) that you have changed those 3 files by creating a &lt;strong&gt;commit&lt;/strong&gt;. Git can prepare those commits for you, and they look like&amp;nbsp;this:&lt;/p&gt;
&lt;p&gt;&lt;img alt="A commit on Github" src="https://ngjunsiang.github.io/laymansguide/issue019_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;A git commit on Github. Yup, this newsletter is also a project on&amp;nbsp;Github.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;The screenshot above makes it look fancy, but a commit is really just a simple text file that records the changes of the&amp;nbsp;commit.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Issue&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;014&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;updates&lt;/span&gt;

&lt;span class="c1"&gt;--- a/season02/issue014/issue014.md&lt;/span&gt;
&lt;span class="o"&gt;+++&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;season02&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;issue014&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;issue014&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;md&lt;/span&gt;
&lt;span class="err"&gt;@@&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;57&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;57&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;@@&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Beyond&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;writing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;also&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;written&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;many&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;purposes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;outline&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;som&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Yes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;written&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;This&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;one&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;coolest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;uses&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;software&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;because&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;manually&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;searching&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;through&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;performing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;calculations&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tedious&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;computers&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;do&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;so&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;much&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;faster&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="k"&gt;System&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;administration&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sysadmin&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sure&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;group&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;servers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;remain&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;up&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;running&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;might&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;detail&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;kinds&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;trouble&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;up&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;once&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;have&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;enough&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;stories&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tell&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;but&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;think&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Rachel&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;rachelbythebay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tells&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;much&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;more&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;interesting&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;stories&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;those&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;albeit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lots&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;technical&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sysadmin&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sure&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;group&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;servers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;remain&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;up&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;running&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;might&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;detail&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;kinds&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;trouble&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;up&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;once&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;have&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;enough&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;stories&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tell&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;but&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;think&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Rachel tells much more interesting stories&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;rachelbythebay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;those&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;albeit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lots&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;technical&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sysadmin&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;might&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;have&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;write&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;automate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;processes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;troubleshoot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;manage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;many&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;reasons&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;They&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;work&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;primarily&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;because&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;most&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;system&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;administration&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;are&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;written&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;as&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;commandline&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;although&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sometimes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;user&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;interface&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;might&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;created&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;popular&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;easier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;use&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is a short snippet of a commit. It records some text before and after the change so it’s easy to place the change, and then records both the old version (prefixed with a -) and the new version (prefixed with a&amp;nbsp;+).&lt;/p&gt;
&lt;h2&gt;Version control&amp;nbsp;systems&lt;/h2&gt;
&lt;p&gt;So … if I want to see how the code looked at a particular point in time, I have to go through all the commits and mentally imagine the old version in my&amp;nbsp;head?&lt;/p&gt;
&lt;p&gt;Well, no. That’s what we have computers for :) Git (and any decent version control system really) can handle that for you to show you the code before/after the commit(s). It can also merge commits, roll back the code to a particular point in time (i.e. undo commits), and&amp;nbsp;more.&lt;/p&gt;
&lt;p&gt;If you’ve ever thought “hmm, when did this part change? I don’t remember it looking like this …”, a change history, coupled with the right tools, makes it easy for you to know when that happened. But that means setting up a &lt;span class="caps"&gt;VCS&lt;/span&gt; (such as git), which requires&amp;nbsp;maintenance.&lt;/p&gt;
&lt;p&gt;If you don’t want your code being online, git can be installed on your own computer, but the far more popular way that developers use it is in the cloud. And the most popular platform for code today is &lt;a href="https://github.com/about"&gt;Github&lt;/a&gt;. It’s so popular that Microsoft, realising just &lt;a href="https://github.com/Microsoft"&gt;how much of their code is on Github&lt;/a&gt;, decided &lt;a href="https://blogs.microsoft.com/blog/2018/06/04/microsoft-github-empowering-developers/"&gt;to buy Github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When you create a Github account, you get a repository that you can put your code in. This repository is managed by a git server that you can push commits to, and pull changes from. You get complete change history for your code that is uploaded (here’s the &lt;a href="https://github.com/ngjunsiang/laymansguide/commits/release"&gt;change history for this newsletter&lt;/a&gt;). You don’t have the same level of control you would over a git server that you run yourself, but it saves you much more time and&amp;nbsp;hassle.&lt;/p&gt;
&lt;h2&gt;Using a &lt;span class="caps"&gt;VCS&lt;/span&gt; for non-code&amp;nbsp;purposes&lt;/h2&gt;
&lt;p&gt;Your eyes are probably glazing over at this point—just another techie gushing about &lt;em&gt;one&lt;/em&gt; particular technology, right? Git may seem really cool for code, but it can’t be used for anything else … well actually it&amp;nbsp;can!&lt;/p&gt;
&lt;p&gt;People have tried to use git for writing academic papers. Here’s &lt;a href="https://medium.com/@rvprasad/a-git-workflow-for-writing-papers-in-latex-4cfb31be4b06"&gt;a workflow for writing papers in LaTeX&lt;/a&gt;. &lt;a href="https://sites.duke.edu/stochastically/2014/07/23/using-git-to-write-papers/"&gt;Here’s another one&lt;/a&gt;. &lt;a href="https://joebuhlig.com/writing-with-github/"&gt;Writers use it too&lt;/a&gt;. &lt;a href="https://medium.com/@dfosco/git-for-designers-856c434716e"&gt;So can designers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The cool part is not that they are all using git. Git works, but primarily for text-based mediums. But increasingly, people are seeing the value of a change history, and are trying to apply it in ways that make sense. Designers certainly are catching on. &lt;a href="https://versions.sympli.io/"&gt;Versions&lt;/a&gt; and &lt;a href="https://www.abstract.com/"&gt;Abstract&lt;/a&gt; are two platforms that try to apply the concept in a way that makes sense for&amp;nbsp;designers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A &lt;strong&gt;version control system&lt;/strong&gt; (&lt;span class="caps"&gt;VCS&lt;/span&gt;) tracks changes to documents. Git is a version control system for source code. Keeping a change history enables a &lt;span class="caps"&gt;VCS&lt;/span&gt; to roll back code in a previous point in time. A change history can also be used in areas other than&amp;nbsp;coding.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Phew! I thought this was going to be short, but I was sorely wrong. In fact, I’m not completely done with the issue on version control yet—I realised as I was writing that it would make more sense to talk about testing&amp;nbsp;first.&lt;/p&gt;
&lt;p&gt;This is the first big idea I’ve introduced this season: version control. Knowing about version control and not being able to introduce it into workflows that would really benefit from it is frustrating. If you use Google Docs, Dropbox, or anything that has simplified version control, and you’ve asked yourself questions that can actually be resolved by checking a change history, do try it out and get familiar with the&amp;nbsp;idea!&lt;/p&gt;
&lt;p&gt;How can version control improve the way you work? If you’ve got an idea for applying version control where no version control has boldly gone before, hit reply and let me know&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;To wrap up, I realised that this issue took me 1.5 hrs to write. That’s not what I promised when I started this newsletter, that each issue should be short and digestible and possible for me to write in an hour. I’ll look at how to further split up future issues to keep to this promise. If you do actually prefer longer issues, drop me an email and let me&amp;nbsp;know!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next few issues:&lt;/strong&gt; Testing, and how git stops people from wanting to kill each&amp;nbsp;other&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 18: Frameworks</title><link href="https://ngjunsiang.github.io/laymansguide/issue018.html" rel="alternate"></link><published>2019-04-13T08:00:00+08:00</published><updated>2019-04-13T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-04-13:/laymansguide/issue018.html</id><summary type="html">&lt;p&gt;While libraries make it easier to do the same thing in a programming language, a framework makes it easier to make a particular kind of app. Like libraries, frameworks are usually specific to a particular programming language, and can’t be used in another programming&amp;nbsp;language.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last issue, I introduced libraries, which are basically magic spells. You call them, they do advanced magic in the background, and return magical results to your code. Or they simplify complicated code, wrapping them up into functions that are easy to&amp;nbsp;call.&lt;/p&gt;
&lt;p&gt;All that is cool, but even with that magical aid, working on some projects can be complicated in &lt;em&gt;different&lt;/em&gt; ways. For example, if you are working on a web app (or website), you can end up with folders everywhere, and all kinds of &lt;span class="caps"&gt;HTML&lt;/span&gt; and &lt;span class="caps"&gt;CSS&lt;/span&gt; and javascript&amp;nbsp;files.&lt;/p&gt;
&lt;h2&gt;Web app folder structure&amp;nbsp;example&lt;/h2&gt;
&lt;p&gt;In a simple app, you &lt;em&gt;might&lt;/em&gt; start off with files like&amp;nbsp;this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;project
|   app.py
|   config.py
|   error.log
|   README.md
|
└───templates
|   |   error.html
|   |   main.html
|   |   settings.html
|   |   index.html
|   |   login.html
|
└───static
|   |   styles.css
|   |   app.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You have app.py which is the web app’s main logic, config.py which contains its settings, an error log you can check to figure out what’s wrong, and a &lt;span class="caps"&gt;README&lt;/span&gt; file for any new members of the&amp;nbsp;team.&lt;/p&gt;
&lt;p&gt;Then you have the template files, which contain the code that determines how the page looks. You have your basic splash page (index.html), the login page, the main app view, the user settings view, and a simple error view. These templates have sections that the app can fill in with the relevant information once it is retrieved from a &lt;a href="https://buttondown.email/laymansguide/archive/90aed74c-f7e7-47bb-94ba-f3c3e057e51e"&gt;backend&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, you have files which are used in exactly the same way by each&amp;nbsp;page. &lt;code&gt;styles.css&lt;/code&gt; describes the colours, margins and styling of all the page elements to make them look consistent,&amp;nbsp;while &lt;code&gt;app.js&lt;/code&gt; contains javascript code that is meant to be run in the user’s browser (for animations, simple utilities, and so&amp;nbsp;on).&lt;/p&gt;
&lt;h2&gt;Web app&amp;nbsp;features&lt;/h2&gt;
&lt;p&gt;Of course, the above files do not just sit around looking pretty. They contain code that does things. app.py will need code that takes a &lt;a href="https://buttondown.email/laymansguide/archive/a6941efd-86bf-4fd8-92c9-009fe14a8c2a"&gt;request&lt;/a&gt; and figures out what do do with it. If a &lt;a href="https://buttondown.email/laymansguide/archive/b36f0f43-e8f5-402d-8c6a-c2a28f5ff556"&gt;client&lt;/a&gt; sends a request&amp;nbsp;for &lt;code&gt;/api/annotations/bjPc2xyLTS6Gcu2WW2xtlg&lt;/code&gt;, &lt;code&gt;app.py&lt;/code&gt; needs to know how to digest that request, pull the relevant information from the backend of database, filter it into a presentable format, and then send it back as a &lt;a href="https://buttondown.email/laymansguide/archive/386cead6-8565-499a-9960-5a30ab291e5b"&gt;response&lt;/a&gt; to the&amp;nbsp;client.&lt;/p&gt;
&lt;p&gt;A professional web app developer is likely going to be writing similar code, over and over again, different content but similar logic for different customers … surely there’s a more efficient way to do&amp;nbsp;this?&lt;/p&gt;
&lt;h2&gt;Web&amp;nbsp;frameworks&lt;/h2&gt;
&lt;p&gt;If you are at all concerned with efficiency and productivity at work, you would no doubt have templates prepared for all kinds of situations: boilerplate email replies, forms, documents, all prepared and just waiting for some information to be filled in before they are&amp;nbsp;ready.&lt;/p&gt;
&lt;p&gt;It’s the same with app development! If a developer specialises in, say, retail apps, it takes some work but they can definitely put together a customisable set of files for any client that needs the usual online commerce&amp;nbsp;setup.&lt;/p&gt;
&lt;p&gt;A web framework makes all this easier by providing many of these standard pieces of code, and allowing a developer to just focus on the core parts of the app that change from project to&amp;nbsp;project.&lt;/p&gt;
&lt;h2&gt;Web frameworks tend to be&amp;nbsp;language-specific&lt;/h2&gt;
&lt;p&gt;Since web frameworks involve code, it should surprise you little that they tend to be written for a specific programming language. Some&amp;nbsp;examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python web frameworks: &lt;a href="https://www.djangoproject.com/"&gt;Django&lt;/a&gt;, &lt;a href="http://flask.pocoo.org/"&gt;Flask&lt;/a&gt;, &lt;a href="https://bottlepy.org/docs/dev/"&gt;Bottle&lt;/a&gt;,&amp;nbsp;…&lt;/li&gt;
&lt;li&gt;Ruby web frameworks: &lt;a href="https://hanamirb.org/"&gt;Hanami&lt;/a&gt;, &lt;a href="http://www.sinatrarb.com/"&gt;Sinatra&lt;/a&gt;, &lt;a href="http://scorchedrb.com/"&gt;Scorched&lt;/a&gt;,&amp;nbsp;…&lt;/li&gt;
&lt;li&gt;NodeJS web frameworks: &lt;a href="https://expressjs.com/"&gt;Express.js&lt;/a&gt;, &lt;a href="https://sailsjs.com/"&gt;Sails.js&lt;/a&gt;, &lt;a href="https://www.meteor.com/"&gt;Meteor&lt;/a&gt;,&amp;nbsp;…&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Whichever one you pick, it should make your job easier than doing everything from&amp;nbsp;scratch.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; While libraries make it easier to do the same thing in a programming language, a framework makes it easier to make a particular kind of app. Like libraries, frameworks are usually specific to a particular programming language, and can’t be used in another programming&amp;nbsp;language.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I have greatly simplified the idea of frameworks here, likely to the consternation of developers everywhere. The only thing I will say in my defense is: at least your potential customers now have a better idea of what you are doing for&amp;nbsp;them!&lt;/p&gt;
&lt;p&gt;Speaking of developers, we’re now getting deeper into the kind of work that developers do. Some work alone, but they usually work in teams. How does a development team build projects like this without getting in each others’ way, overwriting each others’ changes, and drawing boundary lines on the floor with marker? What do they use to ensure that everyone knows what is going&amp;nbsp;on?&lt;/p&gt;
&lt;p&gt;Next issue is going to be really&amp;nbsp;interesting!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; How do developers avoid code conflict? On version control and&amp;nbsp;more&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category><category term="app"></category></entry><entry><title>Issue 17: Libraries</title><link href="https://ngjunsiang.github.io/laymansguide/issue017.html" rel="alternate"></link><published>2019-04-06T08:00:00+08:00</published><updated>2019-04-06T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-04-06:/laymansguide/issue017.html</id><summary type="html">&lt;p&gt;Libraries make it easier to do the same thing in a programming language, or enable advanced functionality that wasn’t available previously. Libraries are usually specific to a particular programming language, and can’t be used in another programming&amp;nbsp;language.&lt;/p&gt;</summary><content type="html">&lt;p&gt;Welcome back! Last issue must have been exhausting to read, and I want this issue to be more readily digestible. So there’re only going to be two examples.&amp;nbsp;Promise.&lt;/p&gt;
&lt;p&gt;A shell script works really well when you just need to do things with folders, and run programs to work on files. But anything more advanced, such as &lt;a href="https://buttondown.email/laymansguide/archive/a6941efd-86bf-4fd8-92c9-009fe14a8c2a"&gt;making network requests&lt;/a&gt;, quickly gets tricky. Usually this is where the programmers start to whip out their favourite programming language. But&amp;nbsp;…&lt;/p&gt;
&lt;h2&gt;Low-level Sockets vs High-level&amp;nbsp;Requests&lt;/h2&gt;
&lt;p&gt;In python, crafting an &lt;span class="caps"&gt;HTTP&lt;/span&gt; request from scratch looks&amp;nbsp;like:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;socket&lt;/span&gt;

&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AF_INET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SOCK_STREAM&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                 
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;www.hypothes.is&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sendall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;GET /api/annotations/GqDxiuhpEeiMa6f5UN7ttA HTTP/1.1&lt;/span&gt;&lt;span class="se"&gt;\r\n\r\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;recv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4096&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;5 lines of code every time I want to get an annotation from Hypothes.is? That’s going to add up fast … I could wrap that code up into a function, and then it would be easier to just call that function in one line instead of&amp;nbsp;5.&lt;/p&gt;
&lt;p&gt;Carry that thought to its logical conclusion, and you get a&amp;nbsp;library.&lt;/p&gt;
&lt;p&gt;Creating an &lt;span class="caps"&gt;HTTP&lt;/span&gt; request with the &lt;a href="http://docs.python-requests.org/en/master/"&gt;Requests library&lt;/a&gt; be&amp;nbsp;like:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;https://www.hypothes.is/api/annotations/GqDxiuhpEeiMa6f5UN7ttA&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;A good library makes complicated things simpler, so you can focus on what you need to&amp;nbsp;do.&lt;/p&gt;
&lt;h2&gt;There’s a library for&amp;nbsp;it&lt;/h2&gt;
&lt;p&gt;Apple’s App Store slogan, “There’s an app for that”, is so famous that &lt;a href="https://trademark.trademarkia.com/theres-an-app-for-that-77980556.html"&gt;they actually trademarked it&lt;/a&gt;. So it is with programmers. For almost everything you want to do in the most commonly used programming languages, someone has created a library for it. If they haven’t, then it’s up to you to make&amp;nbsp;one.&lt;/p&gt;
&lt;p&gt;But sometimes, some projects are just way beyond your current level of knowledge. If you wanted to dabble in advanced machine learning(i.e. &lt;span class="caps"&gt;AI&lt;/span&gt;), one option is to go for a PhD … or tinker with &lt;a href="https://www.tensorflow.org/"&gt;Google’s TensorFlow platform&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;How do you do that in Python? You need the &lt;a href="https://www.tensorflow.org/install"&gt;TensorFlow Python library&lt;/a&gt;. And then you probably &lt;a href="https://www.tensorflow.org/tutorials"&gt;need some tutorials&lt;/a&gt; to get&amp;nbsp;started.&lt;/p&gt;
&lt;p&gt;If there isn’t a library available … you might as well get started on that&amp;nbsp;PhD.&lt;/p&gt;
&lt;p&gt;But TensorFlow only comes with a Python library. What if you don’t use Python, but use Ruby instead? Then your best hope is to petition Google for a Ruby library, or &lt;a href="https://medium.com/@Arafat./introducing-tensorflow-ruby-api-e77a477ff16e"&gt;hope someone else ports it for you&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Either way, it’s plain to see that without these advanced libraries, it would take much longer to get&amp;nbsp;started.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Libraries make it easier to do the same thing in a programming language, or enable advanced functionality that wasn’t available previously. Libraries are usually specific to a particular programming language, and can’t be used in another programming&amp;nbsp;language.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Okay, so it turned out I only wrote one example, and linked extensively to another one. This didn’t need to be complicated, and aside from the code I hope I didn’t lose you. Was this issue too difficult to grasp, or am I moving too fast? Drop me an email, I can adjust&amp;nbsp;:)&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt;&amp;nbsp;Frameworks&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those &amp;#8216;\r\n&amp;#8217;s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12,17]?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Yep, if you’re sharp-eyed you might have noticed the &amp;#8216;\r\n&amp;#8217;s in the socket example ;) All in good&amp;nbsp;time.&lt;/p&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 16: Shell scripts and automation</title><link href="https://ngjunsiang.github.io/laymansguide/issue016.html" rel="alternate"></link><published>2019-03-30T08:00:00+08:00</published><updated>2019-03-30T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-03-30:/laymansguide/issue016.html</id><summary type="html">&lt;p&gt;Everybody has a simpleton in their pocket, and maybe one at home on the desk. These simpletons are able to run sets of instructions that they are carrying. You can give them more sets of instructions, often obtained through a Store. Some of the really good instruction sets will cost some money, though. And almost none of them will get the simpleton to do exactly what you&amp;nbsp;want.&lt;/p&gt;</summary><content type="html">&lt;p&gt;So you just got back from a trip with lots of photos in your camera. You take the &lt;span class="caps"&gt;SD&lt;/span&gt; card out from the camera, put it in your laptop, open up the photos … and realise they all have the wrong white balance&amp;nbsp;set.&lt;/p&gt;
&lt;p&gt;Or if you’re like me, you spend the better part of an afternoon using your camera to ‘scan’ a textbook for later reference. That means you now have over 300 photos to crop separately (left and right pages), adjust levels (to make the image more like it was done with a scanner), and do other minor&amp;nbsp;corrections.&lt;/p&gt;
&lt;p&gt;You know your way around Photoshop (or &lt;span class="caps"&gt;GIMP&lt;/span&gt;), but no way you are going to do that by hand for a week or so—we’ve all got lives to get on with! But you spend half an hour googling, and can’t find any tools that can help you to get the job done quickly. (Okay, there’s XnView, but let’s just pretend that doesn’t exist for the purpose of this&amp;nbsp;issue.)&lt;/p&gt;
&lt;p&gt;You have just discovered the need for computerised batch&amp;nbsp;processing.&lt;/p&gt;
&lt;h2&gt;Converting an image in the command&amp;nbsp;line&lt;/h2&gt;
&lt;p&gt;Once you have found a command line program to help you edit an image (such as &lt;a href="https://imagemagick.org"&gt;imagemagick&lt;/a&gt;), you can do that scanning adjustment with a command&amp;nbsp;like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;convert DCIM0100.JPG -colorspace LinearGray -crop 1260x1800+160+240 -level 64,160 page001.png&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;We just covered command lines in the previous issue, and you don’t need to be able to reproduce this command, but I hope you are seeing &lt;a href=""&gt;the patterns mentioned in the last issue&lt;/a&gt; here. The&amp;nbsp;program &lt;code&gt;convert&lt;/code&gt; is being called with 3&amp;nbsp;options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-colorspace LinearGray&lt;/code&gt; converts the image to grayscale (you can probably just set this in the camera beforehand, but no harm being&amp;nbsp;sure)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-crop 1260x1800+160+240&lt;/code&gt; crops the image to a size of 1260x1800 starting 160 pixels from the left and 240 pixels from the&amp;nbsp;bottom.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;level 64,160&lt;/code&gt; basically increases the contrast of the image, making the text blacker, and the page&amp;nbsp;whiter.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The documentation for&amp;nbsp;Imagemagick’s &lt;code&gt;convert&lt;/code&gt; command &lt;a href="https://imagemagick.org/script/command-line-options.php"&gt;is available online&lt;/a&gt;, and I will get round to discussing image formats in a future season. This is as far as we’ll talk about images for&amp;nbsp;now.&lt;/p&gt;
&lt;p&gt;Great. Here’s a command that can open &lt;span class="caps"&gt;DCIM0100&lt;/span&gt;.&lt;span class="caps"&gt;JPG&lt;/span&gt;, do those operations to the image, and save it to the file page001.png. (I pre-pad numbers with 0 because many file browsers are still terrible at&amp;nbsp;sorting &lt;code&gt;2&lt;/code&gt; before &lt;code&gt;10&lt;/code&gt;, but can&amp;nbsp;sort &lt;code&gt;02&lt;/code&gt; before &lt;code&gt;10&lt;/code&gt; just&amp;nbsp;fine.)&lt;/p&gt;
&lt;p&gt;Do I have to copy-paste this command 300 times into the terminal while editing the filename each time? Of course not, that’s why we have computers in the first&amp;nbsp;place.&lt;/p&gt;
&lt;h2&gt;Making a batch file/shell&amp;nbsp;script&lt;/h2&gt;
&lt;p&gt;A batch file (Windows) or &lt;strong&gt;shell script&lt;/strong&gt; (Linux/Mac) is simply a file with a list of commands that the terminal will execute when the file/script is invoked. They can be one line, ten lines, a hundred lines, or more. They can be simple, or incredibly complex. They can simply start an application with a different set of options, or help you to update all the packages on your computer periodically and handle simple errors. If you opened the three links from the last issue, you would have seen some examples of what these scripts can&amp;nbsp;do.&lt;/p&gt;
&lt;p&gt;So how would I put that command into a shell script so that it can do the above for &lt;em&gt;all&lt;/em&gt; the images in a&amp;nbsp;folder?&lt;/p&gt;
&lt;p&gt;There are a number of things we need to figure out&amp;nbsp;first:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;How do we want to number the final output files? I’m just going to go with page001.png, page002.png, etc to keep things simple, but you can customise the filename in all kinds of&amp;nbsp;ways.&lt;/li&gt;
&lt;li&gt;The script needs a way to get the names of the original images as&amp;nbsp;well.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;My go-to terminal&amp;nbsp;is &lt;code&gt;bash&lt;/code&gt;, one of the default terminals in Linux. You may sometimes see terminals referred to as CLIs (&lt;strong&gt;c&lt;/strong&gt;ommand &lt;strong&gt;l&lt;/strong&gt;ine &lt;strong&gt;i&lt;/strong&gt;nterfaces), as opposed to GUIs (&lt;strong&gt;g&lt;/strong&gt;raphical &lt;strong&gt;u&lt;/strong&gt;ser &lt;strong&gt;i&lt;/strong&gt;nterfaces), but this can be done in Windows Command Prompt, Powershell, zsh, Mac Terminal, and just about any &lt;span class="caps"&gt;CLI&lt;/span&gt; that supports scripts. Each &lt;span class="caps"&gt;CLI&lt;/span&gt; has its own syntax and format of commands that will need to be learnt, but in this day and age it is not difficult to find help for that&amp;nbsp;online.&lt;/p&gt;
&lt;p&gt;In bash, this script would look&amp;nbsp;like:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;n=1
for file in *.JPG
do
  outputname=page$(printf %03d $n).png
  convert $file -colorspace LinearGray -crop 1260x1800+160+240 -level 64,160 $outputname.png
  n = n+1
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I promised not to make this newsletter technical, and I said this wouldn’t be a howto, but this is as far as I can go without programming. I’ll step you through what each part&amp;nbsp;does:&lt;/p&gt;
&lt;h2&gt;Simple Bash&amp;nbsp;programming&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JPG&lt;/span&gt;
&lt;span class="n"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Bash checks the current folder for files ending with .&lt;span class="caps"&gt;JPG&lt;/span&gt;. (Why is it written as *.&lt;span class="caps"&gt;JPG&lt;/span&gt;? We’ll revisit that in a future issue.) For each file found, it passes the filename to [command] and carries out the command. This command is able to access the filename using the&amp;nbsp;name &lt;code&gt;$file&lt;/code&gt;.  &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;n=1
...
n = n+1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is how I am creating a number counter that I can use to number the final output files sequentially. Mathematically this makes no sense (how&amp;nbsp;can &lt;code&gt;n&lt;/code&gt; be equal&amp;nbsp;to &lt;code&gt;n+1&lt;/code&gt;?), but in&amp;nbsp;programming, &lt;code&gt;n = n+1&lt;/code&gt; means “add 1 to the value&amp;nbsp;of &lt;code&gt;n&lt;/code&gt;, and assign the new value&amp;nbsp;to &lt;code&gt;n&lt;/code&gt;.”&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;outputname=page$(printf %03d $n).png
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;printf&lt;/code&gt; is a program that creates lines of text, and it can help format text in all kinds of useful&amp;nbsp;ways. &lt;code&gt;%03d&lt;/code&gt; describes the format I want: a &lt;strong&gt;3&lt;/strong&gt;-digit &lt;strong&gt;d&lt;/strong&gt;ecimal number, pre-padded with &lt;strong&gt;0&lt;/strong&gt;s. &lt;code&gt;printf %03d $n&lt;/code&gt; changes &lt;code&gt;1&lt;/code&gt; to &lt;code&gt;001&lt;/code&gt;, and will do this for each value&amp;nbsp;of &lt;code&gt;n&lt;/code&gt;.&amp;nbsp;So &lt;code&gt;page$(printf %03d $n).png&lt;/code&gt; helps me craft the&amp;nbsp;filename &lt;code&gt;page001.png&lt;/code&gt; and I can refer to it using the&amp;nbsp;name &lt;code&gt;$outputname&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Putting everything together&amp;nbsp;…&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;n=1
for file in *.JPG
do
  outputname=page$(printf %03d $n).png
  convert $file -colorspace LinearGray -crop 1260x1800+160+240 -level 64,160 $outputname.png
  n = n+1
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Name a&amp;nbsp;counter, &lt;code&gt;$n&lt;/code&gt;, and set its value as 1. For&amp;nbsp;each &lt;code&gt;$file&lt;/code&gt; ending with .&lt;span class="caps"&gt;JPG&lt;/span&gt;, calculate the result&amp;nbsp;of &lt;code&gt;printf %03d $n&lt;/code&gt;, insert it&amp;nbsp;into &lt;code&gt;page$(printf %03d $n).png&lt;/code&gt;, and name the result&amp;nbsp;as &lt;code&gt;$outputname&lt;/code&gt;. Carry out the conversion&amp;nbsp;on &lt;code&gt;$file&lt;/code&gt;, and save the result&amp;nbsp;to &lt;code&gt;$outputname&lt;/code&gt;. Increase the value&amp;nbsp;of &lt;code&gt;$n&lt;/code&gt; by&amp;nbsp;1.&lt;/p&gt;
&lt;h2&gt;Scripting: talking to a really really really dumb&amp;nbsp;thing&lt;/h2&gt;
&lt;p&gt;Was that exhausting to read? I bet. If you had to ask a simpleton to do something, you know you need to be explicit: “Go to the market, stall number #01-23, and buy two packs of chili paste, the orange kind with the circular symbol, 200g. Also buy 100g of dried shrimp. Put the chili paste packs into one plastic bag, and the shrimp in another plastic bag. If they can’t do that for any reason, write down what the stall owner says, and call me. If the stall is closed, come&amp;nbsp;home.”&lt;/p&gt;
&lt;p&gt;Programming is like that. A good programmer can take a difficult task, break it down into steps so simple that even a computer can understand, and figure out how to write the repetitive parts to make them easier to&amp;nbsp;say.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Everybody has a simpleton in their pocket, and maybe one at home on the desk. These simpletons are able to run sets of instructions that they are carrying. You can give them more sets of instructions, often obtained through a Store. Some of the really good instruction sets will cost some money, though. And almost none of them will get the simpleton to do exactly what you&amp;nbsp;want.&lt;/p&gt;
&lt;p&gt;The only way to do that is to learn how to write the instructions yourself. The ability to do so is what we call&amp;nbsp;Programming.&lt;/p&gt;
&lt;p&gt;A shell script is just a set of commands that a simpleton can carry&amp;nbsp;out.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Phew, this issue sure took a while! I knew I was going to have to write some code, and explain it for laypeople, and it wasn’t going to be enjoyable. I’m glad it’s over and I hope I won’t have to do that again in the later issues of this season. I’m still figuring out how to do it more&amp;nbsp;simply.&lt;/p&gt;
&lt;p&gt;Do let me know how you find this format? I don’t explain things line by line, but rather part by part, as that makes more sense to me. I also try to start from simple commands, and build them up into more complex cases. But doing that will result in a tutorial-length issue, so I compress where I can. If there’s anything I can do to make it easier for you, drop me an email&amp;nbsp;:)&lt;/p&gt;
&lt;p&gt;We took a short detour from looking at what sysadmins do, to see what a shell script is like. Lots of things that happen in a computer can be automated this way. But it has its limitations. Next issue, we’ll look at how programmers help each other make their jobs easier by writing programming&amp;nbsp;libraries.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next two issues:&lt;/strong&gt; Libraries,&amp;nbsp;Frameworks&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those ‘\r\n’s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12]?&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 15: Sysadmins and the command line</title><link href="https://ngjunsiang.github.io/laymansguide/issue015.html" rel="alternate"></link><published>2019-03-23T08:00:00+08:00</published><updated>2019-03-23T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-03-23:/laymansguide/issue015.html</id><summary type="html">&lt;p&gt;A command line is a way of giving commands to the computer in the form of text. An instruction consists of the name of the program to be run, and the options that it needs to use. Command lines provide a fallback mechanism when graphical interfaces break down, and are a much more remote-friendly&amp;nbsp;interface.&lt;/p&gt;</summary><content type="html">&lt;p&gt;If something’s not working correctly in your operating system, someone has to dig into the settings and configuration, figure out what’s wrong, and resolve the issue. If you have ever been in those shoes, you have been basically doing a sysadmin’s job. (Okay, put away those pitchforks you sysadmin purists and hear me out&amp;nbsp;…)&lt;/p&gt;
&lt;p&gt;Every system you have ever interacted with needs to run on a computer, usually hidden away somewhere: point-of-sale systems, advertising screens, email servers, print servers, web servers, … and these systems can start going awry too. Sysadmins, experienced or otherwise, are the ones who fix them. If this system has a screen and a place to plug in a keyboard, fine. But what if it&amp;nbsp;doesn’t?&lt;/p&gt;
&lt;p&gt;Before graphical interfaces and the mouse cursor came about, there was a primitive (but no less powerful) interface: the command&amp;nbsp;line.&lt;/p&gt;
&lt;h2&gt;The language of the command&amp;nbsp;line&lt;/h2&gt;
&lt;p&gt;A computer is just a box of chips waiting to do your bidding, and the command line is one way to give it commands (get the name now?) But of course, that means you’ll need to learn its&amp;nbsp;language.&lt;/p&gt;
&lt;p&gt;First, some names/terms. You may see the command line also referred to as a &lt;strong&gt;terminal&lt;/strong&gt; (Mac/Linux), command prompt (Windows), or shell (also Windows). The differences are technical, they all refer to that window with the pointer waiting for you to enter your&amp;nbsp;commands.&lt;/p&gt;
&lt;p&gt;What does a command look like? It can look as simple&amp;nbsp;as:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;touch image.iso&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;or as complex&amp;nbsp;as:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ffmpeg -i input -c:v libx264 -preset slow -crf 22 -x264-params keyint=123:min-keyint=20 -c:a copy output.mkv&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If for whatever reason you have to try to interpret what a command is doing, here’s the one thing all commands have in common: the first word is always the name of a program. The first line is calling the &lt;em&gt;touch&lt;/em&gt; program, the second line is calling the &lt;em&gt;ffmpeg&lt;/em&gt;&amp;nbsp;program.&lt;/p&gt;
&lt;p&gt;The second thing is that any word starting&amp;nbsp;with &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;--&lt;/code&gt;,&amp;nbsp;or &lt;code&gt;/&lt;/code&gt; (used by Windows) denote options. Like, you know when you go into an app’s settings and change stuff? This is how command lines do the same thing. If you don’t give any options to the command line program, it will use its defaults, just like any other&amp;nbsp;app.&lt;/p&gt;
&lt;p&gt;All other words which come after the first word are just options. So let’s try to interpret those two command&amp;nbsp;lines:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;touch image.iso&lt;/code&gt; → Tell the program &lt;em&gt;touch&lt;/em&gt; to do its thing to the&amp;nbsp;file &lt;code&gt;image.iso&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ffmpeg&lt;/code&gt; → Tell the program &lt;em&gt;ffmpeg&lt;/em&gt; …&lt;br /&gt;
&lt;code&gt;-i input&lt;/code&gt; → to use the &lt;strong&gt;i&lt;/strong&gt;nput&amp;nbsp;file &lt;code&gt;input&lt;/code&gt; …&lt;br /&gt;
&lt;code&gt;-c:v libx264&lt;/code&gt; → and use the &lt;strong&gt;v&lt;/strong&gt;ideo &lt;strong&gt;c&lt;/strong&gt;odec &lt;strong&gt;lib&lt;/strong&gt;rary&amp;nbsp;called &lt;code&gt;x264&lt;/code&gt; …&lt;br /&gt;
&lt;code&gt;-preset slow&lt;/code&gt; → and the &amp;#8220;slow&amp;#8221; preset …&lt;br /&gt;
&lt;code&gt;-crf 22&lt;/code&gt; → and use &lt;strong&gt;c&lt;/strong&gt;onstant &lt;strong&gt;r&lt;/strong&gt;ate &lt;strong&gt;f&lt;/strong&gt;actor 22 …&lt;br /&gt;
&lt;code&gt;-x264-params keyint=123:min-keyint=20 -c:a copy output.mkv&lt;/code&gt; → okay nevermind, I think you get the idea&amp;nbsp;😅&lt;/p&gt;
&lt;p&gt;It took me years of gradual exposure to various command line programs and their options to know what they can do, and I don’t expect (m)any of you to be heading down that path, but if you ever encounter a command line instruction, I hope it strikes less fear in you than it used to, because now you know how to read&amp;nbsp;it!&lt;/p&gt;
&lt;h2&gt;Why do people use command&amp;nbsp;lines?&lt;/h2&gt;
&lt;h3&gt;Fallback&amp;nbsp;mechanisms&lt;/h3&gt;
&lt;p&gt;Let me use an&amp;nbsp;analogy:&lt;/p&gt;
&lt;p&gt;When you go camping, you sleep in/on a sleeping bag (or air mattress, or hammock, or …) and not a bed, right? When the car breaks down and you don’t have a spare, you cycle or walk. When your school computer blocks you from using filesharing apps, you resort to emailing&amp;nbsp;yourself.&lt;/p&gt;
&lt;p&gt;When your usual powerful methods don’t work, you fall back to more primitive&amp;nbsp;methods.&lt;/p&gt;
&lt;p&gt;The command line is a fallback for graphical interfaces when they crash. If Windows encounters a problem while starting up (this process is known as &lt;strong&gt;booting up&lt;/strong&gt;, we’ll get to this in a future series on hardware), it usually tells you to get a technician to look at it. But in Linux, when the computer encounters a bootup problem, it drops you to a command line so you can at least try to fix the problem. Any time the graphical interface in Linux starts getting glitchy, you can always drop to a terminal (another name for command line, remember?) to figure out what’s wrong. If even the terminal is glitching up, something really bad is happening … (probably a video driver issue, but we haven’t gotten to troubleshooting&amp;nbsp;yet).&lt;/p&gt;
&lt;h3&gt;Remote&amp;nbsp;work&lt;/h3&gt;
&lt;p&gt;The really cool thing about a lot of developer work (including sysadmin work) is that you’re just manipulating text on a screen (after manipulating a lot of ideas in your head first). This is something you can do remotely, over the Internet! There is no reason you need to be physically present where the actual machine&amp;nbsp;is.&lt;/p&gt;
&lt;p&gt;Sysadmins of large systems often have to manage multiple servers that may be in another part of the building, or even spread across the world: remote management. A manager works with remote workers by telling them what to do over email/video call, a sysadmin tells her remote servers what to by sending them command line instructions, usually over an encrypted line, because you wouldn’t want these instructions intercepted by a malicious&amp;nbsp;person.&lt;/p&gt;
&lt;p&gt;Why don’t they do it through a graphical&amp;nbsp;interface?&lt;/p&gt;
&lt;p&gt;I don’t have any single primary reason, but if you ask developers why they prefer command lines, they’ll probably tell you something along the lines&amp;nbsp;of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;“Who’s going to make that graphical interface? No one, because it’s more work and we’d prefer command line&amp;nbsp;anyway.”&lt;/li&gt;
&lt;li&gt;“I can type commands faster than I can click a&amp;nbsp;mouse.”&lt;/li&gt;
&lt;li&gt;“Sending graphics over the internet takes a few thousand times the bandwidth it takes to send text. The lag is so bad, I’d rather use text&amp;nbsp;commands.”&lt;/li&gt;
&lt;li&gt;“What’s wrong with command&amp;nbsp;lines?”&lt;/li&gt;
&lt;li&gt;“You can save commands into a script file and run them. That makes our work insanely easier. No graphical interface&amp;nbsp;needed!”&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I guess it’s something that just has to be discovered through experience&amp;nbsp;;)&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A command line is a way of giving commands to the computer in the form of text. An instruction consists of the name of the program to be run, and the options that it needs to use. Command lines provide a fallback mechanism when graphical interfaces break down, and are a much more remote-friendly&amp;nbsp;interface.&lt;/p&gt;
&lt;p&gt;Phew, slightly over 1100 words! So this issue is about 40% shorter than the previous :) I know movies and dramas like to make hacker work look all mysterious-like and one popular way is to randomly show some hoodie guy hunched over a command line. May this issue make such things less scary and encourage more people to dabble in it, even if only a little&amp;nbsp;bit.&lt;/p&gt;
&lt;p&gt;I intentionally left the juciest bit for the last: “You can save commands into a script file and run them.” Amazingly few people know this! I suspect a big reason people get so jazzed up over &lt;span class="caps"&gt;AI&lt;/span&gt; is an ignorance that many of the use cases they imagine for &lt;span class="caps"&gt;AI&lt;/span&gt; can already be handled by sufficiently complex script&amp;nbsp;files.&lt;/p&gt;
&lt;p&gt;I’ll save my fingers the typing and let the Internet provide the stories of&amp;nbsp;automation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.businessinsider.sg/programmer-automates-his-job-2015-11/?r=UK"&gt;A programmer wrote scripts to secretly automate a lot of his job — and email his wife and make a latte (Business Insider)&lt;/a&gt;&lt;br/&gt;
Here’s an extreme (and not very nice) example, but look at all the things you can do with just the command line! (But do nicer things of&amp;nbsp;course.)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.reddit.com/r/learnpython/comments/8uwonh/what_are_some_of_the_most_common_things_you_can/"&gt;What are some of the most common things you can automate with python? Looking for ideas (Reddit)&lt;/a&gt;&lt;br/&gt;
More of what you might expect to be able to do in daily life. If you’ve been procrastinating on picking up Python because you can’t think of a project to do, try this thread for&amp;nbsp;ideas.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.reddit.com/r/sysadmin/comments/779vf5/automation_is_fun_do_you_have_any_stories/"&gt;Automation is fun. Do you have any stories? (Reddit)&lt;/a&gt;&lt;br/&gt;
A bragging-rights thread, I put this here because the original poster’s story really illustrates why sysadmins love command lines. Which is what this issue is about,&amp;nbsp;right?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I want to talk a little about how this automation is done in the next issue. Again, not a howto, just an explanation of what goes on. And hopefully it helps you see that you don’t actually need &lt;span class="caps"&gt;AI&lt;/span&gt; for many of the problems you&amp;nbsp;face.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next few issues:&lt;/strong&gt; Shell scripts and automation, Libraries,&amp;nbsp;Frameworks&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;booting up? [Issue&amp;nbsp;15]&lt;/li&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those ‘\r\n’s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12]?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(I know I’m taking a while to get to these. I’ll touch on specifications later in this series, but the rest will have to wait until we return to networking and the Internet again,&amp;nbsp;probably.)&lt;/p&gt;</content><category term="Season 02"></category></entry><entry><title>Issue 14: What do developers do?</title><link href="https://ngjunsiang.github.io/laymansguide/issue014.html" rel="alternate"></link><published>2019-03-16T08:00:00+08:00</published><updated>2019-03-16T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2019-03-16:/laymansguide/issue014.html</id><summary type="html"></summary><content type="html">&lt;p&gt;Last season, I used an app I was making to get into the differences between &lt;span class="caps"&gt;HTTP&lt;/span&gt; and &lt;span class="caps"&gt;HTTPS&lt;/span&gt;. It wrapped things up at a point I’m pretty happy with, left some questions unanswered (for now), and got me thinking what to cover next. I’ve thought about how best to cover the remaining topics, and I could well continue in the same thread, going on to say more (relevant and untechnical) things about networking and its technicalities, but from experience it gets dry and dreary very&amp;nbsp;quickly.&lt;/p&gt;
&lt;p&gt;One question I get pretty often is: “I’m interested in Computing, but where should I start? What should I do?” The first thing I tell them is not to learn programming, but to understand what developers do, because this is not obvious knowledge. So I’m going to try to build up your picture of computing first, before we get back to&amp;nbsp;networking.&lt;/p&gt;
&lt;p&gt;Season 2 is going to be about the work of developers: what they do, a bit of how they do it, and the cool things they get to play with. Yup, there are 13 issues worth of things to talk&amp;nbsp;about!&lt;/p&gt;
&lt;p&gt;Let’s start with the obvious: developers write code. They write code that runs all the services you use. The not-so-obvious part: not all code is the same. Just as the same letters can be used in different languages, the same keyboard can type code in different languages. The code serves different&amp;nbsp;purposes.&lt;/p&gt;
&lt;p&gt;Because code is so complex, and very very few people can really be proficient at every aspect of it, developers tend to specialise. And when they specialise, they label their specialties to make it easier for employers to understand what they do. I’d like to start us all off on the same page and get these terms out in this&amp;nbsp;issue.&lt;/p&gt;
&lt;h2&gt;A primer to&amp;nbsp;applications&lt;/h2&gt;
&lt;p&gt;When you open an app on your phone or laptop, what you see is not all there is. It’s like a customer service desk: there’s the front desk, the back-office, the storeroom, and behind all of that is the sprawling mass of how the company delivers value to you, its&amp;nbsp;customer.&lt;/p&gt;
&lt;p&gt;Likewise, what you see when the app opens is only the &lt;strong&gt;frontend&lt;/strong&gt;. You type data into the &lt;strong&gt;interface&lt;/strong&gt;. The &lt;strong&gt;application&lt;/strong&gt; processes some of that data, and sends some of it to the &lt;strong&gt;backend&lt;/strong&gt;, where it is processed further, or used to look up information, which gets returned to the&amp;nbsp;application.&lt;/p&gt;
&lt;h2&gt;Frontend, backend, and&amp;nbsp;application&lt;/h2&gt;
&lt;p&gt;The meat of frontend development is closely linked to user design. Frontend developers work closely with designers to understand how they are supposed to make the app look and behave. While default templates can make a webpage look slick and professional, it does not help an app differentiate itself. So frontend developers often code custom animations, button behaviour, and figure out ways to make an app do things out of the ordinary, among other&amp;nbsp;things.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Frontend developers write code in:&lt;/strong&gt; &lt;span class="caps"&gt;HTML&lt;/span&gt;, &lt;span class="caps"&gt;CSS&lt;/span&gt;, Javascript, &lt;span class="caps"&gt;PHP&lt;/span&gt;, &lt;span class="caps"&gt;ASP&lt;/span&gt;.net, and&amp;nbsp;more&lt;/p&gt;
&lt;p&gt;Backend development is hidden from the user, and so is primarily concerned with speed and stability. Many backend applications-server, database, custom software-run concurrently in the same system and must communicate to each other. Figuring out how to make everything work together harmoniously and bug-free is a full-time job, and the work of the backend&amp;nbsp;developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Backend developers write code in:&lt;/strong&gt; Java, C/C++, Ruby, Perl, Python, &lt;span class="caps"&gt;PHP&lt;/span&gt;, Javascript, Go, Rust, and&amp;nbsp;more&lt;/p&gt;
&lt;p&gt;Anytime there are two (or more) kinds of people, there is the potential for them to split into two tribes, each blaming the other for some way the system has gone wrong. This is where you need developers who are entrenched in both worlds, and are able to understand how the frontend and backend interact with each other to produce the final outcome. Developers that work in both frontend and backend in the course of their work are called &lt;strong&gt;full-stack developers&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;A “stack” is a way of thinking about applications that work together; as you go from frontend deeper into the backend, you are going down the stack. Complex applications can have more than 20 different services running concurrently, and a full-stack developer needs the skills to diagnose what is happening when something goes wrong &lt;em&gt;somewhere&lt;/em&gt; in the&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;&lt;img alt="A stack consisting of user interface, user interface plus interaction, server communication, and server" src="https://ngjunsiang.github.io/laymansguide/issue014_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;A web development stack, just one of many. From &lt;a href="https://medium.com/@edenvidal/the-rise-of-the-full-stack-designer-and-the-tools-he-uses-3daf015eb3fc"&gt;Eden Vital on Medium&lt;/a&gt;.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;Frontend, backend, and full-stack describe which part of the code a developer is working on. But the kind of application a development team is working on can vary widely depending on where it is being&amp;nbsp;used.&lt;/p&gt;
&lt;h2&gt;Applications&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Web applications&lt;/strong&gt; are primarily run in a browser, even if that browser is embedded in a mobile app or installed device. These applications primarily interface with a web browser and the internet. They are device-agnostic, which means they can technically run in any device that is able to connect to the internet and run a&amp;nbsp;browser.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Laptop/desktop applications&lt;/strong&gt; are run in an operating system (Windows, MacOS, Linux). They are typically &lt;span class="caps"&gt;OS&lt;/span&gt;-specific, although with the right tools a developemnt team can develop versions for multiple operating systems without adding too much complexity to the&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Mobile applications&lt;/strong&gt; have a bit less leeway as compared to laptop applications, due to the sandboxed nature of smartphones and other mobile platforms. That means mobile apps have fewer privileges and do not have access to many parts of your smartphone (which is why they keep asking you for&amp;nbsp;permissions).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Embedded applications&lt;/strong&gt; run on low-power devices, typically routers, home gadgets, and other devices that require access to the internet. Because of their limited speed, embedded developers have to be skilled at optimisation and low-level coding (explained further down in this&amp;nbsp;issue).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Game engines&lt;/strong&gt; run on &amp;#8230; well, any of the first three really. A game engine helps game developers to not have to worry about rendering 3D graphics, setting up a quest system, and inventory system, character behaviour, scripted events, cutscenes,&amp;nbsp;&amp;#8230;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Enterprise applications&lt;/strong&gt; are applications which are developed primarily for use by large corporations. It may be adapted from consumer apps (e.g. GMail), or from scratch (e.g. &lt;span class="caps"&gt;SAP&lt;/span&gt;).&lt;/p&gt;
&lt;h2&gt;Specialties&lt;/h2&gt;
&lt;p&gt;Beyond writing apps, code is also written for many other purposes. I outline some of them below, although people who write code for these purposes might not actually have “developer” in their job&amp;nbsp;title.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Data Science&lt;/strong&gt;
Yes, code can be written to process data! This is one of the coolest uses of software, because manually searching through data and performing calculations is tedious, and computers can do it so much&amp;nbsp;faster.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;System administration&lt;/strong&gt;
A sysadmin’s job is to make sure a server, or group of servers, remain up and running. I might detail the kinds of trouble a server can get up to once I have enough stories to tell, but I think &lt;a href="https://rachelbythebay.com/w/"&gt;Rachel tells much more interesting stories&lt;/a&gt; about those, albeit with lots of technical&amp;nbsp;detail.&lt;/p&gt;
&lt;p&gt;A sysadmin might have to write code to automate processes, to troubleshoot, to create new users, to manage files, and for many other reasons. They work primarily in the command line, because most system administration tools are written as commandline tools, although sometimes a user interface might be created to make a popular tool easier to&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Graphics&lt;/strong&gt;
Graphics engineers specialise in the art of rendering: turning data about a 3D object into an image. This work is very much mathematical, and needs to be performed quickly, because any lag in visual output is easily&amp;nbsp;noticed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Machine Learning&lt;/strong&gt;
What is currently also referred to as “&lt;span class="caps"&gt;AI&lt;/span&gt;”. Machine learning researchers try to come up with ways to spot patterns in data, and use those patterns for various purposes, such as classifying data, generating realistic images, predicting behaviour, or just for fun,&amp;nbsp;really.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cybersecurity&lt;/strong&gt;
A server is designed to give administrators and managers more privileges, and give users fewer privileges. Cybersecurity researchers figure out ways to make a server reveal more data than it should, to enable a user to do things they shouldn’t, or to downright gain access to a server they shouldn’t have access to. These are known as &lt;strong&gt;exploits&lt;/strong&gt;. They publish information about these exploits, in the hope that the software developers responsible for those software will fix those bugs and keep people&amp;nbsp;safe.&lt;/p&gt;
&lt;h2&gt;Levels of&amp;nbsp;programming&lt;/h2&gt;
&lt;p&gt;Some developers like to work “close to the metal”; they write &lt;strong&gt;low-level code&lt;/strong&gt;. They often have a deep understanding of the hardware they are working on and the algorithms that are being used, and are able to write code that is lean and efficient. They may be able to speed up a function by a few thousand times by rewriting it in low-level code! But this is tedious work to maintain, and can’t be done for an entire software project, so such code is often employed in strategic areas&amp;nbsp;only.&lt;/p&gt;
&lt;p&gt;To manage low-level code, developers write compilers, interpreters, and debuggers that compile or interpret high-level instructions and break them down into lower-level instructions that get run instead. This makes it possible to write high-level code&amp;nbsp;like &lt;code&gt;open('file.txt','r')&lt;/code&gt; and be able to open a text file without having to know all the low-level code required to make it happen. &lt;strong&gt;High-level code&lt;/strong&gt; is what most people learn when they learn programming, because it enables them to do cool things quickly without needing to understand all the intricate details; high-level code &lt;strong&gt;abstracts&lt;/strong&gt; away the detail of low-level code and handle it for the&amp;nbsp;developer.&lt;/p&gt;
&lt;p&gt;Low-level code and high-level code are not a classification; they are a sliding scale. You can place different programming languages on this scale to indicate what level of abstraction they work&amp;nbsp;at.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Programming languages arranged from low-level to high-level" src="https://ngjunsiang.github.io/laymansguide/issue014_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Some programming languages, arranged from low-level (left) to high-level (right). From &lt;a href="http://www.codecommit.com/blog/java/defining-high-mid-and-low-level-languages"&gt;codecommit.com&lt;/a&gt;&lt;/em&gt;    &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Issue summary: Developers can specialise in frontend, backend, or full-stack development. They write applications for more purposes than I can really count. Not all code is written for an application; some code is written for specialised purposes. And code can be written at different levels of abstraction. High-level code is easier to understand and write because it hides the details of how a computer operates, while low-level code is detailed and able to squeeze the most performance from a computer, but difficult to understand and&amp;nbsp;write.&lt;/p&gt;
&lt;p&gt;Phew! This was a long issue, and I apologise for that. Subsequently I am not going to be covering such a broad scope, although the tools I talk about could potentially be used in any of the above&amp;nbsp;areas.&lt;/p&gt;
&lt;p&gt;In the next issue, I want to talk about a tool that laypeople almost never encounter: the command line. Because humans have a tendency to believe that what they see is what others see, I think it is important for people to understand that most of computing doesn’t happen with a graphical interface. And although laymansguide will not teach you how to program, it will hopefully help you to stop fearing the command&amp;nbsp;line.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; System administration and the command&amp;nbsp;line.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a specification? [Issue&amp;nbsp;6,8]&lt;/li&gt;
&lt;li&gt;a cookie? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a cache? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;a &lt;span class="caps"&gt;CDN&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;Unicode? And what does it have to do with emoji? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;What are those ‘\r\n’s in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; request packet [Issue&amp;nbsp;12]?&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 02"></category><category term="app"></category></entry></feed>