So, You Want to Learn to Program?

Killer Apps

An old friend of mine got in touch with me today and asked:

Hey man… Best idea for beginning to learn programming?

I was actually very excited when my friend reached out because, in my opinion, learning to program is something that can only enhance one’s possibility of advancement in many careers.

But, Before You Get Started…

I don’t doubt for a second that you could learn to program. But, that doesn’t mean it’s easy.

Sure, in some cases it is fairly simple. For example, let’s write a program that just says “Hello World”.

console.log( "Hello World" );

Now, let’s print out every number up to 1,000 that is odd in Javascript

for ( var i = 1; i < 1000; i++ ) {
    if ( i % 2 == 1 ) {
        console.log( i + ' is odd' );

For funsies, here’s a video that shows you how to run both of these little snippets in your browser.

[wpvideo ebTeBVUE]

That being said, while basic programming and writing code itself is fairly simple, being a good developer is much more complex. I’ll defer to Beau Lebens on this subject and link you to his post, “Why Web Development is Complex.”

If you’re still here and are still interested in learning to program – Hell yes! Let’s get on with it then 🙂

Where to Get Started

My absolute favorite place for beginner tutorials on programming, including everything from iOS and Android to web development, is Treehouse. This is a paid website, starting at $25, but is well worth it for how well organized the videos are.

I was very lucky to get a free account for two years when Treehouse had a giveaway for students. That being said, I would gladly pay the $25 per month if I were just starting to learn.

Team Treehouse

Once signing up and logging in, you will be presented with many tracks that you can learn from. These tracks start you off at a very basic level and bit-by-bit teach you the many thing you need to become a beginner developer.

Treehouse Tracks

You want to build the next badass iOS app. Great, do the “iOS Development with Objective-C” track.

Do you want to learn web development? Awesome. Take the “Front End Web Development” track.

Here is an example of the quality of the interface and videos that you will get within each lesson.

Android Development

And Start a Damned WordPress Site

My passion for development all started with me creating a WordPress site. Sure, I supplemented along the way with my BA in Computer Science, but nearly all of web development skills are self-taught by actually building stuff.

So, go get a cheap hosting account. Figure out how to install WordPress. Install some plugins and a theme. Then, when you want to add something cool to your site? Figure out how to program it.

Here’s the thing… The WordPress community is amazing. There is no shortage of tutorials, code snippets, and amazing people to help you learn to program.

Users Do the Damnedest Things

I had a good laugh over this tweet yesterday when I read -1 beers. After all, who the hell orders negative beers?

But as I thought more about the tweet, it struck a chord with me.

While the tweet was meant as a joke, it pointed out the fact that we, as developers, have to ruthlessly test our software and assume that users:

  1. Have no idea how to use our software
  2. Are intentionally trying to melt our servers

Tech User

Example: Uploading 1700+ Images at Once

As a developer, I would seriously doubt that anyone would ever want to upload 1700+ images at once through a web interface.

But, as a user, I found myself doing exactly that today after I found out that cloud drive has unlimited free photo storage for prime users!

Amazon Cloud Drive Upload


For me, this Tweet served as a reminder that I should test my code not only how it should be used, but how it might be used.

Basic Authentication in WordPress

About a month ago, I worked on a plugin to help retrieve a lawyer’s reviews from the AVVO API. One of the key aspects of connecting with the AVVO API was using basic authentication, which was a new method of connecting to an API for me.

What is Basic Authentication?

Basic authentication requires that an authorization header be sent that contains the following:

'Basic ' . base64_encode( "{$username}:{$password}" )

That is the string Basic, followed by a base 64 encoded string comprised of a username, colon, and then password.

Implementing Basic Authentication in WordPress

One of my favorite tools in WordPress is the HTTP API. Not only does it handle different server configurations and simplify the process of making API calls, but it makes setting headers as simple as passing an array of arguments.

Here is an example of how I implemented the basic authentication API call.

function make_basic_auth_request( $api_url, $username, $password ) {
    $request = wp_remote_get(
            &#039;headers&#039; =&gt; array(
                &#039;Authorization&#039; =&gt; &#039;Basic &#039; . base64_encode( &quot;{$username}:{$password}&quot; )

    if ( is_wp_error( $request ) ) {
        return $request;
    } else {
        return json_decode( wp_remove_retrieve_body( $request ) );

The function above will return a WP_Error object if the API call fails or a JSON decoded string if the API call was successful.

A Real Life Example

I have published the WordPress plugin I built to get AVVO reviews on Github.

Note: This plugin only implements the reviews portion of the AVVO API, and its purpose was solely to factor out code from a custom theme. As such, it should not be looked at as complete.