Fundamentals of Programming

A programmer compiles a set of instructions into a program. So at its essence, a program is simply a bunch of instructions that perform a given task. Those instructions use branching and repetition to form a kind of narrative.

For instance, imagine you need to go shopping for groceries. First, add items to the shopping-list. While scanning kitchen, if milk is less than half full, add to shopping-list; if container of popcorn is empty, add to shopping-list. Now goto the store. While not at store, drive – if impeded, press brake, else press accelerator. Now enter the store. For each item on shopping-list, add to cart.

function scanKitchen():
  if(milk < milk.contents / 2)
  if(popcorn == empty)
  return list    

function drive():

function shop(list):
  for each item in list
//call these three functions in the appropriate order:   
list = scanKitchen()

if statements take the program on different paths depending on whether a condition is true or false. Whereas while / for statements create loops that keep certain commands repeating.

Putting objects in groups, such as the shopping-list, is another fundamental concept. An array of items is easier to keep track of as a whole, and such a list can be quickly scanned and processed.

To tell the story, you’re going to need some action commands. For instance scanKitchen is a function you call upon to look through the pantry and fridge. You simply invoke it, and it returns a list of needed items. You can then print those items onto paper — or order them online — the list is yours to do as you wish.

Different programming platforms provide various built-in commands to play with. Some programming environments offer minimal pre-made functions and some offer extensive libraries of functionality to call upon. The work that goes into a program comes from assembling the provided building-blocks. This includes finding the appropriate commands and properly invoking them, as well as placing those instructions in the right order — and of course you can adjust this order by using conditions and repetition.

An Old Friend

I’m nearing the end of the official Python programming-language tutorial. My interest in programming was recently rekindled and Python seemed a decent re-entry point — especially because there’s a fully operational scripting environment, known as Pythonista, that runs on the iPad.

I suppose you could say I used to develop software professionally — until I stopped a few years ago. It feels kinda good to get back into programming. I don’t have any professional aspirations, it’s just a hobby like when I first started many years ago. At that time, coding seemed like such an impossible feat, then it clicked and off I went.

My first experience with programming was Microsoft’s Visual Basic, almost 20 years ago. I was excited to install and begin coding — yet I couldn’t decipher the code, it just didn’t make sense, like trying to read a foreign language in an unfamiliar alphabet. Then I read an intro-to-programming book, one used in college classes — it used the C language and some included libraries to teach. After finishing the book, I went back to the Visual Basic development environment and surprisingly it made sense. The process of working-through the book seemed to unlock an ability to program.

But I still struggled with programming in the sense that doing anything interesting was complicated. Sure you could effortlessly place a button and update a text-box, but things got complex real fast when going beyond the basics. I was stuck with too-simple or too-hard so I stopped programming for a bit. Then a new way to write for Microsoft Windows came out, called the .NET Framework. I really liked C-Sharp and the large library of functionality that came with it.

But unfortunately, it still had its limitations. Just like before, writing long lines of complicated C/C++ code was the only way to do the most interesting activities. Yet .NET was decent enough at developing moderately interesting applications. I had also tried web-programming, like PHP and such, but found that a bit cumbersome compared to desktop-app programming. I liked visually-oriented programming rather than slinging and storing data into databases.

Yet when it came time for finding a professional outlet, PHP and ASP.NET were the easiest positions to find so I did that, learning as I went. I was pretty good though, very meticulous. I didn’t much care for the business side and eventually burnt out. Not too long afterwards I tried my hand at developing Apple Mac Apps in Objective-C but found the language too unwieldy and old-fashioned especially coming from C#. I did sell a few apps in the Mac App Store but nothing significant.

I do appreciate Apple’s new Swift language. I really like their Swift Playgrounds app for teaching kids about programming. Although I think anyone using it might need access to an experienced programmer because it seems a bit too challenging otherwise. X-Code on the other-hand, Apples’s full-featured development environment needs a serious paradigm shift in my opinion. I was not pleased with what I recently saw in an official tutorial — linking up code to the graphical parts of the program seems cumbersome. It makes me miss the ease of C# and .NET from over a decade ago.

In a sense, I think of programming as a means of expression. Like a painter expresses with brush on canvas, a programmer expresses with code in compilers — or a writer expresses with words on paper. I often try my hand at art/drawing apps but eventually abandon them because I fail to enjoyably express myself — I typically can’t create something I admire. Whereas in writing, I’ve written a lot of things that amuse or impress myself. I can’t say that I’ve made anything impressive with programming, but I often find the process fun because of the learning and problem-solving involved.

But that’s been my underlying issue with programming, an inability to create things I’m impressed with — thus I can’t completely express myself. Instead, I regularly come up against insurmountable limits that stop me on my path. Oftentimes the complexity rises to a point that shuts down the fun. Although, perhaps my impatience is to blame. Many of the programs we use daily are like living breathing entities that have their creator’s souls poured into them. Maybe I wasn’t willing to put that much effort into an individual project.

Yet I suppose that was another issue I had with programming: finding a worthwhile project in which I could pour my essence. Which is why I’m writing words nowadays instead of code. I enjoy writing words and I can express myself to a great degree. But similarly, I don’t like large writing projects, I’d rather just transcribe some snippets of thought on a regular basis. Writing, programming — really, they’re just a means to entertain my mind, giving my thoughts something to do, a purpose.

I have no point in my late-night rambling beyond an acknowledgment to an old friend that’s come back to visit. Will he stay? Who knows. But it’s good to see him while he’s here. I’ve missed you buddy. How many late nights did we spend together? All alone in a world of our own. How many guises have you worn? C, C++, Visual Basic, Java, PHP, Javascript, C#, Python, Ruby, Objective-C? You old son of a bitch, stumping me whenever you could. But I got my licks in here and there.

Well goodnight old friend. May your loops never be infinite and your memory always well-managed.