Schools Should Teach Kids Scripting

Posted on 2017/03/05 at 11:34 pm

Cartoon Image of a school

Schools should teach kids scripting. When I say kids I am thinking of those old enough to be in grades 5-8. Forget actual programming (though one may argue scripting is programming) and get them into Bash. I say Bash because it's already installed on most major platforms with Microsoft finally coming around in Windows 10. One may ask why and the answer is simple. It is simple. There is no need to install compilers and there is no need to worry about includes or imports or whatever else others have cleverly implemented to create despair in a programmer. Not only that, it gets the core ideas of programming down. Sure, it isn't Object Oriented Programming (OOP) but that is a minor issue when we are talking about kids. The gist of programming is understanding iterations, functions, variables, assignment, general maths, and other bits and bobs. Once these are down, it is relatively easy to learn most languages. As an example of how easy it is to get started, I will show an example that prints to the terminal screen "Hello World!" and the current user that is logged in with a separate function for each: main and showUser.

Bash Example

#!/bin/bash

function main() {
    echo "Hello World!"; // Prints to the terminal Hello World.
    showUser;            // Calls showUser function
}

function showUser() {
    me=`whoami`;  // Runs a command and assigns the output to me
    echo $me;     // calls the variable me and prints to the terminal.
}
main; // Calls main function

When in a Linux environment this can be made more advanced with simple GUIs through zenity, yad, or dialog. I wont show an example for those but one should get the drift.

From the established core, one will then focus their attention on concepts like encapsulation, obfuscation, polymorphism, etc. Getting core concepts involving imperative statements and logical procedure is the hardest part. Having had my programming career start off this way makes me biased but it seems to me to be a more logical flow. Schools covering grades 9-12 should cover concepts of OOP by using Java which is a proper programming language. I advocate for Java because of its FX library and the tools that allow one to create full fledged programs. As case and point, let's look at how easy it is to create a window with a button. To see how easy it is I will use an analogy of a play being setup.

Java Example

import javafx.application.Application;  // The building where the play is
import javafx.stage.Stage;              // The stage in the building
import javafx.scene.Scene;              // The scene of the play. Ie, are we in a city, park, house
import javafx.scene.layout.AnchorPane;  // The confinement of the objects in the scene. Like a house or ally with walls.
import javafx.scene.control.Button;     // The actual objects of the play. Plants, pots, food, etc.

public class Main extends Application {
    @Override
    public void start(Stage stage) {
        // Define what is going to be in the scene
        AnchorPane pane = new AnchorPane();    // Create the confinement of where objects go.
        Button closeBttn = new Button("Close Stage Curtain");  // Create an object for our world. A button called Close Stage Curtain.

        pane.getChildren().add(closeBttn);            // Add to the confinement
        Scene scene = new Scene(pane, 800, 600);      // Determin what the scene is comprised of. Ie, dogs and cats with plants?

        stage.setTitle("The Phantome of the Opera");  // Tell the world what play we are seeing
        stage.setResizable(false);    // Limit the stage size to what size the scene says and no more or less
        stage.setScene(scene);        // Set our scene onto the stage
        stage.show();                 // Open the curtains

        closeBttn.setOnAction(e -> {
            stage.close();  // Close the stage curtain
        });
    }

    public static void main(String[] args) { launch(args); }
}

Excluding the fluff of importing the needed libraries and calling main, one can with nine to ten meaningful commands setup a window with a proper title and a button. Not only that, the button closes the window. Amazing! I also like using the play analogy because it gives the top to bottom logic of how Java operates to setup a window. In addition, Java uses HTML and CSS for styling windows. This is awesome because it adds another useful tool were one to get further along in learning all there is to know about tech.


To Top

To Bottom