Skip to content

TeachingKidsProgramming/TeachingKidsProgramming.Source.Java

Repository files navigation

TKP Source for Java

Welcome to the TKP Java API source repository.

If you are looking for the TKP Java 'teaching repo', it is found in a companion location here on GitHub. That repo contains a starter set (.jar) of .java files for teachers to use with students when teaching TKPJava. It also contains a set of customizations for Eclipse that are specifically designed to make the coding experience more fun for beginners.

This repository contains the TKP Java API source used to create and support the teaching repository. Here we've implemented a Logo-like library, which includes objects such as a Turtle, Tortoise and many more. We've also created documentation and examples specifically designed to be fun for kids ages 10-14 to learn to code. We welcome feedback, suggestions and pull requests!

Setup a local development environment

First create your own a repository fork. Then, follow the instructions below to get started on your preferred platform.

Mac OS X

Recent versions of Mac OS X come with git preinstalled. So the first step is to clone your fork. Open terminal then type the following:

mkdir -p ~/Documents/src
cd ~/Documents/src

Then clone the repository by typing the following command, you must replace **** with your own github user name.

git clone https://github.com/********/TeachingKidsProgramming.Source.Java.git

You may be prompted to install "command line developer tools". You can choose Get Xcode or Install. However, Get Xcode takes much longer, so I would recommend starting with a simple Install.

CommandLineTools.png

If you needed to install the command line tools you will have to run git clone again in order to actually clone the repository.

Next you will need java and eclipse. You may already have them, but this guide assumes you are installing from scratch. Let's use homebrew to get the tools we need.

First visit the homebrew page and follow the instructions there to install the brew command.

Next use this command to install Homebrew Cask:

brew install caskroom/cask/brew-cask

Now you can install Java:

brew cask install java

Now install eclipse for Java:

brew cask install eclipse-java

Eclipse can take a while to download, so be patient.

Now you can start eclipse, any easy way to do that is to launch it using spotlight:

  1. Press Cmd+Space
  2. Type ec
  3. Select eclipse

When eclipse launches, it will ask you where to put your workspace. The default is ~/Documents/workspace and this is fine.

Once eclipse finishes creating and loading the workspace, you can use the File menu to choose Import. Type maven in the filter box, and choose Existing Maven Projects. Click Next, then click Browse.... Navigate to Documents then src then select TeachkingKidsProgramming.Source.Java, and click Open. Now click Finish.

Now click the Workbench icon in the upper right corner.

Workbench.png

Next, do a quick test to see if everything is working:

  1. Press Cmd+Shift+T in eclipse to search the TKP project.

  2. Enter SimpleSquare in the search box.

  3. Choose the completed recipe

    completed

  4. Click Ok

  5. Right-click on public class SimpleSquare

  6. Choose Run As then Java Application

You should see the tortoise appear and draw a square:

Tortoise

Linux

These instructions apply to Ubuntu 14.10, and you may need to modify some commands to work on your distribution.

Ubuntu comes with a package manager and we will use it to install required applications as we go. First open a terminal then type the following:

mkdir -p ~/src
cd ~/src
sudo apt-get install -y git

Then clone the repository by typing the following command, you must replace **** with your own github user name.

git clone https://github.com/********/TeachingKidsProgramming.Source.Java.git

Now install java with these commands

sudo apt-get update
sudo apt-get install -y openjdk-8-jdk

Now install eclipse, visit eclipse.org using your browser. The website should be able to detect your operating system and provide you with links to the Linux distributions. Most likely you will want to install the 64-bit version of eclipse. Download it to the default download location (~/Downloads for Firefox).

Next type the following commands:

mkdir -p ~/apps
tar xzvf ~/Downloads/eclipse-java-luna-SR2-linux-gtk-x86_64.tar.gz -C ~/apps/
sudo ln -s ~/apps/eclipse/eclipse /usr/local/bin

Now you can start eclipse, an easy way to do that is to launch it using the terminal with this command:

eclipse &

When eclipse launches, it will ask you where to put your workspace. The default is ~/workspace and this is fine.

When eclipse finishes creating and launching the workspace use the File menu to choose Import. Type maven in the filter box, and choose Existing Maven Projects. Click Next, then click Browse.... Navigate to your home directory then src then select TeachkingKidsProgramming.Source.Java, and click Ok. Now click Finish.

Now click the Workbench icon in the lower center of the eclipse window:

Workbench

Next, perform a quick test to see that everything is working:

  1. Press Ctrl+Shift+T in eclipse to search the TKP project.

  2. Enter SimpleSquare in the search box.

  3. Choose the completed recipe

    completed

  4. Click Ok

  5. Right-click on public class SimpleSquare

  6. Choose Run As then Java Application

You should see the tortoise appear and draw a square:

Tortoise

Windows

First we will need to add a git package to windows. Go to the msysgit site and download the installer. Click Run when it completes. Agree to the UAC prompt then wizard will launch. You can accept the defaults for most pages, but choose Use Git from the Windows Command Prompt on the Adjusting your PATH environment page. On the next page, titled Configuring the line ending conversions choose Checkout as-is, commit as-is. Finish the wizard.

Next start a command prompt:

  1. Press Windows+R
  2. Type cmd
  3. Press Enter

Now enter the following commands:

mkdir Documents\src
cd Documents\src

Then clone the repository by typing the following command, you must replace **** with your own github user name.

git clone https://github.com/********/TeachingKidsProgramming.Source.Java.git

Next you will need java and eclipse. We will use ninite.com to install these packages. Click this link to get a custom package that will install java and eclipse. Run the package, accept the UAC prompt and ninite will install the tools.

Now start eclipse using the shortcut placed on the desktop. When eclipse launches, it will ask you where to put your workspace. The default is in workspace under your user profile and this is fine.

When eclipse finishes creating and launching the workspace use the File menu to choose Import. Type maven in the filter box, and choose Existing Maven Projects. Click Next, then click Browse.... Select Documents\src\TeachkingKidsProgramming.Source.Java, and click Ok. Now click Finish.

Now click the Workbench icon in the upper left corner of the eclipse window:

Workbench

  1. Press Ctrl+Shift+T in eclipse to search the TKP project.

  2. Enter SimpleSquare in the search box.

  3. Choose the completed recipe

    completed

  4. Click Ok

  5. Right-click on public class SimpleSquare

  6. Choose Run As then Java Application

You should see the tortoise appear and draw a square:

Tortoise