So you want to learn to code … - draft
2015 Nov 23For my friends who have been asked me how to learn to code
People think that computer science is the art of geniuses but the actual reality is the opposite, just many people doing things that build on each other, like a wall of mini stones.
Donald Knuth
from eloquent Javascript
First thing first
Forget everything you heard about coding and learning to code and get ready to make your mind up about it. I'm referring to the good hold "you need to have started when you were five or there is no point" utter nonsense.
If you are curious about the pedagogy of learning to code, check out victor Brent "learnable programming" essay, for an insight into how to evaluate the best resources out there and take charge of your learning.
Also consider this about the 20 hours learning, rather then the 3 years myth for mastering a new skill.
Learn anything in 20 hours
Key points are
- Deconstruct the skills - what you want to be able to do, and break it down into smaller and smaller pieces.
- Learn enough to self correct - using 3 to 5 resources on the subject. learning to notice when making a mistake and self correct. prioritising practice
- Remove practice barriers - distractions.
- Practice for at least 20 hour - to get over initial frustration barrier.
Knowing, what we don't know, figuring out limit of knowledge and work with that.
"The best way to learn math is to learn how to fail productively
"
figure out three critical things: what they know, the limits of what they know, and exactly what they do not know.
This increases
conceptual understanding—understanding what it means and possessing the ability to adapt the information
Of turtles and black boxes
- Learnable programming - The Turtle
- Graham first chapter of developing java software
- stanford CS106A - Programming Methodology - "Karel and Java"
Getting started - books and resources
Main books I'd recommend to get a digital or physical copy to have in your CS library, for short and long term are:
Books
C book
C for beginners, CS50 recommended text book
Optional, When you are comfortable on topics, you can then re-visit same topics on this more advanced book on C.
Developing Java software - Graham Roberts
First n chapters cover the 3 months intro to Java for UCL MSc and First year Bsc at UCL.
Following part is more relevant to software projects, covering testing, gathering requirements etc( which maps nicely to the Msc CS third term summer project )
In particularly the Java swing projects to make a desktop app can be quiet fun, and the GUI structure of swing is similar to most of the GUI structures in other languages,
For example event listeners are similar in the Dom for javacript and HTML browsers.
You can also integrate HTML with Java, which is interesting.
( this Java swing project is final project of gc02 msc CS coursework)
This is very similar curriculum to Stanford Java intro to programming ( on YouTube, if get tired of reading can watch this).
Unfortunately the book does not have syntax highlighting for code snipes but if you navigate to the website you can get the code used download it and open it in your text editor of choice ( atom is a good choice)
There's also a section on testing (explaining the different types) and TDD, worth doing a simple through away project to try that out, as that is how unit testing works in most languages. Increasingly you'll be asked to write something in TDD at non whiteboard interviews.( more as a sing you took your coding seriously)
Html/CSS visual book
JS visual book
Eloquent js
Online, skip chapter on life simulation.
Algo spirit of
Intro to algo
Other algo book used in interviews
Cracking coding interview
Book used to prep for interviews in tech companies.
Might feel daunting but what looks like gibberish now, in a year from now it will make sense.
I reckon getting it now because you could refer back to it as you go a long to see how what you learning as you going along is relevant for that level of competency, sort of like a checklist of things to cover.
Or if you prefer do as I did, get it a year for now and be pleasantly surprised.
Online courses
CS50
Full disclosure I am big fan of CS50, and especially if you are completely new I'd recommend starting with CS50.
It gives you quiet a lot of, much needed context, to ease into CS and the wonderful world of programming.
As you go along is a good idea to the problem sets, and perhaps setup a study group or meet up with some friends to compare solution and sustain motivation. Or you can always join the Facebook and redding group of people taking the course online which is quiet active.
If 2014 seems a bit cheasy American in style, 2013, is a bit more to the point, and still very much to the point with the right level of entertainment , seriously the production value is soo good is like watching a TV series.
[ short videos, lectures summary etc..]
Outline of course,
Scratch, C, quiet deep in C, php, etc..
Also Seminar videos archive good intro to other CS topics.
Code academy
As you go along, if you wanna test if you know something it's a good idea to find and do the corresponding code academy track.
Ie when you get started with HTML/CSS, if you do these tracks and they make sense and perhaps feel boring it's a good sign you are getting it otherwise it's time to rewind , revisit and consolidate.
w3 school
Great, with the interactive examples.
other
Get excited about open source,
Watch revolution Os doc, one and two.
- watch stalman talk to understand difference between free software as he intended and open source.
It's an interesting one to be aware for it's own sake.
The strategy
As you know I've been through a boot camp, done an Msc CS conversion course at UCL and so here is my suggestion to I would go about if I had to do it all over:
Start with CS50,
It's a fairly gentle intro with scratch, which by removing the syntax with the visual blocks allows you concentrate on familiarising and getting your head a round conditions, control flow etc..
If you think "this is easy I'll skip it" which was my initial thought at the time, suspend judgement and just give it a try, if it is easier you'll tick that box more quickly and move on the next thing, but I'd advise to look at other people's code on scratch.
Make your own easy project, something like it be good to have a cat and mouse style game with a shark eating a diver ( link to mine) or someone else you don't quiet know how to do but think it be cool to try.
Then do a medium one, and if you feel like a hard one, worth trying writing a program that uses threading( threading in scratch).
Then from scratch cs50 introduces C, through the parallels between the two even C feels like it makes more sense.
This is a good time to mention another key consideration of this strategy, learn the evergreens.
Evergreens,like learning C will make it easier to learn C based languages, and learning something like Python, Ruby, JavaScript , Java or Php will make more sense.
Chances are that if you are using a Mac or a Unix based Linux system, your operating system is built in C [ link ]
C is lower level then Ruby and other languages mentioned above, which you need to do things like managing memory and etc.. Which in itself is not probably something you are going to want to use for most of your projects but it gives you a great insight into the working of a programming language and of your computer.
Technology changes at a crazy fast rate, but if you look more closes the underlying principles are not evolving quiet as fast, and that, is what I would bet on, identify and learn the evergreen.
For example you learn C you get an insight into how your computer works, the "thinking" a round how things are setup, and familiarising with C like syntax makes you enjoy higher level languages as things becomes easier to do.
Another good example is learning the terminal. To navigate between folders, move files, delete etc.. Bash, and bash scripting might seem daunting now but can be great in speeding up and automating repetitive task( for example in deployment and or testing, further down the line)
Last example is HTTP requests,
( guy talking about http as resources rather then pages)
If you learn them for their own sake ( http page in CS group) Then you'd find API calls and AJAx requests make a lot more sense, regardless of the syntax of the language being used.
Some people prefer to start with Ruby or Python or javascript type languages and dive into object oriented languages, which is the equivalent of a sugar rush because you feel like you can get up to speed to get things done more quickly,such as running simple scripts, scraping or web development.
But I think this approach, starting from C,will also set you up to be more language agnostic and full stack, which seems to be an increasing trend where things are going.
[what does that mean? Right tool for right job]
And don't worry you will get to those higher level languages, but taking a slightly longer more solid route, will pay off on the long run, when you want stretch them to do things they are not immediately obvious.
For example recently I wanted to cut a video, file with Ruby within a Ruby on Rails application and the gems that wrap ffmpeg where not quiet right, with the methods I needed to do a trim.
So once I figured out how you run the command I want from terminal with ffmpeg, I then worked out how to make a system call within Ruby (which simply means running a terminal command from the Ruby language to the underlying operating system) with a bit of string interpolation and that worked like a charm. I would have not thought of that if I stayed on the high level of abstraction of Ruby and thought that the C based library ffmpeg was behind my reach without the right wrapper ruby gem.
Then cs50 dives into the working of w computer while introducing more advanced features in C, such as pointers and pointers arithmetic.
Cs50 eventually introduces php, Which is where we can start to play a round with the web.
Now php is an horrible bloated language
( initially personal page then different acronyms) but none the less if you suspend judgement and embrace it, making a simple web app in php with no framework , perhaps even connecting to a MySQL database is a good time to learn about the inner workings
Of web apps a granularity that requires pretty much everything from scratch, login, security connection to db etc. this set you up to give you a much better appreciation of web frameworks such as Ruby on Rails, django, laravel php etc..
( Lynda.com php and sql)
( this is equivalent to CompGC06 coursework for UCL msc.
Again this is an evergreen, frameworks come and go, but server and client side web apps stay the same.
[bonus point Learn about what is a server. And how you would make a simple one from scratch - Dave malland YouTube videos ]
Now, re-factor this into object oriented php, ( Lynda.com course )
This is also a good time to ad some client side interactivity with JavaScript.
Playing a round with event listeners etc..
This is also a great time to learn about version control and Git/ GitHub.
Force yourself to use it from terminal , perhaps ignore branches to begin with.
Read the documentation.
Both for git and php great time to familiarise with reading and understanding documentations.
Make small through away projects to test what you are learning, narrow it down to specific things you want to learn or see if you understood. Then can iterate and expand on it.
And keep log notes.
Approach to app design, sketches and requirement gathering + object oriented analyses and design ( described by Graham)
Another evergreen arrays and loop
- nested arrays and nested loops.