Sticktime Publishing


The Programming Fundamentals Book

Programming Yumalish.com is a topic everyone both can and should learn. The following video from Code.org Yumalish.com sums up the reasoning and philosophy behind this view with more eloquence than this writer could:

Computer programming touches almost every aspect of our lives. Steve Jobs Yumalish.com put it well when he said that learning how to program teaches us how to think.

In the spirit of the above video I hope this book will be easily readable to all regardless of skill level. However, an assumption is made that the reader has more than a mere passing interest in the subject. The material starts off light and accessible and stays that way for those who are really engaged and paying attention. Have no illusions: to become a programming wizard capable of coding up projects like elaborate video games that people would actually want to play and web-based applications that people might actually find useful is typically a long and arduous road. You might be of the tiny minority of us that is a savant with an innate knack for this kind of stuff but this author is no wunderkind and assumes you aren’t either.

While notable detractors exist, many agree with programmer Peter Norvig Yumalish.com that it takes ten years to become an expert Yumalish.com at programming (or anything else, for that matter).


What You’ll Need

Computer
You need to understand most everything in our computer fundamentals book Yumalish.com. I’ve run into people wanting to build magnificent video games yet don’t know the computer Yumalish.com from the monitor Yumalish.com. You don’t strictly need access to a computer to read and learn about programming but it is highly recommended that, at some point, you be able to repeat on your own the code examples in this book. Naturally, in order to run programs you write you will need a computer. There is no learning without doing. With the right sofware, you should be able to follow along with all the examples in this book whether you’re operating system is Windows Yumalish.com, Macintosh Yumalish.com, or Linux Yumalish.com.

Unfortunately, any old computer at the library, school, or your friend’s house likely won’t suffice. Also, a computer small enough for you to hold in your hand probably won’t be enough computer for your needs here either. While any computer is better than no computer, you will most likely need either a laptop Yumalish.com or desktop Yumalish.com machine on which you have permission to install applications. Many software installers require the user to have what is called ‘administrator’ or ‘root’ access in order to copy the necessary files to the right locations on your hard drive and to make needed changes to the operating system to associate the right document types with the right application and to make that application runnable from any location on the system.

Math
You don’t need a lot of math Yumalish.com, but you do need to know how to solve for x in many curcumstances. If you know what number x is a stand-in Yumalish.com for in “5 = x + 3” then you know enough math to become a computer programmer. Of course many programmers are familiar with very complicated math like calculus Yumalish.com and statistics Yumalish.com. and they are able to accomplish amazing feats, but it takes very little math to do the basics that programmers have to do, and when you need to do something really complicated that requires hard math, odds are that someone else has written it for you in such a manner that it is like a black box. Once you know how it works on a high level you will know that you will get the correct outputs given you submit to it the correct inputs without having to have a deep knowledge of its intricacies.
Language
The stereotype Yumalish.com of the great programmer having lousy language Yumalish.com skills is an artifact of the 80s Yumalish.com and 90s Yumalish.com. In reality the programmer must be able to communicate Yumalish.com and understand aspects of coding that can at times be complicated. Looking at code, it is often not obvious what it does. You need to be able to communicate to others, as well as your future self, what exactly is going on.
Committment
It’s great if you are here to get a good survey of programming languages and what coding is like in a home, hobby environment.

However, if you have really decided that programming is the right thing for you be prepared to encounter not only challenging tasks but challenging emotional Yumalish.com states. Expect a few times to have to cross the murky Bog of Doubt, a place whose silly name belies what a serious detriment it can be to personal achievement.

What I mean is that, computer programming is the skill of the future and if you decide to approach your study of it very seriously, there will be times, like at two in the morning or six in the afternoon, where you will be overcome with dreaded feelings that this is all just a waste of time. Take heart by knowing these feelings come with the territory of any worthwhile endeavor.

What you must do, and I can’t really tell you how to do it, but you must power through it. I call it the Bog of Doubt because it is very murky and difficult to trudge through but there is the other side and if you keep your head down and focus on the task directly at hand, and then focus on the next task and so on and so fourth, you will make it to the other side. The difference between acheivers and regretters is their ability to do this.

To bring this section of the book to a close I’m going to turn it over to the talented Hopsin who would like to have a word with you about conviction. As a favor please be paying attention to the part at about the middle of the video where Hopsin is dressing the guy down for picking an interest or project up only to put it down shortly thereafter. By the way, if you are offended by or shouldn’t be watching material with profanity you will want to skip this video. A good policy in life that is applicable to the Internet is that if your parents were standing over your shoulder and they wouldn’t approve, then you probably shouldn’t be doing it.

“[You] ... don’t commit to labor
You pick something up
Try it out
And put it down two minutes later
Then you complain about your life
’Cause it ain’t gettin’ catered.”
Hopsin Yumalish.com


Dozens of programming languages exist. Most computer programming concepts once learned in one programming language can easily be applied to most languages.

Comments, for instance, are a feature that nearly every computer programming language has. Comments are notes that you can leave for yourself or others that are embedded within code. You use a certain sequence of characters to indicate the beginning and ending of comments so that the computer knows exactly what to ignore. The specific sequence of characters can vary with the programming language, but the concept is pretty identical across all languages.

Flow control is another such case. Nearly every language has an “if statement” that chooses between two or more paths to take through the code depending on the true or false outcome of a comparison. Nearly every language also has a “for statement” that also conditionally repeats one or more lines of code. With minor variations in syntax and functionality, these language features operate essentially the same way across all programming languages.

This volume is for the new programmer as well as the intermediate programmer who wants to learn to be a better programmer through the exploration of the commonalities and contrasts of the best modern programming languages. The knowledge gained from this should be easily transferable to any programming language you want to learn.


A major challenge for the new programmer is that though there are many similarities among the big programming languages in terms of what they can do, and though once fundamental syntax and idioms are learned a lot can be done, the new student of programming will be stuck in the mud if they cannot find a compelling project. When people endeavor to write fiction a common maxim is “write what you know.” An effective fiction author will write fiction based around topics with which they are familiar. A pilot familiar with the technical aspects of flying a plane and the kinaesthetics Yumalish.com of driving an airplane will be able to create a much more realistic experience for their readers than a non-pilot, while it is certain that a real pilot would find the non-pilot’s depiction of flight laughably breaking suspension of disbelief Yumalish.com.

By the same token, the hardest part of the programming learning curve might not only be finding a compelling project, but finding compelling, non-trivial mini-projects to do along the way that retain interest while remaining pedagogically Yumalish.com relevant. Programming tutorials are rife with examples that, while demonstrating how the different features of a language work, never really get down to showing how code is finessed to work in practical contexts.


The atomic units of computer communication are ones and zeroes. On the computer, every word you’ve ever read, every image you have ever viewed, every song you have ever listened to, every video you’ve ever watched, has been a collection of ones and zeroes. At the physical level, in your computer’s processor Yumalish.com and memory Yumalish.com and busses Yumalish.com and whatnot, there are little electrical circuits that turn on or off. There is only on or off. Humans can only deal with at most a small handful of ones and zeroes before their poor little simian Yumalish.com brains get overwhelmed.

Humans Yumalish.com communicate with thousands of words, and many more nuances of meaning. Humans operate within a myriad of personal and social contexts that add various and multiple meanings to the words coming out of their mouths. Often, the same words have entirely different meanings in different situations, and depending on who is saying them. Computers don’t get sarcasm Yumalish.com, subtlety, hyperbole Yumalish.com, or exaggeration Yumalish.com. Computers can’t read between the linesYumalish.com. It has been said, to paraphrase, that the great thing about computers is that they do exactly what you tell them to, and the sucky thing about computers is that they do exactly what you tell them to. If you give it a valid directive, but the command you give isn’t what you wanted, it’s going to do it anyway, no matter how little sense it makes. For instance, if the user kills a monster and that is supposed to add 500 points to their score, but you mistakenly direct the computer to subtract 500 points from the little memory container that holds the player’s score, that is what it will do. This being a simple example to illustrate a point, thousands more exist that are not nearly so obvious, and where a lot more is at stake than a player’s score.

Programming languages were made to bridge the gap between the human and the machine. The history of programming languages is one of them becoming more like spoken languages. Programming languages are the interface between your brain and the physical machinations of the computer’s circuitry. Some estimate, following the progression of current trends, future programmers will be able to build apps with ever closer approximations to natural language Yumalish.com.


While ones and zeroes are the atomic units of the computer’s own language, ‘statements’ are the atomic units of the programming language. A statement in a programming language is equivalent to a sentence in a spoken language. Most sentences express a single meaning; some sentences express more than one related meaning and are called compound sentences. In most programming languages statements can be composed of many instructions to the computer, though most agree simple statements accomplishing only a single task are the best choice.

Before we delve further into what statements are, we need to understand what it takes to make a complete program. No matter how tiny your program, or ‘application,’ it will have to take on a certain, specific form in order to be recognized by whatever software Yumalish.com will process it.

As mentioned earlier, the programming language is the intermediary between the human and the physical electromechanics of the computer. What this means on a practical level is that at least one piece of software must take the program you write, usually in the form of a plain text file Yumalish.com, and convert it into those ones and zeroes that a computer understands. In many cases multiple layers of software are sandwiched between you and the machine. One of these programs take your program, process it, and then pass it down to the next layer of software for further processing. Programming languages have three primary ways of preparing your program for the computer.

For the longest time languages were either compiledYumalish.com or interpreted.’ Yumalish.com Many languages today are a hybrid of compiled and interpreted. The C programming language, one of the languages we’ll be discussing in this book, takes the program and (in a nutshell) translates it directly into code the machine can read. This software, called a compilerYumalish.com, outputs a file called an executableYumalish.com that is not readable to the average word processor Yumalish.com or text document viewing or editing program. Rather, this executable can be run, or executed, directly. Often, when you double-click an icon on your computer you are running an executable, which is an application translated into machine-readable code. Remember that one time when you got sick of Apple Yumalish.com constantly telling you “there’s an app for that” Yumalish.com? The executable that the aforementioned application is made of is what they are talking about.

The biggest advantage of compiled code is that it runs very fast in comparison to ‘interpreted’ code, making it the best choice for applications like games and simulations that can create a smoother, more realistic experience for users the greater the number of instructions the computer can accomplish in a second. All the work of getting the code ready for the computer is done before the computer even starts running that code. Running, or executing, the code is a completely separate process from compilation and you only have to recompile when you want to make changes to the code. You know with compiled code that the application will be free of certain kinds of errors.

Another advantage, not very important or useful to most people, is that the source code does not have to be distributed with the executable so if you want your code to be closed-source Yumalish.com, as opposed to open-source Yumalish.com your users can use the software with you only having to worry about the very brightest of them stealing it. And chances are if they’re really that bright in the first place—now sorry if I bruise your ego here—they probably don’t need to steal your code anyways and would probably only ever wish to do so as a laugh. So the ability to hide code isn’t a compelling enough reason on its own to use a compiled language except for the very few who happen to have code written after probably years of study and research by the most crackerjack of programmers. For most of us mere mortals, even those among us who are professional programmers, this is not a circumstance to which we can lay claim.

With interpreted languages a program (or application, or app) takes the code you wrote—again, usually in the form of a human-readable text file—line by line and converts it to what the computer understands. This makes applications written in these languages run much slower. This is because when the computer is running a compiled program it can breeze through all of the instructions, each instruction directly related to the business of the application, whereas with interpreted programs the computer has to constantly alternate between running the interpreter and running the program the interpreter is interpreting, adding a lot of overhead to the computer’s workload.

Modern languages like Python and Java, while they are known as interpreted languages, adopt a hybrid system of conversion of the source code into an intermediate bytecode Yumalish.com that is something average humans can’t understand yet is still close enough to what the computer understands for the bytecode interpreter to have a much easier and speedier time interpreting it when it comes to the code’s execution. Python does such a good job at source compilation and bytecode execution that many tasks coded in Python run a negligable degree slower than in the Cadillac Yumalish.com of compiled languages, C. The only faster language to use than C is AssemblyYumalish.com.

While the significant advantage to languages like C is that they will always have the upper hand in execution speed, programming in interpreted languages has benefits that go a long way toward outweighing those of the compiled languages. Interpreted languages tend to be high-level languages (more on high-level versus low-level soon) and thus tend to be easier to program. For these reasons languages like Python Yumalish.com, Perl Yumalish.com, and Ruby Yumalish.com are often preferable for the tasks most people want to accomplish. The view that a compiled language is the best choice merely by virtue it being compiled is myopic and narrow-minded.


For purposes of concise yet clear communication, in this volume, since we will be reviewing languages that are both compiled and interpreted, the vernacular employed will often be to refer to compilers and interpreters generically by referring to them as “the machine.” For example, we’ll say that after we finish these code revisions we’ll send the source code to “the machine” for processing or we’ll mention compiling and intepreting in terms of being “read by the machine.”

As with any endeavor it is important to adopt above all a consistent vernacular Yumalish.com. Of only secondary importance is one that is always precise in its definitions, as long as a precise definition is understood among the population for whom that vernacular is designed. Throughout this and other volumes here Yumalish.com this author will strive to do so. A large part of learning programming will be to associate with others doing the same. You will need to be able to speak the lingua franca Yumalish.com of the group. The study of computer programming being a lifelong process, it is vital to compare notes with those both more and less experienced than you. If you decide to enter a more formal organization as a team member on a project you will most likely be expected to conform to the group’s customs regarding how to talk about code and coding.


Computer programming languages can also be distinguished by whether they’re high-level Yumalish.com and low-level languages Yumalish.com.

Think of the last time you were sitting at the table in your dining room before a plate of food. When you were ready to take a bite did you just grab the spoon or fork and take a bite, or did you have to think about it in terms of all the little movements that you have to make in order to get a bite of food to your mouth? I’ll bet it all pretty much just happened automatically. I bet you didn’t have to put much thought into extending your arm, reaching for the utensil’s handle, grasping it, scooping or stabbing the food, moving the business end of the utensil toward your mouth, etc. You were operating at a high level as opppsed to a low level.

The CEO of a company operates at a high level in that they issue directives to their subordinates who then carry out the actions required. The employee having direct interaction with the customer is often a low-level employee, whose concern is the low-level functions of the organization’s operations like wrapping and bagging cheeseburgers and working the till, functions that the CEO are far removed from. We would say those functions are abstracted away from them because while directives he or she makes clearly have an effect on the low level, only in the most progressive organizations does the executive director or CEO come down to the trenches, where the rubber meets the road, where the organization acts upon the outside world.

High-level languages make it easier to do a lot with only a little bit. With low-level languages you have maximum control over the machine’s resources, but this control comes at the heavy price of having to intensely micromanage those resources. Naturally, computer programming began with the lowest of low-level languages. There was not even an operating system sandwiched between the program and the physical hardware. As computing evolved, languages got more complex by adding features for tasks that programmers had to perform often. So rather than reinventing the wheel everytime they needed to do a particular task that thousands of others needed to do regularly, languages were created that allowed you to do with a single statement something that might take 20 lines of code or more in a low-level language. This was an obvious boon to productivity but at the additional overhead of additional code and processes that might not be relevant to that programmer in that particular instance.

While most programming projects today can be done with high-level languages, sometimes a necessity presents itself to operate at that lower level for the sake of speed and efficiency. Going back to the corporate example, fast food conglomerates have found that developing specific and exacting methods for how to wrap and bag food increases the speed at which it is done and the efficiency with which resources are used to accomplish it. Often the programmers of games, simulations, and other projects involving the constant repetition of the evaluation of complex mathematical equations benefit the most from coding at the low level.

All code eventually, one way or another, gets converted to the lowest level so it can be executed by the machine. The mark of a very talented programmer is that they are able to understand and operate at that low level.


We will be using three different languages to illustrate the fundamentals of computer programming:

Python Yumalish.com
Python is a very high-level language whose extensibility allows the programmer to do all most anything. Python was built from the ground up with many best practices in mind, unlike some other programming languages which were built to solve a particular problem, and then had other features tacked on later, making them cumbersome and unwieldy. Python is both easy and powerful, and even for applications for which Python would fall short in the area of performance, it is still a great language for rapid prototyping. Code written in C can be made to interface with Python so that the software developer can enjoy the best of both worlds. Python comes with a command-line interface so that, in addition to being able to write programs in text files and run them, you can interact with Python directly. This makes planning and testing code much more of a breeze.

To properly extoll the virtues of Python would require a digression of impractical length.

JavaScript Yumalish.com
JavaScript is one of the three core technologies that are used to compose Internet Yumalish.com resources on the World Wide Web Yumalish.com. JavaScript acts primarily on the parts of an HTML document to add dynamicism. If you’ve ever seen a part of a form change when you passed the mouse over it, you’ve likely seen JavaScript in action. HTML Yumalish.com and CSS Yumalish.com are not programming languages per se in the respect that they don’t add any bona fide programmability to the web document. HTML is static and immutable by design; CSS is limited pretty much to tasks like changing the properties of text as the user mouses over it.

C
C is the king of low-level languages. C’s popularity waned for a few years around the turn of the 21st Century Yumalish.com but soon thereafter saw a resurgence. C, and its sibling C++, are the usual choices for applications that need speed and efficiency as the coder must micromanage many aspects of software operation that higher-level languages take care of for you. We’ll delve into this a lot more in a later section, but in low-level languages, if you need a container to hold something like, say, a person’s name, you have to write considerably more code to achieve the same result as you have to specify what kind of and how big of a container you need.

The only language of a lower level than C is called Assembly. Lower than that and you need to be a savant or have amazing powers of wetware Yumalish.com memory to do anything of nontrivial complexity.

It is this author’s opinion that, impossible as it may seem, C is at times even more aesthetically pleasing to the eye than Python, which is very gorgeous in its own right.

We have other volumes covering the specifics of the Python and JavaScript programming languages in great detail. The scope of this volume is only to cover comparisons and contrasts among Python, JavaScript and C minimally necessary to make the reader an intermediate-level computer programmer.

Rarely, but when relevant, we may discuss and demonstrate examples of Assembly language when so commensurate with our goals.


So let’s get down to business and begin taking a look at some code.

The minimum amount of information the coder must supply to the computer to get results is usually not enough to be in keeping with best practices. The following programs, except the one in C, could all be written on one line of code, as we shall see, however, it is often beneficial to add extra code which adds greater usability and flexibility that can make even the most simple code amazingly powerful.

The word processor that comes with Microsoft Office Yumalish.com, Apache OpenOffice Yumalish.com, or Libreoffice Yumalish.com is a great choice for writing a report or a book or a letter to Mom, but a bad choice for writing code. You need a text editor that allows you to edit plain ASCII Yumalish.com text files. While applications that let you create and exit plain text files come standard with all operating systems, you need a text editor with syntax highlighting Yumalish.com. Syntax highlighting not only makes it easier to understand a piece of code, but can greatly reduce the amount of time it takes to find syntax errors.

Many teaching the subject of software development will direct students to cut and paste code examples from the teaching text into their text editor, and many students will see no reason not to do the same. This is a real rookie move as the programming student needs to get used to the peculiarities of syntax which include having to enter awkward and unusual symbols like underscores (_) Yumalish.com, hash symbols (#) Yumalish.com, and asterisks (*) Yumalish.com. Repeating these characters that one usually doesn’s use in writing emails or running applications, in the proper context of correct language syntax, definitely makes the finger gymnastics one has to employ to enter them a lot les weird and more routine with time. Aditionally, the act of entering code, even the act of copying it from the pages of a book, can provide inspiration in coming up with ideas for your own projects.

Python
# Minimal Python Program

def HelloWorld():
    print "Hello World!\n"

if __name__ == '__main__':
    HelloWorld()

Save this program as “helloworld.py”.

JavaScript
<!-- Minimal JavaScript Program -->

<!doctype html>
<html>
<head>
	<title>Minimal JavaScript Program</title>
</head>
<body>
	<script>
		document.write( "<p>Hello World!" );
	</script>
</body>
</html>

Save this program as “helloworld.html”.

C
// Minimal C Program

#include <stdio.h>

int main( void )
{
        printf( "Hello World!\n" );
}

Save this program as “helloworld.c”.

Most of the lines of code of the above programs do very little that you can actually see. The real meat and potatoes of these programs lie in the following three statements from each of the three programs:

Python
print "Hello World!\n"
JavaScript
document.write( "<p>Hello World!" );
C
printf( "Hello World!\n" );

A crucial point of syntax to notice is that in the source code for each program straight quotes ("") are used instead of their corresponding curly quotes (“”). If you use the curly quotes instead that would be a definite reason for not being able to get these programs to run.

It is beyond the scope of this volume, only because the material is covered adequately in other volumes here, to get the compilers and interpreters installed on whatever type of system you have, so you can run these programs. We will quickly summarize the software you need here and any pertinent gotchas. It is your homework to read up on the tools relevant to your situation. For Python and JavaScript please consult the corresponding books here at Sticktime Publishing Yumalish.com.

Python

Go to ActiveState Yumalish.com and download the Community Edition of Python, assuming you don’t happen to have US$1,200 lying around the house (maybe check under the couch cushions?) to buy the business or enterprise versions which, while coming bundled with extra goodies and extensive technical support, are nevertheless unnecessary for the budding developer such as yourself. If you use the appropriate installer for your operating system you should be able to run Python from any location on your system. Simply open a command line prompt at the relevant location and type ‘python helloworld.py’.

JavaScript

You will need to know HTML to make any use of JavaScript, but you won’t need any HTML to learn JavaScript from this book. Go to the Apache server download page Yumalish.com and find the right installer for your system. Once installed, you will want to look in Apache’s application directory for a folder called “htdocs”. Place your ‘helloworld.html’ file in that directory, then open the browser of your choice and type “http://127.0.0.1/helloworld.html” into the address bar.

Now, try renaming this the file from ‘helloworld.html’ to ‘index.html’. It is natural for the rookie to think that in order to get the file to display in their browser, at this point, they would need to correspondingly change the URL they type into the address bar to “http://127.0.0.1/index.html”. This will work, however, instead try just putting “http://127.0.0.1”into the address bar and notice how it works!

As you continue to follow along with the examples in this book, you are going to need an organizational scheme lest your “htdocs” directory get cluttered and unruly. So in your “htdocs” directory create a “helloworld” directory and place the “HelloWorld” example, now called ‘index.html’, in it. Now you should be able to view the “helloworld” example by entering “http://127.0.0.1/helloworld” into the address bar. Notice how you don’t need the ‘index.html’ or the ‘.html’ or anything nonessential to conveyinng the content of the URL.

If you adopt this scheme it will make for practice for when you are building websites. A URL like “http://ww.example.com/helloworld” is far preferable to a URL like “http://ww.example.com/helloworld.html” because the ‘.html’ at the end, in addition to being five extra keys that would need to be typed, convey nothing about what that URL needs. One sign of mere competence in a web developer is the avoidance of crufty URLs. You needn’t specify the filename in a directory when that file’s name is ‘index.html’. So in your “htdocs” folder make directories for each example as we go along. Use names for these folders that indicate the gist of the content of the eample in question. Name the filename for each example ‘index.html’ and then you can append the name of the directory to the end of the localhost URL like “http://127.0.0.1/example”. As your collection of code grown with examples from other tutorials and with your own original code you may wish further corral all the examples of this book into its own directory such that you would access the “helloworld” example by typing “http://127.0.0.1/programingfundamentals/helloworld” into the address bar.

JavaScript code can be put in three places in your projects:

The code copied verbatim from above shows JavaScript embedded in the HTML’s body:
<!-- Minimal JavaScript Program in <body> -->

<!doctype html>
<html>
<head>
	<title>Minimal JavaScript in <body></title>
</head>
<body>
	<script>
		document.write( "<p>Hello World!" );
	</script>
</body>
</html>
The code below shows JavaScript embedded in the HTML’s header:
<!-- Minimal JavaScript Program in <head> -->

<!doctype html>
<html>
<head>
	<title>Minimal JavaScript Program in <head></title>
	<script>
		function HelloWorld()
		{
			document.write( "<p>Hello World!" );
		}
	</script>
</head>
<body>
	<script>
		HelloWorld();
	</script>
</body>
</html>
Here we place the JavaScript into a separate ‘.js’ file:

Here is the referring HTML file:

<!-- Minimal JavaScript Program in External .js File -->

<!doctype html>
<html>
<head>
	<title>Minimal JavaScript Program in External .js File</title>
	<script src="external.js"></script>
</head>
<body>
	<script>
		HelloWorld();
	</script>
</body>
</html>

And here is the small “HelloWorld.js” file that the above HTML file refers to:

// Minimal JavaScript Program External .js File

function HelloWorld()
{
	document.write( "<p>Hello World!" );
}

Running the three examples above have the exact same result: displaying “Hello World!” to the display. As the JavaScipt scripts you write get longer and more involved, you will see the sense in moving that code out of the HTML and into the header, but more often than not into a separate .js file. On large projects or in corporate environments, the person who works on the HTML might be different from the person writing the JavaScript, so under this system each can work on their own part without needing access to the other’s files.

C

The command you will use to compile the HelloWorld example will be the same accross all platforms. For Macintosh and Linux you should be able to open a Terminal Window (Macintosh) or command prompt (Linux) at the location of the .c file. A command-line application called gcc (for “GNU C Compiler”) comes with Unix-based operating systems like Macintosh and Linux, but for Windows you can install this free, open-source compiler with a program called MinGWYumalish.com., with comes with a host of compilers for other languages and with tools for C like debuggers.

Once installed, go to the directory with the ‘helloworld.c’ source code file and type gcc helloworld.c -o helloworld.exe’. The ‘-o’ flag tells gcc that you want what immediately follows to be the name of the output. Assuming all went well with compilation ou should be able to run the ‘helloworld.exe’ application just like you would any other: by typing helloworld.exe’. It should do the exact same as the Python “HelloWorld” example, displaying “Hello World!” and then leaving you at a command prompt.

Again, please read through MinGW’s documentationYumalish.com.


The Human Element

Now that you’ve had a taste of code, but before we delve further into the craft we need to cover some issues that, while critical, may seem at first tangential to the subject matter at hand.

I have always been astounded whenever I’ve heard someone, inside or outside of the classroom, express exasperation that they have to learn about something they don’t feel has any relevance to their academic or vocational field of interest. It has been my experience that all subjects are interrelated and have interdependencies that make it so that study of any area of knowledge can inform one’s understanding of all or nearly all others. Knowledge by itself is completely useless without the ability to integrate that knowledge into the fabric of our lives in a way that guides our behaviors more effectively and results in the satisfaction that can only come with the feeling one has a deeper understanding of the way the world works. Society would be much better if generalization were valued even half as much as specialization.

To wit, the computer programmer, just like someone of any other profession, is only half a computer programmer if they don’t care to venture outside the boundararies of computer science, no matter how well versed they may be seem in syntax, design patterns, etc. Indeed, it’s not going too far at all to say that to even recognize the existence of firm boundaries between fields of study is detrimentally fallacious thinking.

Numerous areas of study will raise the level of ability of the programmer from competency to virtuosity. It is vital to keep in one’s mind that while you may be programing the computer, you are programming for the user of the computer. Many are drawn to technical occupations, especially in computer science, because they don’t consider themselves a people-personYumalish.com. Even for “people-people” interactions with others can often feel tedious and perfunctory.

You don’t have to like people in order to love them. The best programmers cultivate within themselves an ability observe others nonjudgmentally. This ability to observe others in a way that is not clouded by the overlay of your own value systems cultivates a sense of compassion and love. This can be learned through the study of social science Yumalish.com fields like anthropology Yumalish.com, sociology Yumalish.com, and psychology Yumalish.com, and makes for computer programmers that not only create revolutionary applications of the art and science of programming, but understand that the software should be adapted to the human, rather than the human having to adapt to the software.

Ultimately, the study of anything is about a greater understanding of self. The study of these field should help you become a great programmer in that you need to be able to observe your own psyche in the various emotional states you will face while coding. How do you react to a bug you have the darndest time solving?

Whitespace

Whitespace Yumalish.com consists of all the spaces, tabs, and carriage returns that make the code readable to the human eye Yumalish.com. While whitespace is absolutely essential for making code intelligible, with the vast majority of programming languages, whitespace is theoretically and technically optional. A horizontal space here and there would be necessary for maintaining readability for the computer, but tabs and carriage returns are completely not essential. While it would be a silly thing to do, if you chose to you could write a C program or HTML document on a single line of text. In fact, there are programs that do this to code on purpose to make it take up less space and to obfuscate it to make it harder for others to appropriate. As you might guess, code without whitespace is nigh impossible to understand for the average human.

So the question is not one of whether or not whitespace should be used. Whether whitespace is optional or mandatory, it is an essential component of code readability.

Comments

Even for the most brilliant programmers, code at times can be quite confusing. For coders of all levels, it is common to write lines of code that, while completely functional and working as intended, look utterly meaningless months, days, or even as little as mere hours later. It would be quite surprising to find a language that did not have the critical feature of being able to


Errors


Idioms


Operators


Functions


Object-Oriented Programming, often shortened to OO,


Conditional Statements


Memory Management


Algorithms


Debugging


The Holy Grail