In the last blog post in this series, Iza Romanowska argued in favor of Pyton. Here I weigh in on my thoughts on Java Eclipse.
Back in early May my colleagues here on Simulating Complexity and I agreed to write a short series on simulation platforms. Iza would write about Python, and Ben would write about NetLogo. Well, I program in both Java and NetLogo so it was logical that I would write about Java. The problem was, back in May, I hated Java (no offense to Java programmers and developers everywhere). However, after working intensively with it for multiple months, I have come to absolutely love its functionality.
I started using agent-based simulation as a way to examine archaeology because I saw that there were so many intractable aspects of the past that could be understood with simple models. The issue was, I didn’t have any formal programming knowledge. My first foray into ABM was with the Repast suite, a java based modeling system. It was a steep learning curve, and honestly wasn’t that much fun. Around this time I was also learning R so that I could analyze all of my output, and was taking an intro to computer programming course in Python. My poor brain kept getting each of them mixed up. It would be like taking Italian, Portuguese, Romanian, and French all at the same time. I was helplessly switching words back and forth.
Then I took a class in Agent Based Modeling that was entirely based in NetLogo. And I quickly fell in love. It was so gosh darn easy. I could program a simple model, essentially using English syntax, and it would work.
And then I came back to Repast and Java Eclipse.
I have to be honest, it was rough. Rough at first. But the question that I wanted to ask required the ability to have separate classes, to have a large GIS simulation window, to have thousands of interacting agents, and NetLogo just cannot handle that. So I dove back into the Repast suite, and, lord help me, I’m actually enjoying it. So, let me tell you about the features of Repast and Eclipse that I’m loving.
- The new git repositories. Just like before, you check out your branch from your repository. And then there are two places where this is archived—the central repository (like before) and a new, local repository unique to your computer. It’s actually kind of genius. Say you want to keep working on something, and are concerned you’re going to break it, but it’s not ready to archive where your colleagues can take it down. Now you commit locally, then if you break something, you can redownload from your local repository. Then when it’s done and working, commit to the central repository. Kind of brilliant, huh?
- Debugging view. Instead of just running your sim, and seeing where it breaks, there is now a debugging view that will go step by step through and show you what’s going on behind the scenes. This has been instrumental in helping me find all the infinite for-loops I’m fond of creating. Again, brilliant!
- This is not new, but the ability to handle scads of data. Java can be incredibly fast, and so when you have a beast of a simulation, Java is the way to go.
As Iza rightly points out, knowing a real computer language is key in the job market these days. And while java has a much bigger learning curve than NetLogo, it has incredible online documentation. While working on this project I have been constantly googling, and finding dozens of folks out there who have had similar issues. Also, there are tons of online tools for learning to program, such as Exercism.io (recently written up in Wired), that will help you find the basics.
Java is exceptional at working with large, complex data, moving quickly through it, and is incredibly flexible in how you program it. Writing output for a Repast simulation is incredibly simple, as is writing new GUI graphics.
So, when to use NetLogo? When you want to write something simple and fast. When to use Java? When it’s going to be more complex, have larger classes that do multiple complicated things, and when your simulation might have multiple different kinds of agents.
I will likely continue to use NetLogo for my simple models, but for anything that uses vast amounts of data I am glad I now know java.