Learning to Program

November 11th, 2012 about programming

So you want to learn to program? Great! It's an absurdly powerful and beautiful hobby to pick up. Unfortunately, it can be pretty difficult to pick up on some of the fundamental concepts if you aren't a "natural" programmer, but that doesn't mean it's impossible. Being able to program, in my opinion, is an unbelievable and unparalleled skill. As a programmer, you can take plain old thoughts, organize them into a few dozen (or more) lines of code, and it will actually do something. You can imagine a red ball bouncing across the screen and actually make a red ball bouncing across the screen. And you don't need anything more than a computer, which I'm assuming you have if you're reading this article: you can do all of that with just jsFiddle. It's incredible. All of this amazing potential is right at your fingertips; all of the groundwork has already been laid out for you to make amazing things. All you have to do is learn how. So... how do you do that?

Basics

Get the basics down. There's dozens of free tutorials and books available on the internet that are specifically designed for beginning programmers. Probably even hundreds. Several universities such as MIT and Stanford are even offering free computer science courses online. The rest of this article assumes you've got at least the fundamental concepts of programming down, although even if you don't you could still benefit from some of the remaining points.

Ask

Ask questions. If you don't understand something, ask someone how it works. If you're lost and can't get your program to work correctly, ask someone who has more experience. If you don't know anyone who would be able to help, ask the internet. StackOverflow is an amazing place for programming questions and answers, and it has side projects for almost any field of study imaginable. Quora can also be an incredibly helpful tool when it comes to having questions answered or finding resources.

Read

Read code, blogs, books, tutorials, etc. By reading someone else's code, you can expose yourself to new ideas and methods of thinking. There's an unlimited number of ways you can solve any given problem with programming, but it's certainly not easy to solve every problem the same way. When you read someone else's code you can pick up new techniques and solutions for problems. I can't even count the number of times I've been trying to solve a problem with one method only to see someone else's solution that was magnitudes greater than mine in terms of performance or elegance. Blogs can also expose you to new material, provide you with awesome tips and tricks, and also help you to avoid some common pitfalls that usually come through experience. Tutorials and books are great for teaching specific concepts and covering a wide range of information.

Effective Text Editing

It's no secret that I love vim. It's an absolutely marvelous text editor with an almost unlimited amount of power. Unfortunately, it has a very steep learning curve which can make it pretty difficult to get started with. Fortunately, there's dozens of articles about how to make the switch from standard text editing. If you aren't ready to pick up an advanced text editor like vim, find a good traditional text editor that you like and learn it well. I've never used either of these, but I hear that TextMate and SublimeText are both pretty handy if you can't let go of point-and-click mouse interfaces (which I recommend you do let go of; mice are slow!). It's almost painful for me to watch people fumble with text editors as they code because they aren't familiar with them. If you're actually going to program, you'll be spending hours of time in a text editor. It's crucial that you familiarize yourself with it and understand how it works.

Version Control

Another item of critical importance. Version control is a must for serious programmers. There's nothing more unfortunate than accidentally deleting a file or line of code and having no backups to restore from. It doesn't matter whether you use Subversion, Mercurial, Git, or even CVS. Just use version control. It allows you to manage, record, version, revise, and restore your code with ease. Even better, it makes collaboration with other people fluid and seamless. Dump all those confusing email chains and backup files clogging your workflow and pick up a nice version control system. Spend some time familiarizing yourself with its workflow, too. You might even want to check out GitHub or BitBucket. Both services offer free version control hosting and expose your code to other people, which can also be helpful. You might end up with master programmer's reviewing your work and providing you with constructive criticism.

Personal Projects

It's hard to learn things unless they interest you. If you're only programming for external reasons like school or work, it's harder to internalize the concepts and techniques you're using. If the actual program is providing all of your motivation, it pulls you in and encourages you to learn more so you can make it better. By creating a personal project like a simple to do list, you actually become involved in the program. You want it to be awesome because it's personal; it's a project for you, not some professor or employer. You are directly reaping the benefits of improving a personal project, which encourages you to make it even better.

Practice

Similar to personal projects. The best way to get better at something is to practice it, so if you want to become a good programmer, you have to practice. CoderByte has a bunch of programming challenges for entry-level and moderately skilled programmers. Copying Unix can be another great set of challenges to practice with. If you can't think of any personal projects you want to make, just write a program that does something so you can get more experience. Who knows, it might turn out to be pretty cool in the end.

soofw

November 7th, 2012 about soofw

It's such an inevitable question. "Soof double-you? What's that mean?" Nothing. It means absolutely nothing. "Why'd you pick it then?" It's short, looks elegant, and is really easy to type for me. Those are seriously the only requirements I had in mind when I bought the domain name a few years ago. The lowercase S at the beginning is just for style reasons; I think it looks cleaner. As for the purple, it's my favorite color. The favicon is a purple lemniscate laid across a blue hourglass. I just like those things. Time and infinity are neat. Pronunciation-wise, I say "soo-fwoo" so it rhymes with "Sue flew." You can pronounce it however you want though. It's up for debate.

Hisss

November 1st, 2012 about git, programming, and python

I've always been really interested in learning Python. Its clean syntax and use of whitespace to delimit code blocks has always been very appealing, and the incredible amount of positive feedback I've seen about it is impressive. I've dabbled with it a few times, but never enough dabbling to solidify its semantics in my head. I even tried porting this web site over to Django once, but I ended up losing motivation because of the brand new learning curve (like Vim's, it was intimidatingly steep). Recently, however, I decided to make a terminal-based to do list and plunged right into it with Python. In the very beginning I was having difficulty handling the command line arguments properly, so I was tempted to switch to a more familiar language like PHP. In spite of PHP's calling, I knew I'd never learn Python if I just kept quitting in favor of a more familiar language, so I stuck with it.

Man am I glad with that decision. After getting the arguments sorted out and actually getting into the logic of the system, I was blown away with how simple and expressive Python's syntax is. It's amazing how concise and readable everything is and how easy it is to create beautiful, easy-to-read code. Control structures are concise, formatting is simple, and complicated operations are reduced to simple expressions. Tasks that are cumbersome in other languages are made trivially easy with Python. For example, checking if the string "Whose cookie is that?" (stored in the variable bigstring) contains the substring "cookie" done in multiple languages:

LanguageCode
C strstr(bigstring,"cookie") != NULL
C++ bigstring.find("cookie") != string::npos
PHP strpos($bigstring,"cookie") !== false
JavaScript bigstring.indexOf("cookie") != -1
Java bigstring.contains("cookie")
Python "cookie" in bigstring

It's not even a contest on which language is the most compact and readable. Of course, this form of succinct syntax, along with its whitespace-delimited code blocks, can be a source of confusion for people more familiar with other languages. For me, and I would imagine most people, especially those new to programming, this type of syntax is easy to pick up on and assimilate into. This was also one of my first real experiences with Git, pushing me even further out of my comfort zone. I'd been using Subversion for almost a year and was pretty content with how it had turned out for me, but I couldn't ignore all the Git + GitHub hype going on in the internets. Another satisfying decision, as Git is incredibly powerful. I'm not nearly experienced enough to describe all its advantages, but a quick Google search should explain it fairly well.

Happy Halloween!

October 31st, 2012 about funny

My command-line to do list

October 27th, 2012 about git and python

In an effort to improve my personal task management / organization and my Python, I've been writing a command-line based to do list. I based it heavily on todo.txt and Steve Losh's t, but with my own little twists and ideas built into it. It's my first real experiment with both Python and git/github, so I'm learning as I go and hopefully making a usable product for people other than myself. You can check out all of the details over at the github repo and even fork it or something funny like that.

Using Chrome as a Terminal

October 23rd, 2012 about chrome and shells

I love terminals, and I love Chrome, so it's no wonder that I love Google's official Secure Shell app. It's just a Chrome/ium extension that lets you open a terminal and connect to a machine via ssh. It's certainly not a replacement for my standard gnome-terminal, but it's pretty close. I've already started using it on my Cr-48 to connect to my desktop and it's been working perfectly. It's also a much nicer way to ssh from a Windows machine than PuTTY.

I would absolutely love to have a terminal that supported Chromium style tabbing. I love Chromium's tabs because of their minimalism and sleek style, but that's unfortunately an area where using this as a real terminal falls short. If you launch the app in a standard tab and drag it out as a new window, you're stuck looking at the unnecessary address and bookmark bars. Or, if you launch it in windowed mode, you get the address and bookmark bars hidden, but you also lose the tabs. Bummer. Furthermore, it doesn't support a fully transparent background (one that shows the desktop/programs behind it) which is a feature that I find absolutely necessary in a terminal. Even worse than those two options, however, is the fact that it doesn't support a local shell option outside of ssh-ing into localhost, which kinda sucks.

If you're interested in trying it, I actually recommend signing up to the Google Group and installing the dev version instead, as it has support for changing the default color palette. I just learned about this version today, which was an incredible find because I've been struggling with the default colors. There's just something about not using my own color scheme that irks me just enough to completely disrupt my focus.