In Part 3 we’ll be going over all the applications and tools you need to get started. The following all assume a kinda clean Windows install.
Code Editor: Atom.io
Download and install Atom: https://atom.io/
What does it do? Its a text-editor with some added tools to syntax highlight code (amongst others) – makes typing code just a little easier. By far not the only one! Like I said in part 2 – theres passionate supporters of every editor out there. I am an Atom fan, but you dont need to be. Heck, if your on Linux, you could even join #vim-vs-emacs fights on Reddit
But whatever you do, DONT USE NANO! Ever! (;
Git command Line tools: Git-SCM
Download and install Git-SCM (Comes with MinGW): https://git-scm.com/
What does it do? GIT is a Version Control System. It helps you code in a way that has a history attached to it – working in any kind of team, or releasing a project as open source will see you working in git. Also, getting code from others, often involves a little git. There’s also a big developer community around Github, so make sure to sign up for a free account at Github too while you are at it.
Learning Git: Git Branch Game
As a gamer, i think you’ll appreciate getting some Git practise on : https://learngitbranching.js.org/
Support for JS on the console: NodeJS
NodeJS – Install this to get support for the NodeJS environment, and it also installs the Node Package Manager (npm) that is used for installing and managing other node components: https://nodejs.org/en/
PS: Make sure to grab NodeJS LTS Version (v8 at the time of writing) – the LTS versions are “Long term support” versions, ie stable, and will be maintained for a couple years. Makes your code work longer.
Browser: Chrome for the win
Yeah I know, its contentious – but Chrome just has the best developer console of them all. I won’t force you to use it as your daily driver against your will, but any specific debug exercises will be shown in Chrome, so easier to follow along.
Online Snippet tools: CodePen, JSFiddle, etc
These are tools that run online, and give you a one stop window to test a little html+css+js in a quick go fashion. I use it a LOT while developing user interfaces. The community around these also share some amazing work you can look at, learn from, and fork. (What’s a Fork? You’d know if you played the Git Game above (; lol)
Probably the most argued topic on the internet, after VIM vs Emac (No… that ones Part 3 (; – just wait!) is which language to start of learning.
When I got started, most of the actual work I had to do was web-based things at the time, so I had my earliest coding experience in PHP. Not as writing code though, just simple modifications to Joomla templates, that sort of thing. But I have to admit its been years since I had to look at any real PHP. Along with that there was a little frontend work (HTML mostly) but again, nothing advanced.
Then for a while I did server support for the folks at Novell, where most of the applications was some kind of Java running on a Tomcat server. Sadly here it was more engineering and implementations, than coding, so I won’t dare say Java had impact on my life. During those years though I had a lot more exposure to plain scripting. Yeah you know, those same Batch files you already know. And their cousins over in the Linux world, Bash Scripts.
Initially nothing more than sequencing a few repetitive commands/task to ease the laziness (:
Everything you say? Well… YES. And in many cases the SAME code runs on everything. Everything like what?
- Pretty packaged applications. There’s ELECTRON – an add-on to NodeJS that helps you pack the application into a nice installer that runs on Win/Mac/Linux (Same code, runs on all three OSs! Neat huh?)
Oh you said that hasnt convinced you yet? Lets try and find a few other reasons.
- Remember how in Part 1 I said LIBRARIES make your job easier? Well checkout the NPM (Node Package Manager) repository at NPNJS.COM – literally thousands of modules you can use in Node/Electron applications. Want a library to make a pretty user interface? Checkout MetroUI and Bootstrap. What about a couple plugins for the mobile world? Checkout CORDOVA PLUGINS. 3D Animations and WebGL, and WebVR etc? Nothing easier or better than ThreeJS
- What about Documentation? Checkout the Documentation links on the pages above! Projects like Cordova, Metro, ThreeJS, etc all SHINE at this!
- Need to ask for help? Stackoverflow man, its saved me so many times! Not only for asking questions, its a GOLDMINE for finding working example code!
- Is there life after JS? Yes of course. Basic development concepts we learn in JS (Whats a Variable, whats a function, whats a Class, whats an Object, how does Scopes work, how to Build, etc are all going to be transferrable to other languages! But right now its EASIER than any of the other languages. A forgotten semicolon wont break JS code (;
So, what do you think! Excited yet?
So recently a good friend of mine, approached me with the request: “Can you teach me to code?”
Of course I would, but I also struggled with where to find the time to do so (letting down the poor guy on more than one occasion!), it is after all a time consuming exercise, and for the next couple months, I’m low on free time (moving house and expecting a new baby). One other thing the lack of free time has been taking away from, has been putting up fresh content on this blog too (With the effect that my daily views has gone down by around 60% since two years ago).
Giving it all some thought, i figured, one way to invest what free time I have into both causes, might actually lead to a good idea. Instead of just teaching Marco, isn’t there maybe a way I can teach all of you? And in turn, some of you can help teach Marco too? (: Imagine that!
Knowing upfront this is going to lead to a LOT of articles, I guess a good place to kick this off is with a Part 1. And what better way to get this to gain some popularity than with a requisite clickbait-y title 😀
So what should Part 1 be? Well, when I started teaching myself to code 3 years ago – there were a couple things that stopped me from starting. If you have these barriers-to-entry stopping you from even trying, then whats the point in continuing this series? So – for part 1 – lets start off by addressing some of these Myths thats keeping you in the mindset of “I can’t code”
1. Its called CODE so it must be hard
Bullshit! It used to be code years ago, cryptic, hard to read, hard to write and hard to understand. These days, i think you’re better off thinking of it as plain old English, but with some basic rules of what goes where. It’s really not that hard! Its not cryptic. Anyone can, right now, figure out what a well-written piece of code does. Caveat here of course, some developers try to push their superiority complex on the world, by writing code in styles no one can figure out what they are doing. Stay away from those people, you don’t need that negativity in your life (; – the GOOD open source projects all have a relaxed coding style, where its easy to work with.
2. I’m going to have to write a tonne of code right?
Wrong! Over the last few decades, millions of wonderful people have gone and shared their work with the world. For MOST things you want to do, there is some kind of library/api/example code/documentation to work from. Most of your work is in bringing these things together. There is no shame in using Libraries to make your life easier! And believe me, they do make it easier!
3. Developers sit down, write a couple hundred lines of code, then (execute or compile) it and it just works! Mine doesnt!
Yeah, uhm, that not how it works. You look at someones code submission say on Github, and its a beautifully polished piece that works? Thats not how it started! Developers will never admit it, but they – just like you – often typed out a couple lines, run it, test it, debug it, add something on to it, make it do more, test again, find a problem, sit on the problem for hours trying to see why it doesnt work. Realise its a typo, fix it, test again. Rinse and repeat a few times, finally have the function doing exactly what they want. Then they sit down for a couple hours making it pretty, and adding nice comments. Thats the version they wrap up into nice Commit and send to Github. So no, you are no less than them, they just tend to hide the struggle and tell you you are stupid, to maintain that superiority complex
4. It’s called “Development” for a reason
This ones probably the biggest secret. That application you use daily: Its so smooth and finished and works so well right? Well, it didnt get that way from sitting down and writing it in one go.
The reality of development is that you start with something small, an idea, or a small existing piece of code. Then you DEVELOP the idea little by little until its great. It takes months sometimes and thats fine. Thats why they call it Development, its not done in one go, its a bunch of tiny little leaps!
So, most importantly, don’t feel bad at your little unpolished turd that finally compiles… keep at it, and in a few short months it too could be a diamond!
5. Other developers are so evil!
When you just get started, you might soon find yourself in a situation where you need to reach out to another developer (say the one who writes that Libary you want to use) – either to report an issue with their code, or to ask a question, or something like that. I bet you in just a few weeks you’ll come back and say something like “It’s useless, those guys just dont want to help! They were rude to me! etc”. Well, it’s empirically untrue. Developers DO want to help you become a developer too. But with Open Source software especially, those same developers face a lot of abuse from users. Because of that, most, if not all, has an automatical defensive response, until proven otherwise. You can get help, but how you ask for it, thats the secret. There is a LOOOONG document that is worth taking the time, to read from start to finish. It contains some of the BEST advice I’ve ever read in my life. Since I started reading it and practising it, i’ve been able to get absolute GOLD from developers the world sees as “evil”. Of course a little plain old friendliness, kindness and rallying up a couple donations toward their projects, also doesn’t hurt.
Head over to http://www.catb.org/esr/faqs/smart-questions.html to learn all about HOW to ask for help (:
So, I see the newest Raspbian comes preinstalled with RealVNC and in Headless mode, it doesnt bring up a desktop. Sigh, I got work to do, don’t have time to deal with forced-on-users commercial shit (Just a way to get you to buy RealVNC – F*ck you Eben)
So, lets get rid of it (:
First up, lets install TightVNC – XRDP doesn’t play nice if RealVNC is installed and has a dependency on TightVNC. Installing it, removes RealVNC for you (:
sudo apt install -y tightvncserver
Next, lets install XRDP – just makes it easier to use RDP (built into all OS’s) without having to install a VNC viewer on PCs you want to use to connect to the headless pi
sudo apt install -y xrdp
That’s it actually!
Fire up a RDP Client (start, run, mstsc) and connect to the IP of your Pi!