
Kids Coding: Simple Java - ingve
https://www.murrayc.com/permalink/2017/07/03/kids-coding-simple-java/
======
peterarmstrong
I wrote a book (free minimum price) to teach my son programming, starting in
Terminal, and using Ruby.

[https://leanpub.com/programmingforkids](https://leanpub.com/programmingforkids)

It's currently Mac-only, because of the `say` command, and so that I could
write instructions for just one platform. I have ideas about how I'm going to
fix that, but that won't be in the near future.

My son was about the same age when I started writing it, but the book scales
nicely for any 9-14 year old, I think. Please feel free to give your son a
copy, and let me know if it's helpful.

~~~
saghm
On Linux, there's `espeak`, which is essentially equivalent to `say` on Mac.

~~~
chadrs
Somehow I don't think he was too worried about 9-14 year olds using Linux.
Probably was mostly thinking about Windows.

~~~
pbhjpbhj
Your comment sound like you think Linux isn't appropriate for 9-14yos ...
could you explain, all major OS are pretty much equivalent for simple uses
AFAICT.

------
intoverflow2
Always feel when a software developer tries to teach coding to kids they seem
to more wrapped up in the process and doing things the "correct" way (often
over complicating things with typing, language nuance and command line
rituals) than actually trying to teach what's really going on and more
importantly empowering being able to step off and create something truly of
their own which is the path to self sufficient learning.

The self initiated work I've seen kids create out of Scratch is seriously
impressive and creative.

------
dajt
I'm trying to get my kids to play Human Resource Machine. I hate the name but
the game is okay. Because it's basically drag and drop assembly language the
amount of steps for the challenges quickly rises. That's a bit of a shame, but
the upside is it does sort of teach how a primitive computer would work at a
low level for a kid who was grabbed by it.

The blog author and a commenter make a good point about how back in the day
getting the computer to do just about anything was thrilling, whereas now
expectations are a lot higher but so is the knowledge and effort required to
make that happen.

Switching on a computer and getting nothing but a ready prompt somehow made it
easier (or more necessary?) to make your own fun.

~~~
eddieroger
Definitely necessary. I remember those days, and the realization that I
_could_ run an existing program, or I could sit and make my own, and the
latter was pretty appealing to me.

I picked up Human Resource Machine when it came to the Nintendo Switch a few
months ago, and I loved it pretty immediately. I think it does a great job of
abstracting out the fact that you're writing assembly, masked by their very
dark sense of humor (Little Inferno, anyone?). Whenever one of my friends
(other grown-ups, not even kids) say things similar to wishing they knew how
to program, I suggest they pick the game up and give it a try. It's like
jumping in the deep end, but does a good job of showing how to think like a
computer would think.

~~~
dajt
Yeah, it's more for grown-ups who don't know how to code. One of my sons is
doing pretty well but I'm keeping a few levels ahead to see what's coming and
I'm not sure he'll grok indirect addressing all that easily!

Another son is going through Swift Playgrounds and finding that easier to
understand. He couldn't get HRM at all but immediately understood what simple
functions were for in Playgrounds.

------
cryptos
I think Kotlin would be a much better language to learn programming. Kotlin
avoids much of the noise and is very readable.

The hello world example is symptomatic:

    
    
        public class Example {
            public static void main(String ...args) {
                System.out.println("Hell, World!");
            }
        }
    

vs

    
    
        fun main(args: Array<String>) {
            println("Hello, World!")
        }
    

Some more examples:

    
    
        // java
        for (Element element : collection)
    
        // kotlin
        for (element in collection)
    
        
        // java
        (OtherType) somehting;
    
        // kotlin
        somehting as OtherType
    
    
        // java
        a.equals(b);
    
        // kotlin
        a == b
      
    
        // java
        Color color = x < 5 ? Color.RED : Color.GREEN;
    
        // kotlin
        val color = if (x < 5) Color.RED else Color.GREEN
    

And some more like constructors just named "constructor", init blocks are name
"init", varargs are prefixed with "vararg", type checks with "is", ranges with
1..9, strings wicht embedded variables ...

~~~
lostcolony
Kotlin or not, I feel like Java is just the wrong choice. Even Kotlin, there's
a lot of noise to start with. What's a function? What's an Array? What's a
String? I have to either explain all those things, or handwave it as "magic;
ignore it for right now" to students. I would find that incredibly frustrating
as both a student, and a teacher.

I TAed an intro to CS class in Python for a number of years. I am rather
ambivalent toward Python as a developer, but as a first language to be taught
it worked pretty well. There are others, but having the minimum amount of
noise for some basic coding examples I think is incredibly helpful (though I
admit, I think I'm basically just saying "I think dynamically/optionally typed
scripting languages > statically, explicitly typed compiled languages for this
task").

~~~
rootlocus
I started with Pascal in school (6th grade I think). The book contained a few
lines of code and said: This is the smallest program possible: it does
nothing.

    
    
      program HelloWorld;
      begin
      end.
    

I was puzzled: why would you need to write something for it to do nothing? But
it becomes clear very easily: all programs need to have a special structure to
be correctly defined. This structure happens to be a block of code with a
name. And that explanation was enough to satisfy me for the moment. I turned a
few pages, and sure enough all examples had that structure with something else
inside. I was already feeling good with myself for being able to recognize
well structured programs.

------
vortico
Pretty nice "Processing via the command line" trick. The API at
[https://processing.org/reference/](https://processing.org/reference/) is much
more friendly than the Java API at
[https://docs.oracle.com/javase/7/docs/api/](https://docs.oracle.com/javase/7/docs/api/)

------
dgolds
In the system we have been working on at
[https://build.games](https://build.games) (an engineering platform for kids
to learn and make software) we have avoided git and complicated project
management systems carefully so far. Sometimes, to really appreciate some
tools, one has to live without them first

------
cutler
How to turn a kid off programming for life - choose Java as the teaching
language. This kid had already started with Python, which is the natural
choice for a first language, so why not just:

    
    
      import typing

~~~
spyrosg
I do not see Python as the natural choice for a first language. I've even had
adult colleagues squint when I tried to explain decorators, or objects and all
the self/static/class/method binding nonsense.

OOP in Python is something I really cannot like. I teach the language to
children and as soon as I get to objects (which is not avoidable in Python, as
many libraries and the language itself use objects) the number of concepts I
have to explain is too much and I get the dreaded blank stare. I haven't so
far found a short explanation that gives them a good enough grasp on objects
that they can start making their own.

Ideally I would like to have to explain few orthogonal concepts, as learning a
new concept in the abstract is hard and their mind has little patience for it,
and let them experiment as soon as possible. But experimentation needs the
minimum mastery required to combine the concepts and get some result. Pyhton's
objects tend to expose their functions+struct guts, which does not help.

And don't get me started on warts like the "global" keyword, which makes
simple scripts with global state and a few functions (a step into learning
functions and structured programming) a frustrating and buggy process. I still
cannot understand async/await enough to be comfortable with it, and if Armin
Ronacher doesn't either... Meanwhile, languages like Oz do concurrency, with
_actual_ parallelism, beautifully.

I'm starting to think Scheme and Smalltalk would be excellent beginner
languages. "Here's how to make an s-expr; these s-expr are applications, these
are definitions. Now go."

~~~
danpalmer
I disagree, I think Python is an excellent first language. While there are
many oddities, I think Python lets you ignore them, or defer them to later in
the learning process. Python can be pretty much as simple as you need it to
be, and I think that's important for teaching programming.

I would not expect to get to objects _properly_ (maybe things like list()) in
an introduction to programming course, I think you can get very far with just
functions and simple data types.

Then, once you do want to introduce objects, I think Python's class system can
be kept simple enough to begin with, and the parts that are inherently tricky
(like self) have equivalently tricky parts in most other languages anyway.

I think a course teaching programming that goes into async IO, needs to
discuss 'global' (something I've still used only twice in 5 years of Python),
talks about decorators, etc, is doing something seriously wrong.

I don't know a lot about Smalltalk, but Scheme is an interesting idea for a
first language. I think it could be a good first language, but I would be
concerned about what the next step is. Having learnt Python, there are lots of
next steps because it has a large and active ecosystem with plenty of
opportunities, I'm not sure Scheme has the same, and I feel learning a second
language, while Scheme might be good preparation, is not going to be
straightforward for someone who has only just learnt to code.

~~~
lostcolony
You can. Georgia Tech's intro to CS classes for non-engineers are both Python
(the engineering one is Matlab). Objects are introduced at the end, but as a
concept OO is largely deferred to the following class, in Java. GT actually
used to have the intro class be in Scheme, but switched it to Python a number
of years ago, which they've stayed with. I agree though, Scheme would be a
good language, but the impedance mismatch to get to more popular languages
would be higher (plus have students asking "who uses this?!" Being able to
reply "Google" tends to satisfy that question pretty well)

When I was there, at least, the focus was on basic programming concepts,
functions, variables, loops, recursion, conditionals, and library interaction
was largely imperative, more focused on successful execution than on the
organization of the code.

------
kazinator
Takes a Java programmer to over-complicate three lines of shell script:

    
    
      processingRun() {
          $HOME/processing/processing-java --sketch=$1 --run
      }
      alias processing-run=processingRun
    

How about just:

    
    
      processing-run()
      {
        ~/processing/processing-java --sketch="$1" --run
      }
    

I suppose things must be hyper-confusing when there is no "public class"
wrapping a "public static void main".

