I think it's safe to say that dads (and moms) the world over have at some point in their child's homework life, encountered the 'I still don't get it!' defeatist statement.
Whether you're a nomadic herdsman from the arctic tundra or a city dweller; this universal statement is almost always followed by the dreaded slumped shoulders and facial expression of you are more than welcome to complete the assignment if you want, but as for me; I'm done!
When recently faced with such a predicament; whilst introducing my 11-year-old daughter to software programming; my initial thought was that of flight in order to fight another day! But, surprisingly I chose to stand my ground and radically rethink my rules of engagement.
Firstly; I was trying to introduce her to a potentially complex subject and way of thinking, with little to no points of reference. What I needed was not only a stronger hook but more engaging material.
Maybe I could tell more jokes? As that always makes her laugh (or was that cringe?). However, I felt as though something was still missing; until I had a lightbulb moment! What I also needed was a captivating analogy.
What now follows is the result of my epiphany and a transcript of my attempts to introduce my daughter to software development, it's concepts, programming languages and with a bit of luck; her first executed program.
Do you Have the Right Tool?
Hey!? Fancy termites for dinner? No? How about raiding the local ant nest out back, to see what's on the menu?
Look, don't knock it; as National Geographic tells me those little dudes can be rich in protein, calcium, iron and low in carbs! I guess once you get past the gritty taste; it's all good!
Still not convinced? Maybe seafood is more your thing? So; how about mussels, crabs or even a sea urchin? (Feel free to look that last one up; as I know I did!)
You are right; let's just keep it simple, how about cracked nuts washed down with some fresh water from the local ravine?
Let's say for a moment you were happy to dine on termites, ants or in fact sea urchins. Have you given it any thought as to how you would catch them and if or when you do; what would you use to eat them?
Can you see where I'm going with this? No? Well take a look at the following clips and if you make the connection; you get to teach me for the remaining hour!
You guessed it! You'll need a tool of some description. In fact; depending on what you are trying to catch would, in fact, determine the type of tool or tools you use.
You can be forgiven for thinking that you are now taking an Ethology course, but using the above analogies; I would like you to think of technology; in particular; programming languages, as nothing more than a tool.
Remember, as we have seen in the above examples the type of tool used is always governed by the problem being solved.
So, being the humans that we are; our fruits and nuts tend to be larger, thus, requiring the right tool (programming language) for the job.
- Building a Mars Rover? Then you might need to use the C or Java or Python programming tools.
- Trying to jump start your very own "I'll be back" Terminator robot? Then maybe you need to be getting your C/C++ or Java programming toolkit groove on!
- Or, you're more of the 'keep it simple' type and you just need a static web page to showcase your toothpick holder collection? Then HTML and a splash of Javascript should do the trick.
Was it just me, or does Java keep on popping up? It's a good thing; as Java shall be our companion as we embark on this wondrous adventure together.
So, back to the lesson and the objectives I would need you to learn; in order for me to get my World's Best Dad award! So; I would need you to help me, to help you, help me - if you get my meaning?
- We're going to look at the programming tool kit's environment; better known as an IDE (Integrated Development Environment).
- Then we are going to setup your very own IDE, to be used for future Java programming examples.
- Assuming you are still awake; I'll have you code and execute your first Hello World Java program in your new shiny IDE.
I'm confident in my teaching ability; that once you've mastered the above; not only will you be able to write the software required for the first manned mission to mars, but you will also find Mark Watney during your travels and bring him home before your supper gets cold!
Right; let's get busy!
Integrated Development Environments (IDEs)
If you watch the Focussed Capuchin clip again you will notice that he (or she - hard to tell) is making use of two key tools;
- The hammer and
- An anvil in order to crack that nut.
I know what you're thinking; why did they not set up shop in the dirt patch in the background, by the tree in the center of the clip? Because it would have been the wrong environment for that particular nut cracking task.
Think of IDEs in the exact same way; they provide you (the developer or programmer; dependant on your job title at any given point in your career) with an environment and an array of support tools in order for you to focus on the task at hand or the problem you need to solve.
IDEs are generally a single program within which all of the development work takes place. Typical features provided within the environment are authoring, modifying, compiling, deploying and debugging your code.
Please don't worry if you are unfamiliar with the above IDE terms; as they will be discussed in detail in future homework sessions. Yeaahh!
IDEs can also fall into the following two categories :-
- Desktop
- Cloud
As we now find ourselves living in the 21st century and every other question seems to have the word cloud firmly embedded; you guessed it; we shall be using a cloud based IDE.
If unclear as to what a cloud actually looks likes; please see following link.
There are a number of cloud IDEs currently available; so ultimately like with most things in today's world; you are spoilt for choice. However, for the purpose of today's activity, we shall be proceeding with Codeanywhere Cloud IDE; which has the following cool features :-
- Amazing code editor supporting 75 programming language syntaxes.
- Flexible cloud storage enabling you to connect to your code where it is; FTP, SFTP, Dropbox or Google Drive.
- Built-in terminal console to run any command or even connect to remote servers (using SSH).
- Version control to keep track of every one of your saves.
- Collaborate with other classmates and program together in real time on the same screen!
- Initial free package to get you started.
- Also, payment plans for schools; so be sure to get your teacher hooked too!
Wow! Or is it just me?
Anyway, I sense a force in you I do and as this force awakens within you, and you start to become one with your Jedi programming skills; which in turn transcends you from apprentice to master (or daughter to father). Only then will you be free to choose your own IDE; but, for now, Codeanywhere is our chosen path!
Codeanywhere (Cloud IDE) - Activity
Let's spend some time getting our environment setup, but don't worry; as I'll walk you through the tricky bits.
Step 1: Registration
- Make your way to Codeanywhere.
- Click on the Signup button and follow the registration instructions.
Step 2: Java Environment & Container Creation
- It's now time to select your tools.
- As we shall be programming in Java, search for the relevant stack (toolkit). You will be presented with two options; be sure to select the Ubuntu operating system.
- Click the create button to get the party started!
- Once created, you now have a fully functional environment ready for some serious Java programming!
That's it. In two simple steps; you now have a programming environment; which not only supports Java; but a number of other languages (tools) also.
Before we go any further; I would advise you to check out the following links, so as to learn a little more about Codeanywhere and Common Linux Commands; which will be used to execute your Java programs.
IDE Test Drive - Bonus Activity
I think I can chance it and squeeze this next activity in, as you are still awake and seem to be getting it! Right; don't ask me why, but it's an unspoken (hence, why I'm typing it) tradition that your first computer program spits out the phrase "Hello, World".
Personally, I would prefer a bolder statement; like "I am [Pick a name for your new creation] and resistance is futile". Parental notice, the futile clip is rated PG-13.
Step 3: Split Screen
- If you've logged out for whatever reason; please sign back into the Codeanywhere IDE.
- This step is not really a must, but I like to have a dual view on things; therefore; I tend to keep my coding up top and the command line (terminal - where you give Java commands) at the bottom.
Step 4: HelloWorld.java File Creation
- Java File and Class names should begin with an UpperCase letter and both should be identical.
- Check out SlideNerd's take on Java Naming Conventions
Step 5: HelloWorld Java Code
- Copy and paste (actually, type; as the practice would do you good) the following code into the Codeanywhere HelloWorld.java editor window, as shown in my video tutorial.
public class HelloWorld { public static void main(String[] args) { System.out.println("Hey, I'm David and my friends call me A.I. \nI would just like to let you know that resistance is futile!\n"); System.out.println("Sorry; my bad! Hello, World!"); } }
- It may appear as though I copied and pasted the above code into the editor, but I, in fact, typed it in (really, really fast!) - Remember, my Jedi force levels are that of Master Yoda; they are!
- Don't worry if you do not fully understand the above code; as the anatomy of a Java program will become clearer as you undertake more activities.
Step 6: HelloWorld Code Compilation
- Move your cursor into the command line (terminal) prompt and enter the following command and press the Enter key to execute.
javac HelloWorld.java
- Before Java can execute (run) what we have coded; we must first hand it over to the Java Compiler using the javac command.
- If the Java Compiler runs into any problems; then you will receive compilation errors; which typically triggers the head-slump-keyboard response. But I'm here in the capacity of your father to show you less painful ways of fixing your problems.
- However, for the sake of this activity, we live in a perfect error-free world!
- The Java Compiler's job is to convert your code into bytecode; which is the job of the Java Virtual Machine (JVM) to execute.
- The JVM can be thought of as a programming interpreter; speaking the languages of both Java and the host machine; which could be anything from your desktop computer to Watson or even your watch.
- Side note - Elementary my Dear Watson.
Step 7: HelloWorld Java Program
- As shown in my video tutorial we execute (run) our program by entering the following command into the terminal and pressing the Enter key:
java HelloWorld
- The following should then be displayed within the terminal window:
Hey, I'm David and my friends call me A.I. I would just like to let you know that resistance is futile! Sorry; my bad! Hello, World!
- Feel free to play about with the wording. Remember; to save your changes and compile before you can run the new code.
- There you have it, your very first Java program!
That's almost all, folks
I hope you've enjoyed today's homework session and will be taking away the following new found skills and insights?
- Like a twig to the entrance of a termite or ant's nest; or a rock to a nut or even a scrunched leaf used to scoop up water; they are merely tools used to solve a given problem. Programming languages can be viewed in the same way; a tool to be used to arrive at a solution. Be it, to launch an object into space or build artificial intelligence or analyze data or to stream live music. The trick is to clearly understand the problem you are trying to solve. And solve it.
- Tools can be used in isolation or in combination; such as a hammer and anvil.
- Ensure your tool is used within the right environment or in the context of programming, the right Integrated Development Environment (IDE). Always try to take the path of least resistance towards finding a solution. Meaning, make things simple for yourself and use tools that will facilitate and aid your journey.
We made it!
Not only did we make it to the end of the activity without either party disowning the other; but to my surprise, I was greeted with a smile as we crossed the activity finish line. Although she now denies this; but I'm pretty sure she also stated how funny I was throughout the activity and is now looking forward to our next homework session.
So; a valuable lesson for me also; be creative, think outside the box and constantly keep them engaged with whatever prop works for you!
Would be nice to hear about your homework tips also; as I find we have a better chance when we present a united front and stand together!
Happy Homework-ing.....