## Newton’s Gravity as Coded by an 11yo Student

Sometimes what the students do at our school amazes me, but one app has always stuck out in my mind.  We have a 13yo student who I’ll call LN, who’s been with us since we opened.  When he was 11, he created this incredible app he calls Gravity Crash.  LN is a big fan of physics, and it happened that his Code Coach was too – and so some pretty amazing coding ensued.

LN’s game looks and plays like a standard billiards game (which in itself is already quite hard to code in Python).  But instead of hitting the cue ball, you create what he called “gravitational anomalies” (I guess he was a Start Trek TNG fan too!) that sucks the cue ball towards it (and orbits it, if placed correctly), using newtonian physics formulas.  What?!

Take a look here, and be sure to widen the game screen so you can see the entire billiard table.  You can also open Gravity Crash in a new window.

Newton’s Law of Universal Gravitation

So I want to point out that, even as a coder of 20 years, some of this would be mind-boggling for myself to write.  If you’re not a coder, just scroll through the code and you’ll be blown away.  If you’re a coder, check out how he handles collisions starting on line 171 (yep, granted, he needed some help on the vector and collision math!).  And if you’re a physicist, check out line 234, my favorite.  Break down the component parts, and [gasp!!], you have Newton’s Law of Universal Gravitation.  Let me sum that up for you, an 11 yo coded a pretty complex game in Python, and then decided to use Newtonian formulas to simulate gravity.   Niiiiiiice.

Now mind you, in our model, we have a Code Coach, directly mentoring our students – so building the app wasn’t completely unaided.  Moving the balls, collisions, even just setting up the triangle, requires some really good math knowledge.   But LN, again, an 11yo, understands how most of the code works, and coded a large part of it.  Think about how much coding AND math experience he gained coding this app.  Mind.  Blown.

via GIPHY

## Is there a conspiracy in the Tech Industry?

Learning to code, the fun way

This article from Ben Tarnoff at the Guardian is one of the sillier articles I’ve read in a while, so I felt compelled to blog about it.  Tarnoff argues that code.org, an amazing organization whose mission is to get more kids coding, is actually an instrument of the tech industry to create a larger supply of future coders – thus reducing the average coders’ salaries, thus making the tech companies richer.  Um…  WHAT?!

The implication that there’s some conspiracy theory underneath teaching kids to code is laughable.  While yes, more kids coding is bound to mean more adults coding in the future, it feels irresponsible to state that corporate greed is behind this.  The real benefits of kids and coding have nothing to do with company profits, and everything to do with a more effective and smarter future generation.

So what is “coding”?  Coding is not about memorizing a language.  Coding isn’t even about knowing any kind of technology.  It’s about a way of thinking.  For kids, it’s not about “knowing Java” – after all, Java or whatever other language may well become extinct in 10 years, knowing how fast tech moves. Coding’s about teaching a mindset of procedural, logical deduction and problem solving. Coding provides a tangible (and dare I say fun!) way to learn logical problem solving skills.  Now let me ask you – in what careers might you need problem solving skills?  Every. Single. One.

Tarnoff also notes that the median salary for a CS/IT job is more than twice the national average.  I’m no economics expert, but doesn’t that mean there’s a much greater demand for that skill set than the average job?  That you’re more likely to get a job, a higher income job, as a coder?  I know there are folks out there who are coders, who may be having a tough time finding a job.  But like any other skill, there are good coders and bad coders.  Remember that just because you can code doesn’t guarantee you a job, you have to still be GOOD at it.  And as emerging tech like AI, autonomous cars, and cyber-security gain prominence, make no mistake, these require advanced coding skills.  These guys aren’t just coding a couple of loops with arrays, they are programming some insane algorithmic logic that furthers the advancement of our world.  And I can guarantee you that anyone who can code these technologies will always have a job.  A pretty high paying one, at that.  I doubt even Dr. Evil could spawn a conspiracy to mass-produce brilliant advanced coders – those guys will always be highly paid, highly sought after talent.

So is coding for kids a grand scheme by the tech elite to save money?  Not a chance.  Should every kid learn to code, so they understand tech better, and have essential skills for any career (including CS)?  Absolutely.  To his credit, the author notes that every kid should have the opportunity to learn to code, and understanding how code works is essential for digital literacy.  That, I can agree with.  The rest of the article?  Somewhere between silly and irresponsible.

## A Brief History of Learning to Code

I recently ran across this super interesting blog from David Patterson over at UC Berkeley, written almost four years ago.  Take a look at the graph he and Ed Lazowska from U-Dub put together:

Credit to David Patterson

To add more color to that graph, Patterson notes that “At Stanford, where more than 90% of undergrads take computer science [note this was from 2013], English majors now take the same rigorous introductory CS course as Computer Science majors.”  I don’t remember my Intro to CS course as being all that easy, so kudos to those English and Philosophy and other majors that dove in!

The fact that the movement to learn computer science, no matter your major or your future, started so long ago shows this trend has legs.  What’s happened since the end of this graph?  Plenty.  An incredibly amazing amount, in fact.  Enough for anyone to feel a little FOMO on a hockey stick:

• codecademy and codeschool, both founded in 2011,  start the wave of online coding programs for adults (and kids!) to learn how to code.  Kahn Academy and others jump in the fray to get scalable and teach folks everywhere to code!
• Dev BootCamp is founded in 2012, pioneering a wave of adult “Coding Bootcamps”, crash courses for adults wanting to learn to code and find a job as a developer.  Others like Hack Reactor and Hackbright Academy soon follow, leading to a new industry for training and re-training adults.  (Sadly, Dev Bootcamp is soon closing its doors).
• Wide reaching organizations like Girls Who Code and code.org are founded in 2012 and 2013, respectively.  These organizations along with newcomers like CSforAll in 2016 have awesome reach around the country and the world in promoting the movement for kids to learn to code.
• Between 2013-2014, physical location coding schools like U-Code, MVCodeClub, Hackingtons, and our own theCoderSchool start the party with a focus on starting kids coding at a younger age, typically as early as 7 years old.  These physical-location businesses begin sprouting multiple locations, kicking off a wave of many other smaller but growing mom-and-pop coding schools around the country and the world.
• Kodable (2012), Hopscotch (2013), and a later comer in Scratch Jr. (2016) lead the way in iPad and iPhone apps that gamify and fun-ify learning to code for the even younger set (approx ages 4-9).
• In 2016, coding schools like us in Silicon Valley, the Ninjas in Houston, and iCode in Dallas begin franchising their concepts to speed expansion using proven systems of teaching.

Did I miss anything?  I’m sure I did, lots more platforms and companies have sprung up in the last 4 years to teach more people to code.  Where are we going?  The only direction is up, and more (is that a direction??).

In 5-10 years, I envision coding schools around the country and the world, one down the block from wherever you live.  Not unlike kung fu studios and tutoring centers, coding schools will find their way into the fabric of all our communities sooner than you think!  And just in time, because it’s high time we all learn a little more coding to support the tsunami of tech that’s coming.  In the final words of David Patterson’s blog from 2013, “Students from all fields want to learn computer science so they can change the world.”  A quote that stands the test of time, indeed.

Code on, friends!

## Learning to Code is Like Learning Music – Except When It Isn’t

Coding for kids is all the rage these days, but sometimes there’s an expectation that learning to code is scientific, rigorous, and static, but that’s far from the truth.  Coding isn’t about memorizing commands, or repetitive muscle memory, it’s about a way of thinking, a way to build something creatively using elements in your tool belt.  In that way, learning to code is more like learning music than learning math or science.

# Coding is Creative

Coders and Rockers

If you listen to rock songs closely these days, you might be surprised to learn that a large number of them are made up of the same basic 4 chords.  Yet to the untrained ear, those songs sound vastly different, because of the how the chords are played, the lyrics, the rhythm, and all the other creative elements that make up a song.  Coding is no different.  While you’ll have similar foundational elements like variables, loops, and even design patterns, how the rest of the app is pieced together requires plenty of creativity to bring out its identity.  Just like Journey’s Don’t Stop Believin is based on the same chords as the Beatle’s Let It Be, apps like Candy Crush use the same basic coding elements as a completely different application like Facebook.  But just like their musical counterparts, applications rely on the creativity of the developer and how the pieces are put together, more than the formulaic elements that form the core.

# Coding Has No Pre-Determined Path

Quick, who’s a better musician, Yo Yo Ma or Jimi Hendrix?  Miles Davis or Jay Z?  There’s no right answer (just awesome debates!), because they all play different kinds of music.  Coding is the same way – there’s basics for everyone to learn, but after that, should a student learn Websites?  Mobile apps?  Data Analytics?  Like musicians, coders often are exposed to a number of different styles (i.e., technologies) as they advance, in no particular order.  And when they’re advanced enough, they may dig deeper into one or another “style”.  At theCoderSchool we often use a tree as analogy to learning to code – every tree grows differently, but they’re all rooted in the same foundation.

# “Practice” Is Different – but Just as Important

When students practice music (or sports, or some forms of math and science), it’s really about repetition.  HOW to do something (“put your fingers here”, or “keep your elbow in when you shoot”, or “9 x 9 = 81”) is usually the easy part.  How to do it quickly and smoothly (“play A then G”, “keep your shooting form in the game”) is often what takes practice.  It’s the repetition that makes up the practice, which turns into muscle memory.

Coding is vastly different – it’s not muscle memory, it’s a way of thinking.  Unlike music or sports, figuring out HOW to do something (what code to write) is actually the hard part.  Once the code is written, repeating it for “practice” doesn’t make sense because it already works!  Typing it in again won’t make it work any better.  And the next app may be completely different. Instead, practice is about identifying and reusing patterns of logic, ways of solving a problem (sometimes known as “Design Patterns” in software-speak).  Each app built by a student is a new and different problem to solve, with potentially multiple solutions, so the more apps a student builds, the more practice they get thinking in a certain way.

For many students, this can be harder than you might think.  With music, tell a student where to put their fingers and they can go home and repeatedly play that chord until they know it by heart.  With coding, once a student solves one problem, they’re faced with the next, and often have trouble solving it without help until they’ve practiced solving the problems enough to be able to solve the next problem on their own.

# Coding’s like Music

While there’s a few differences, by and large I would argue that learning to code is much more like learning music or sports than it is like learning science or math.  The other big difference is that there’s a much bigger shortage of coders than there are of musicians or athletes.  So whatcha waiting for?  Let’s get coding.

# A Teen’s First Coding Language

Parents who want their teens to learn to code are often curious what coding language their kids should start with.  Python?  Java?  Scratch, Lisp, or something else?  There are a lot of options out there, but our experience tells us there are generally a few answers better than others.

First, let’s qualify the kind of students we’re talking about.  We’re not necessarily talking about kids 10 and under – for the most part, those kids should be using Scratch, Snap!, App Inventor, or other drag’n drop language.  We’re talking about slightly older kids, about 10 or 11 and up, that aren’t necessarily going to become a Computer Science major.  In other words, it’s most teens and pre-teens!  With that in mind, let’s get started.

# Part 1 – What Does it Mean to Learn to Code?

There’s a bit of a myth that learning to code is like learning a new language.  Yes, there are different coding languages, and yes, it’s all greek to a lot of folks who aren’t coders.  But unlike learning French or Mandarin, the most important aspect of coding is not the syntax.  It’s not about whether the word “computer” translates to “ordinateur” (French), or “dian nao” (Mandarin) – it’s about how you put those words into a sentence.  In coding, it’s about *how* you string “words” together, and not the words themselves.  In other words, it’s about the logic.

In that sense, it doesn’t matter so much whether your child is learning Python or Scratch, Javascript or Java, the logic is the same.  Computers in the end, work the same way – you must provide logical steps for them to understand.  Languages are simply different ways to give the same instructions to the computer.  By understanding the logic of coding a language – any language – the student is understanding the fundamental way to code, which can be fairly easily translated into ANY language in the future.

```###### THIS IS PYTHON
for x in range(1, 11):
print “Count is: “,x
```
```////// THIS IS JAVA
public static void main(String[] args){
for(int i=1; i<11; i++){
System.out.println
("Count is: " + i);
}
}
```

Python and Java Examples

Here’s an example of two languages that count from 1 to 10 – Python and Java.  The words are different, but the logic is the same – the “for” loops is a coding concept used in all languages.  This example shows how to count from 1 to 10 – and if you look closely, you’ll see that logically, they are both doing the same thing.  The logic thought process is the same – it’s just the words that are different.  Learn one, and it’s much easier to pick up the other.

# Part 2 -What About the Language?

Part 1 was admittedly a little over-simplified.  While it’s true it’s all about the logic, our experience shows there are some languages better suited as a beginner language.  Those languages – you might have guessed – really allow the students to focus on the *logic* of the code, and not on the nit-picky syntax of the language.

Before we go on, it’s interesting to note that there isn’t a “right answer” here, in fact you may find this is a bit of a philosophical two-sided coin.  Some folks (typically academia or hard-core comp sci) believe a more “hardcore language” like Lisp (for data structures or recursion concepts) or Java (for object oriented concepts) are better to learn early, as it helps cement fundamental computer science concepts.  Fundamental as in real core Comp Sci degree stuff, low level how-a-computer-works kind of stuff.  While there’s a good argument to that, we don’t think everyone needs to be a Comp Sci major, so we believe a step back to a common denominator makes the most sense.  A common denominator that’s useful for any career – plain old logic.

Try it Yourself
How would you write a “program” to print the Fibonacci number sequence, using plain English?  Congrats, you’re “coding”!

Speaking of plain old logic, there’s nothing wrong with a 15 year old starting to learn code with Scratch, Snap!, or any other drag and drop language.  In fact, one very powerful and even more basic way to learn is pure pseudo-code – basically logic written in plain English. While both are powerful ways to push the logic learning, in practice, we use these techniques more sparingly as kids get older because languages like Javascript and Python afford a closer experience to pure coding without hindering their learning at that age.  That said, even a 25 year coding veteran like myself still has a ton of fun, and lots to learn, when coding logic games and programs in Scratch!

So let’s go back to our example of the two languages from Part 1, above.  Notice how Python is alllllmost readable as english text.  For x (the variable) in a range of numbers, print “Count is 1”, “Count is 2” and so forth.  Pretty logical right?  Now what’s up with Java?  You’ve got a public function with an array of args, a System.out.println, a static void main…  Not the easiest to read is it?  A lot of typing to do the same thing, right?  While each of these are important concepts in understanding computer science, we feel instead these concepts become a distraction when learning to code (c’mon, admit it, it was distracting to you too, right?!)

We’re in the camp that feels that kids tend to learn better when they’re able to get things done quickly, build their confidence, and not be frustrated by distracting concepts early in their coding journey.  If they have the desire to dig deeper, it’ll always be there – but to start with a language like Java or Lisp, we’ve found, is typically more a hindrance than a help.  It’s something we’ve seen time and again at theCoderSchool, and has really become a part of our teaching philosophy.

So what camp do you fit in?  Either way, pick a language and let’s get our next generation ready!  Learn to Code.  Chang the World. ®