“Hello World,” C++ style

I cracked open Beginning C++ Through Game Programming (for the third or fourth time since I’ve owned it), and was immediately directed to Appendix A, “Your First C++ Program.”

I was instructed to install Dev-C++, a freeware IDE (Integrated Development Environment). Apparently Dev-C++ hasn’t been actively developed for years, but someone else picked it up and has been updating it under the name of wxDev-C++.  So I am planning on using it rather than Dev-C++.  If I run into any issues, I can always switch back.

So I fire up wxDev-C++, and am greeted with this:

wxDev-C++

Not intimidating at all, nosiree…

So I go to File -> New -> Source File (Or simply hit CTRL+N) to start a new file.

The first program the book provides is a variation on the “Hello World” program.  The example given in Wikipedia’s entry for C++ is as follows:

#include <iostream>

int main()
{
   std::cout << "Hello, world!n";
}

Looks simple enough.  Not quite sure what all of the alphabet soup means yet, but at least it’s short.

I paste it into the source code window, save the project as “hello_world”, then go to Execute -> Compile (or hit CTRL+F9).  A “Compile Progress” window is displayed, which doesn’t tell me a whole lot, other than the status is “Done.”  Allrighty then.

So I go to the the folder where I saved the project file, open the command prompt, and type “dir” (ah, DOS, how I don’t really miss you).

I see the .cpp project file at a svelte 96 bytes, as well as the hello_world.exe file, coming in at a whopping 464 KB.  I suppose that contains all of the libraries and other infrastructure necessary to actually run the program.

I type in “hello_world”, hit Enter, and bingo-bango:

Sweet.  Google, you got a job for me yet?

jQuery Mobile

I haven’t even made it into the first actual Beginning C++ Through Game Programming post before there was a diversion! Oh well, gotta roll with the punches.

I just learned via this Mashable article that the developers of jQuery (the popular JavaScript-based framework) recently introduced their jQuery Mobile initiative, which should allow for cross-platform development on various mobile devices.

It should be interesting to see where this leads – jQuery is easy enough for a beginner like me to use with minimal fuss, and hopefully the mobile version will be as well.

Now what?

As I mentioned in the introductory post for this blog, I’m really not sure what direction I should go.  There seem to be several options:

  • I’ve had Python suggested as a good beginner’s language.
  • Visual Basic seems logical given my past history with BASIC (though it is apparently quite different from the 8-bit 80’s era language I grew up with).
  • JavaScript would be good as it’s something I could put into immediate use at my full-time job.  Though it’s more of a scripting language, as the name would suggest.
  • Objective-C might make sense, as I’m interested in developing mobile apps, and I currently own an iPhone.  Most iPhone apps make heavy use of Objective C.

I’ve decided (at least for the moment) to start with C++, for a number of reasons:

  • It is one of the most popular programming languages created.  I’d wager that the majority of commercial applications created over the past 10-20 years have been done in C++
  • From what I have gathered, it is not tolerant of sloppy coding techniques.
  • It is hard to learn.  I realize this sounds backwards for a beginner’s blog, but I figure if you can get a handle on one of the harder languages, the easier ones will be that much simpler.

I will probably jump around between different languages as my whims dictate, but for the moment I’m going with C++.

Beginning C++ Through Game Programming

So now that a language has been determined, the next step is to determine how to actually learn the language.

Late last year, I purchased Beginning C++ Through Game Programming, Second Edition* by Mike Dawson. He teaches at UCLA, and was the co-designer of Dark Seed, an early 90s horror/adventure game.

I’ve always been interested in writing my own games, and learning programming via writing simple games seems like a logical way to go about it.  From a cursory scanning of the book, it seems that the example games are all text-based – which is fine with me.

I will attempt to work through the book and update the blog on my progress, without simply duplicating the content of the book.  Not sure how I will accomplish that yet, but I suppose we shall see!

(*Apparently there is a revised edition coming soon, Beginning C++ Through Game Programming, Third Edition.)

Introduction

Note: Several years ago I started a blog called “The Coding Noob” which never went anywhere.  I’ve since rolled those posts into my personal blog.  This was the introductory post.

History

When I was a kid, my dad would take me to the local community college to play on their VAX mainframe computer. I initially spent my time playing Colossal Cave Adventure [play] and Star Trek [play]; but eventually started dabbling in Beginners All-purpose Symbolic Instruction Code, or BASIC.

BASIC was an easy-to-learn programming language that was ubiquitous in the early 80s. Anyone who owned a home computer in those days is probably familiar with this bit of code:

10 PRINT "HELLO"
20 GOTO 10

…which would display a never ending column of “HELLO”s on the computer screen.

I took a number of Saturday morning classes at the college, learning the ins and outs of BASIC. I received a Commodore 64 for Christmas one year, with which I spent even more time in the world of variables, GOSUBs, and IF/THEN statements.

While I spent a lot of time playing games, I also spent hours upon hours typing in BASIC and assembly language programs from the pages of Compute!’s Gazette magazine. I tried my hand at writing my own programs; probably the most sophisticated one was a text boxing simulator, based on a pen-and-paper game a school friend thought up. It wasn’t much, as I knew nothing about boxing, and a text-based boxing simulator is about as boring as it sounds.

While BASIC was an excellent introduction to programming, it was also very limited. At the time, assembly language was where the real money was, at least on the Commodore 64. It provided much faster performance and far greater flexibility, but with a very steep learning curve. You also needed additional programs such as a compiler and debugger, which weren’t cheap.

As I entered high school, I discovered the guitar (and girls); and lost interest in programming.

Enter the Internet

Throughout high school and the first couple of years in college, I used the computer extensively, but it was mostly for schoolwork and games.  I did take a few computer classes here and there, including a HyperCard class, which would also serve as my introduction to the internet. Over the next few years, I would develop several various websites, and eventually it became my full-time job.

This was not coding, but at least I was able to be creative and make a living using my computer skills. But there’s only so much you can do with HTML. To really make websites sit up and beg, you need – you guessed it – programming skills. Over the years I have learned some basic JavaScript, but even that is not truly “programming” (though it does share many similarities).

So What?

For years I have wanted to really dive deep and truly “learn” how to program. I think the roadblocks for me are:

  1. What programming language(s) to learn. There are dozens of languages and approaches. Do I learn C++? C#? Python?  Objective C? Java? PHP? ASP? None of the above?
  2. How to apply what I learn into something valuable and applicable to my career.

So rather than fumbling around blindly, in the past I have chosen not to do anything at all. Which isn’t the way to accomplish much of anything.

Along the same lines, I have been trying to come up with new blog ideas. So this week it just hit me – why not blog about my attempts at learning how to program? I have no idea if this will be of interest to anyone else, but hopefully it will give me motivation to progress. And by writing down what I’m doing, it may help with retention – which has been a stumbling block in the past.

Goals

I’m not quite sure what my ultimate goals are. Primarily, I’d simply like to increase my proficiency in programming techniques in general. Applying this knowledge to my career is another goal. Developing for mobile devices is a growing industry, and will only continue to grow going forward, so that is an area I’d like to address. And of course – games. Ever since I was that four-eyed kid in the community college computer lab, I have wanted to create my own games, so that’s certainly something I’d like to pursue – even if it’s a Space Invaders or Breakout ripoff. Of course, coming up with the next Peggle or Farmville wouldn’t hurt either.

Enjoy!

We have a walker

Colleen took her first tentative, Frankenstein-ish steps earlier this week. She is just so proud of herself!

I also need to try out some newfangled HTML5, so let’s kill two birds with one stone:

(Straight HTML5 with JW Flash Player fallback)

Seven years and counting

Seven years ago today, I was an emotional wreck. I knew something was wrong. The thing I had dreaded and feared since my dad got sick and died a few years before was now a reality.

I didn’t have an official diagnosis yet, but I knew. A few weeks prior I had been at the Y, really pushing myself. What felt like a good workout quickly turned into a severe pain in my lower abdomen. As I was poking around trying to figure out what was wrong, my hand grazed something hard that shouldn’t be there. I immediately recognized what it was, but didn’t want to admit it to myself.

Cancer.

It took a couple of weeks of sleepless nights before I made an appointment to see the doctor. Even then, I was too afraid to bring it up, instead asking for something to help with my insomnia.

Finally, the Thursday night before Memorial Day weekend, it came to a head. I could no longer ignore it – I either had to face the truth, or it would kill me.

I don’t generally believe God speaks to us in an audible voice – at least I’ve never experienced that. But as I prepared to call my mom to let her know what was going on, I felt His presence in a way I haven’t before or since. If I could put words to that presence, it would be “Don’t worry – I am with you. We will get through this together.”

I won’t go through the whole ordeal again, as I’ve blogged extensively about it in the past. But I feel compelled to document where I am around my cancer anniversary every year. While there are other days I could celebrate – the last day of chemo, the first day my tumor markers dropped to the normal zone, the day I was given the all-clear by the oncologist – I choose to celebrate the anniversary of my diagnosis. It’s the day that changed my life permanently – I became a cancer patient, and eventually a cancer survivor.

Going through a serious illness has a way of bringing your life in laser-sharp focus. The week after my first round of chemo, I was at a neighbor’s pool (oblivious to the fact that chemo makes you much more likely to get sunburned… but I digress). As I was trying to relax and ignore the waves of nausea and heartburn, I was thinking about my life and what I wanted out of it. I always wanted to be a husband and a father, but at that moment it became my primary goal. As I am realizing more and more every day, life is short. But it’s too long to go through alone.

I think back to that day, and look at where I am now. Seven years later, I’m a couple of weeks away from celebrating my first Father’s Day. I am blessed with two of the most amazing girls one could ask for – my wonderful wife and my adorable daughter.

Life is good.