NetBeans: the Missing Step in Coding Education?

NetBeans LogoI’ve been talking about the need for a tool to transition from “move things around the little window by the code” teaching tools like Scratch, Khan Academy coding and Greenfoot. These are all great ways to start kids coding, but they are walled-off playgrounds with no connection to the outside world or even the rest of the computer you’re working on. Is there an accessible tool that allows students to easily do visually interesting things but also gives them access to code that can read and write files, create and connect to databases, and get data off the internet? And then I thought, what was that Java IDE that Sun made back in the 90s with a form builder, is that still around? And so I found myself at Netbeans.org.

Old AOL ScreenNetbeans is anything but a new tool; at 20 or so years old it’s practically geriatric by tech standards. When Netbeans came out Yahoo was the exciting new search engine, Mark Zuckerberg was a working on a media player as a high school project and a large percentage of internet sessions began with loud scratchy modem handshakes to AOL. I feared finding a neglected and forgotten product today, but Netbeans is quite up to date; the standard download comes with JDK 8 and tools for creating pages in Swing or JavaFX, the newer user interface module.
Don’t get me wrong; to do anything in NetBeans you have to know Java. So how does it help? The main way is that it makes creating user interfaces with Swing ridiculously easy using the forms design. To make a window you just select-click on your project, choose new and then choose JFrame form. You’ll see the window in the design view, and to your right you have a bunch of different UI elements like text boxes,  buttons, checkboxes and so on that you can drag and drop right on your frame.

Programming the UI is equally easy. To make an event listener for an element (that’s the code that happens when the button’s clicked or element’s changed or whatever), just double click on the element. You’ll be right UI elementsin the event listener class, so you can just write the code you want it to perform. (You can see more details in my first NetBeans lesson on my YouTube channel).

As I said, you’ll still have to know Java to do actually make the code in the listener, but with NetBeans your students can focus entirely on what they want their code to do rather than dealing with the the clunky Swing UI code or remembering the difference between addGroup() or addContainerGap().

But wait there’s more! NetBeans also makes it easy to create an Entity Class from Database. That means if you have a database connection you can easily make the students connect and start doing SQL commands with Java. It also allows you to create a Web Service Client. I’m not saying either of these are things kids could figure out on their own, but if you do the heavy lifting on the backend you can have kids do some serious programming with data that is not in a little box by the code window.

Apache LogoAfter I got excited about this, I immediately discovered that Oracle is planning on turning NB over to the Apache foundation as an open source project, and a sinking feeling filled my gut. I had experienced something similar before, when I got excited about teaching Microsoft’s fabulous XNA gaming platform in C# right before Microsoft dropped it like a used wad of gum. XNA became Monogame, but at least at the time Monogame was not what XNA had been. So I know well enough that “it’s becoming an open source project” is often the software industry’s equivalent of your parents telling you “the dog is on a beautiful farm where he can run and play all day.”

But Apache is not just any open source foundation; they are behind the most popular *NIX web server and Mozilla one of the most popular browsers – which you may well be viewing this page on – among many other projects like the Thunderbird mail app.

Even more encouraging was the thriving community of NetBeans developers I’ve discovered on Twitter. According to the NetBeans team there are more than a million users of NetBeans today, meaning a lot of commitment to keeping it alive and thriving. I wonder if these people realize NB’s potential as a learning tool for younger students?

I’m not going to get into the debate over whether NetBeans is better than Eclipse. Clearly some developers feel it is, but many more prefer the great purple circle (or one of the other popular IDEs like IntelliJ), and Eclipse may indeed be better for a commercial EE developer. For new students, however, it’s extremely intimidating with not a lot of handholds and no help with sorting out a parallelGroup from a sequentialGroup or a verticalGroup when you’re making a UI.

I’m experimenting now with NB as a teaching tool for students as young as 8th graders. I’ll continue to keep the blog up to date on how it works, and be sure to check out my NetBeans playlist on YouTube as it grows.

Teaching coding: The missing steps

It seems like every day someone is introducing a new tool to get kids into coding. Just recently Apple introduced their Swift Playground, with animations of kids making a weird pear-shaped blob thing move around a 3D world. We have the now-venerable Scratch, and Scratch Jr. for the really little kids, we have Hopscotch, we have the Hour of Code, we have Khan Academy coding and new tools that allow kids to program robots with Scratch-like code chunks. So that means that this generation should produce a huge new batch of computer-literate coders, right?

Missing Steps
Some steps are missing

Alas, probably not. I’m glad these first steps to coding are there, and they are essential. We also have plenty of steps higher up the mountain where adults, college-age kids or particularly motivated high-schoolers can learn more advanced coding: places like Udacity, Coursera, Pluralsight, Code School and so on. What we lack now is the tools, and maybe more importantly the teachers, to get people from these lower steps to the higher ones. It’s like staircase with the middle twenty steps replace by ropes and those wall-knob attachments from rock-climbing gyms. Some people will still get to the higher steps, but not many. Most will get to the top of the bottom row of steps, look around and say “that was fun, I made the robot move and turn; I wonder what we’re doing in art?”

But that’s fine, right? So most kids don’t go on and learn about networking. That’s advanced computer stuff! It’s not like every single computer is attached to some giant computer netw…oh.

Today we’re surrounded by computers, but unlike even ten or fifteen years ago, almost none of those computers does anything by itself!

Even applications that were once entirely local, like Microsoft Office or the Adobe Creative Cloud projects now depend on regular network connections. Remember the last time you were in a coffee shop and the WiFi didn’t work? I bet you didn’t get much done. You probably just put your computer away and got a book out or interacted with actual humans. Almost all computer work today involves having to download something from somewhere or look something up on Google. Even games are networked more often than not.

And it’s just going to get worse. More and more services are moving to the cloud; lots of organizations don’t even use Office anymore in exchange for Google Drive. More and more jobs involve getting complex data from a big cloud using APIs. And when the Internet of Things blows up, even your toaster will have an API.

Move the things around the little screen
Code can do ANYTHING!…in that window

But the programs the kids are learning to do, even a fairly advanced learning environment like Greenfoot that uses actual Java and begins to teach kids about objects and classes, all basically involve moving little shapes around a little screen on the side of the code. And sure sometimes you can blow the little screen up to your full screen, but it’s still a cozy little sandbox that has no contact with the rest of the world, unlike pretty much every other app they interact with.

I’m not saying there is anything wrong with these programs! I use many of them in my teaching. But there are very few places to go now when a kid is ready to get outside of that sandbox. Sure they can start learning Python, and if they’re patient they’ll stick with writing console apps for a month or two until they are able to start using PyGame and make some graphics. They can get into physical computing and start learning Arduino if they have the electronics gear and other hardware to make it possible. But as I mentioned, most Arduino programs (of the sorts most kids do) are actually very simple.

What is needed are tools that make it easy for kids to make simple network requests and access simple databases, tools that take some of the hard parts out (like making complicated database connection strings or working out complex network handshakes), while allowing kids to do the part that’s actually not that hard.

And the ideas aren’t that hard! SQL queries like “SELECT temperature FROM WeatherDatabase WHERE year>1990” or adding parameters to an http query like “?field=accidents&city=Omaha” are not that hard to to understand even for a middle schooler. But getting to the point where you can do that is. For now. It’s time for a tool to change that.

 

 

Tech Project Idea: Make It Easier to Vote in Local Elections

There was an election today for state senate and some judges where I live. Most people didn’t vote; I almost didn’t either except that I saw a tweet from the mayor telling me about it. As it happened I knew about a state senate candidate I supported because a friend had told me about her, so I went to vote. There were a couple of local judge positions where I didn’t know who to vote for, so I picked randomly. Afterwards, I thought how ironic it is that the elections we’re most likely to vote in (president, Senate and House of Representatives) are also the ones where our vote is least likely to matter. In small local elections for positions like state legislature, city councillor, civil court judge and so on the vote count can be in the thousands or even less, and small number of votes really count.

But it’s not so easy. It’s easy enough to get out and vote, but if you don’t know who you’re voting for it doesn’t do much good. Yes, with a little more research I could have found out about the civil court judge positions I got to vote for, who was running and what their positions are. But it would take awhile even to figure out what the races were; I know because I did try to look before I went. And I only knew about the person I voted for because a person I trusted told me about her. I assume the candidates did their best to get their name and positions out, but they were facing an overwhelming flood of competing news. I’m sure the newspaper must have mentioned them at some point, but in spite of my reading the news all the time I never saw it.

But it doesn’t have to be that way. All this information is publicly available, just not very well aggregated. Some websites are working hard to do this. The best one I found is BallotPedia, which has a pretty good collection of what’s going on, including a list of the state senators. It even has a place where you can enter your address and see a sample ballot – but only for the general election. With enough searching I could still have figured out who was running today, but not quickly.

But there is no reason a website couldn’t allow you to put in your address and tell exactly who is running for what that you can vote for, what day the election is happening, where your polling place is, links to all the candidates’ web pages and news stories about them and information about their voting record if they are in office. You could also register to get emails to inform you about various off-season elections, such as for bond issues.

There may be no profit motive for a private company to do this and it might be too difficult for a nonprofit, but it’s something the US government could set up very easily, for an amount that would be a pittance by US government standards (five or ten million dollars a year would be more than enough).

The best part is it’s not something that has to be done nationally right away. Small groups could do local or state versions of the same thing. It could be an advanced student project or college level programming project. You could start as small as you want. If it worked in smaller areas it could be expanded and get bigger and bigger until it covered the whole country. Imagine if countless small organizations began, and started to come together to makes something bigger.

Best “pro” language to learn first? (Part 1 – Python)

Python LogoA common question I see is what is the best “pro” language for students to start with? There is no one right answer for this, because it depends on the kind of student and what your final objective is. I have some experience teaching a number of languages and know more of them, so I am going to offer some thoughts about starting with different languages that I hope help a teacher decide. When I say a “pro” language, I am speaking about something that is actually used for professional applications. That means obviously not Scratch, but also not something like Processing. These are both great languages to practice with before you learn one of the languages below, but as far as I know no one is creating any commercial applications in Processing or Scratch. I won’t address every possible language, because some of them (like Lisp) I just don’t know much about. I am going to do a series of posts starting with this same paragraph.

The first language I’ll address is Python, because it’s a popular learning language. As a beginning language Python has an enormous amount to recommend it. First of all it’s the most accessible language that I know of that’s actually used for professional code. You can get students doing something very quickly.

Flying with Python
XKCD #353 – Randall Munroe

It also has an enormous number of modules that users can download and include in their programs to get them doing some fairly advanced stuff fairly quickly. The creation of blocks through indenting is different from how most languages do it. But even when your blocks are enclosed in curly brackets as with C-derived languages, indenting them is the expected style. So it’s not so hard to go from:

def addNumbers(a, b):
    “Add some numbers”
    c = a + b
    return c

to:

int addNumbers(int a, int b)
{
    //Add some numbers
    int c = a + b;
    return c;
}

And yet I no longer start my students with Python. Why not? Two reasons:

Notice the main difference about the two functions above, not counting punctuation? Yes, it’s the data type ‘int.’ To me, when students get to this point I want them to be thinking about data types. We expect the function above to be called as addNumbers(20, 50). But in Python, what’s going to stop a person from typing addNumbers(“Hello “, “world”)? If you do that, you’ll get a string back instead of an integer. But if you look at the function you wouldn’t expect that outcome, and you wouldn’t know that if you were passing that answer to a different function that was not capable of handling strings. Worse, if instead you called addNumbers(“20”, “50”) — which could easily happen if the numbers are in variables and you’re careless about how you handle user input — then you’d get back a string that looked like a number (though the wrong number, “2050”).

The second reason is that Python is an interpreted language, not a compiled one. This means that you run a Python program straight from the source code. Python will just run until something doesn’t work, then it will stop with an error. This means students will not be exposed to the crucial difference between two kinds of errors: a compile-time or syntax error and a runtime error or exception. Compiled languages like C have to first be turned into code that the machine can understand. If you attempted to call the addNumbers function as  addNumbers(“20”, “50”) in a compiled language like C, Java or C++ the program would probably* not even compile, and you’d be informed that you tried to use strings where the program expected integers.

Say, however, that you have the user typing in the numbers in a compiled language. You could use code to tell a compiler to turn the user’s input into integers, so “50” becomes 50. The program will compile, because it will work if the user types in the right input. However, if the user types things that can’t be turned into numbers, like “Hello”, “World”, (or a decimal or a very big number that doesn’t fit in the integer data type) the program will probably* stop while running and return an exception. This is a vey different type of problem, and it helps teach students that even if you program does work, you have to prepare for getting the wrong kind of input that can make your program break.

However, you may disagree with me about the importance of these factors. If you just want your students to learn some basic programmatic thinking, Python may be the best starting place. You may feel that dealing with compiling and data types will turn off students who are lukewarm to coding.You might feel that Python is a good “bridge” between something like Processing and compiled, strictly typed languages like Java, then this also might be the best choice for you. And if Python is all you want your students to be able to do then of course teach them Python. After all, I know professional programmers for whom Python is their bread and butter.

If you do decide to teach your kids Python, the Python Software Foundation has a great tutorial here. I would recommend using this as a source rather than a direct teaching tool, unless you have very self-motivated students. Al Sweigart also has a great series of Python books here that I have used to good effect.

Next up I’ll be discussing starting students with Javascript.

*I say “probably” because it depends on the language and compiler; some compilers might just turn them into the number 0; and if it’s C maybe it would just use the pointers to the strings or something so you’d get an answer like -9832386 or something, because C is really hard as I’ll explain in a later post.

How to Get Kids’ Hands Dirty With Data? (Part 2)

My last post is about places students can get publicly available data. I promised to talk about the tools we can use to access it. This post will be about with the tools that are out there now.

Probably the gold standard right now for getting at real data and doing stuff with it is the Wolfram Language. There is a lot to recommend this, but the biggest one is the enormous amount of data the WL puts at your fingertips. Also the wide amount of data types the language can access and work with, including things like colors, countries, shapes, images and all kinds of other things I probably haven’t tried yet. WL is entirely comfortable with an array that looks like this:

Wolfram list

Wolfram language also allows a fantastic range of visual outputs, from 2d and 3d graphs, colored maps, graphs of functions with sliders you can manipulate, interfaces with buttons and probably a bunch of other things I haven’t tried yet. Furthermore it’s extremely easy to use, so almost anyone can look through the documentation and start typing things in to see what happens. And it connects to a lot of other APIs, like Facebook’s.

But some of these strengths are also weaknesses when your goal is to teach coding. Wolfram’s radical leniency with data types will teach your students terrible coding habits that will lead to real problems in other languages. The wide range of different kinds of output the language is capable of makes it really hard to predict what kind of output you’re going to get from a program. And though I haven’t tried it, Wolfram doesn’t seem to be set up for long complex functions. There’s not even a local development environment where a person can edit and save their programs. As a result, I think that WL is a terrific tool for teaching pretty much any subject except for programming. The one exception is if you’re preparing students to learn a functional language like Haskell, since WL is also purely functional, calling functions in a similar way and lacking things that most people expect to see in a programming language, like loops.

The two most popular tools for data manipulation in the scientific world seem to me to be Python and R. Python is a great learning language because it’s really easy to do a lot of things and there are countless modules that can do just about anything. But in spite of its ease relative to other programming languages, it still takes awhile before a student can do much. You have to spend about a semester’s worth of writing console programs before you will be ready to do any kind of graphics, and that’s enough time to lose a student who isn’t naturally attracted to coding. But a well-designed class could have students doing interesting things with data pretty soon.

I don’t know much about R. I know that professional statisticians really like it and professional programmers mostly don’t. I don’t think it has a shallow learning curve. I imagine if you wanted to take the time to teach it you could have students doing some interesting things but from what I know it’s a better tool for teaching statistics than for teaching programming.

So what’s the right tool? I think the ideal tool doesn’t exist…yet. But I have a vision in my head of what it would look like. It would be as accessible as something like Greenfoot or NetBeans, with a low scaffold for beginners. It would allow you to manipulate data as easily as a Python module, though maybe not as easily as WL. It would have tools to create graphics of different sorts. And it would have access to a wide range of open source data, with menus to choose it, though with more precision about types than WL. Ideally you’d be able to import data into SQL-type tables (or maybe JSON or XML objects), and manipulate them with either the SQL language or a functional tool like C#’s LINQ.

The tool I’m imagining is the holy grail of this blog right now. If it existed, I’d be using it now. If it continues to not exist…I might have to try to make it.

Why doesn’t Google Classroom put my class times on my calendar?

How classroom should work

Google Classroom is awesome, and I use it a lot. I know it’s not for everything; I don’t expect it to have things like places for unit plans or a gradebook, at least not yet. BUT why can I not put in a time that my class meets, and have it put that on my calendar with the students’ names included in the invite section, and put it on the kids’ calendar too? This would be a trivial thing to add as it uses functionality Google already has, but for some reason they didn’t do it.

Tech Support Line Tricks

Tech Support NightmareI do IT for my school, and as a result I spend a lot of time on tech support lines. I am a connoisseur of tech support hold music: Apple’s music is probably the coolest, except they always  play that one John Legend song that I’m so sick of. Cisco’s is definitely the worst, a bland recycled elevator music song that repeats indefinitely. But I know some tricks for dealing with them, which I’m going to share with you.
The most useful investment you can make is some earbuds with a microphone. I find it’s most convenient to call tech support with my own cell phone, not a school phone. When you are on hold, stick the earbuds in your phone and go on to do whatever else you were going to do. I’ve had holds that lasted for more than 2 hours, and didn’t mind
at all because I was getting things done anyway.

If you know what you’re dEarbuds with micoing, your goal is to get elevated as quickly as possible. The people that answer the phone don’t know much. Be prepared for what they are going to ask you. Quickly get through the general questions about starting and restarting your computer and so on.

The best way to be in this position is to research this problem as much as you can in Google first. When you get a person patiently explain exactly what’s happening and what you have figured out so far. When they see you know what’s going on, they’re more likely to go to a more expert person who can actually answer your question.

Of course the hard part is getting to talk to a person in the first place. Some companies don’t list their phone numbers on their “contact me” page. This is stupid, but easy to solve; just Google their phone number. However if they have a callback form, try filling that out first; some companies are pretty good with those.

If you can’t speak to anyone at all, just press the buttons that get you to Sales. For obvious reasons they are most likely to answer. Then just act stupid and pretend you got there by accident.

If you call Apple and use any kind of OSx server, call Apple Enterprise rather than the regular Apple help. They are very good.

Have things like serial numbers of the products ready before you call.

Get the name of the person you’re talking to, and ask if they have a direct line. Try to make sure they start a case; this means there is a record of what’s already happened. Nothing’s worse than having your call disconnected and having to call back and start from scratch.

Don’t get angry at the tech support people. This isn’t always easy, but remember they are low-level employees. Some are trying hard and some aren’t. but often the obstacles that you are facing aren’t their fault.

But don’t be afraid to be a pain in the butt. Keep calling. Try different menu options to see where they get you. Use your headphones and stay on hold until they talk to you. When they figure out you’re not going away, they will find a way to give you what you want.

How to get kids’ hands dirty with data? (Part 1)

In my last post, thScreen Shot 2016-09-05 at 4.09.33 PMe question was what kind of programming projects should students be working on if not video games? And an answer I provided, without much detail, is helping kids work with real data. This post is some thoughts about how to make that possible.

Real data is information that’s been collected in a scientific process that reflects things that are actually going on. Ideally I’m thinking of information that is already in some kind of tabular form (whether an Excel spreadsheet, a database table of some sort, or even a comma or tab separated value text file). But the data might instead be in a more programmatic form, such as JSON or XML files.

2000px-NOAA_logo.svgThe good news is there is tons of open-source data out there, and a lot of it is extremely useful and relevant. One of the best places to start is data.gov, a government portal to tons of government-generated data sets. This includes atmospheric data, to health data on US citizens, locations of American military bases, crime statistics, and countless others useful relevant things for kids to work with and address real-world problems.

Data.gov has a developers section with an API, but this is less useful than it sounds because the API just contains metadata and links to the data, and can’t actually directly access the data. Still it’s a good place to start.

Individual agencies like NASA, the FDA, NOAA and countless others each have their own independent APIs as well, that might allow a person to do more with the data.

nasaLogo-570x450In the short term, what a teacher would do is decide what kind of data students should work with, download it, and get it into a format the kids can use. Ideally this should be a database of some sort. Working with databases sounds big and scary. But the basic statements of SQL are not that hard, and every language has tons of packages to allow the language to work with an SQL database. This may be harder than I think, because I haven’t actually attempted to teach it yet. But I believe it can be done.

Why do we want to teach kids to work with databases? Because this is the skill most organizations, be they corporations, the government or nonprofits, are going to need their programmers to do. Of the students that end up doing some kind of coding, whether as full-time programmers or para-coders doing some code on the side of another job, very few will be making video games, but most will be working with some kind of data.

So what could the students do? Here are some of the kinds of projects they could attempt, with my estimation of their level of difficulty:

  • A search program for database keywords (easier)
  • Joining different tables to make another table (easy-medium)
  • Programmatically create graphs such as bar graphs (medium)
  • “Dynamic” graphs that change over another dimension like time (medium-hard)
  • Heatmaps or colored maps of states, districts or countries (harder)
  • Interactive data-tools that respond to user input (hard)
  • Animations showing motion of objects like planes or ships (really hard)

Ideally you’d like to be doing something that Excel can’t do easily. This might mean generating graphs based on different queries a user could enter.

Obviously this is going to take a lot of guidance at first. The emphasis here should be on the students solving a real-life problem. As much as possible students should make decisions about what kind of data they’d like to work with and what kind of problems they’d like to solve.

I’m going to be working with a small group of students to experiment with exploring data this year and I’ll post about how it’s working.

But I’m thinking bigger. I’m thinking of making a tool or IDE that helps students to do more of this independently. But that deserves a post of its own, which will be part 2 of this topic.