- Command Line
- Version Control
My mobile app development class is making a production app for an organization in a nearby city. We’re mostly pretty inexperienced though. I’ve done enough reading and tinkering to know roughly how this should go, but I’m kind of guessing too. I know what software we need, but I’m not very good at explaining why, so a lot of conversations have gone like this recently:
Me: We should use this thing.
Others: We’ve never heard of that thing. What does it do?
Me: It helps you keep track of the thing, and also these things.
Others: So it’s kind of like this other thing?
Me: Kind of, but also not.
Me: It’s best practice in the industry.
Quiet guy who is probably more knowledgeable than I am but also too smart to stick his neck out and accumulate a bunch of work: *tries to explain*
Others: So it is like the thing?
Me: Yeah, sort of.
Quiet guy: *shrugs*
Others: Let’s use the thing.
Others: How do we use the thing?
Anyway, that’s what this post is for. My regular readers may find it useful for something, but I’ve probably covered a lot of this in previous posts and I’ve noticed that you folks like to binge-read my archives when you discover my blog (I’m like that too when I find blogs/comics/whatever).
The one thing on this list you already have! The command line is a powerful development tool, especially under Unix-like systems. You’ll also find that git is easiest to use from the command line. Here’s a good, quick tutorial.
We’re using git and GitHub. Git is version control software, which means that it can keep track of and solve conflicts between code changes made by (in our case) half a dozen people.
It has features like code branching, which lets you work on making new features in a separate copy of all the code without having to always change the main branch before your feature is stable, and when changes are made on a file, it points out what changes were made so you don’t have to look through the whole file to find them. You can also look back at old versions of the code, which is useful if stuff breaks or you want to know what the heck you were thinking.
This is going to sound confusing until we start using it.
Windows doesn’t come with git itself (the command line tool). Kivy’s site recommends Git for Windows, which has a GUI application for Git as well as a bunch of other features. You’re probably fine taking the default
The customer has cleared us to use GitHub publicly, so you all need to create GitHub accounts.
You also need to know how to use GitHub. The best tutorial for learning I’ve found is on Codecademy. It’s free, but you’ll need a Codecademy account to save your progress. Then you can go through the tutorial. This will explain all the commands step-by-step, a lot better than I could in person, so please pester the Internet and not me about it because you’ll get better results.
Sometimes, what you need is a reference and not a tutorial, and CC’s step-by-step instructions are a real pain when you just wanted to know that one command you forgot. A good reference is here instead.
Once you’re comfortable with the commands, clone the repository I made on GitHub, which is here:
First, if you’re running Windows, you’re going to need to install Python. (Mac and Linux come with Python, so don’t worry about it if you’re running those.)
First, you need to download Python. We want 2.7.11 (as of this writing), not 3.whatever, in order to work with Kivy. You probably want the last link from this list.
Please pay attention while you’re installing that. There’s a feature in the installer you can select that adds Python to $PATH for you, and if you select it, you can save yourself the next set of instructions. If you’ve already installed, or can’t find the feature, here’s how to fix the owie that not selecting that feature leaves you.
On Windows, you need to modify the $PATH variable in order to get your command line to recognize Python. $PATH is an environment variable that tells your command line where to find your development tools, and by default, when you install Python, it isn’t changed (in case you have multiple Python versions on the same computer).
Here’s how to modify your $PATH variable; you need to add this chunk of code
to the front (don’t delete the rest). If you’re not so sure about doing that, Hitchhiker’s Guide to Python has a tutorial; it gives you a command you can paste into PowerShell. (I haven’t personally tried it, but I’ve had good experiences with that web site.)
If you don’t know Python, it’s really easy to pick up. Here are two tutorials:
Learn Python the Hard Way (a published book, online version is free)
Kivy is a cross-platform, open-source Python framework that we can use to build mobile apps. In fact, it cuts our work in half because we don’t need to build a separate app for Android and iOS… and it’s better designed because the framework’s code is beautifully orthogonal to anything we create with it. You don’t need a special IDE and a long tutorial about what all those auto-generated files do in order to run Kivy. Heck, you could write Kivy in Notepad if you really wanted to. It’s also much better documented than the normal Android SDK, and nearly everyone likes Python better than Java.
For Windows, the magic commands here take care of everything. Keep in mind you’ve already installed Python.
If you’re running Mac or Linux, you’ll want to refer to their respective instructions. You can still use pip if you want, or you can download and install a tarball.
Kivy has a much easier learning curve than the Android SDK. But you still need to learn how to use it. There’s an excellent textbook for $10-$20 from O’Reilly:
Creating Apps in Kivy (Amazon)
There’s great API documentation from the Kivy developers:
There are also beginner apps that you can create, demonstrated on the Kivy site. I didn’t like them nearly as much as the book–they kind of ran me into a wall with trying to do other stuff based on the code. I found the book more useful, but I’ll link to the pong app anyway:
This post will get updated as we end up using more resources.