A few years back I attempted Harvard's CS50 after seeing how often it was recommended as an invaluable resource to self taught programmers. Unfortunately, CS50 is heavily lecture/video oriented and I have sensory issues when it comes to watching the videos. I never even made it through the first lecture.
After coming back to web design and discovering that, this time, I was much more interested in the development side of things, I decided to check out CS50 again. I was delighted to find that they now had accessibility options, including full transcripts of the lectures which I could follow along with.
As a side note, my example here is but one of many which shows why accessibility on the web is necessary.
Programmers Solve Problems
Programming is not about the code you write nor the language you write it in. Programming is about solving problems. Then CS50 broke problem solving down to this most basic element of computer science.
Problem solving is the process of taking some input (a problem that needs to be solved) and generating some output (the solution to the problem).
I saw this lesson cemented when I moved on to week 1 and started doing the exercises in C, a language I've never even looked at before. I found myself not worrying about the syntax or trying to remember terms. Instead I was focused on how the particular language I was working with, C, and seeing how it can be used to solve problems.
Programming Logic
Ultimately, when using a programming language, it comes down to figuring out how to solve a problem within the limitations of that specific language. This is why it's more important to be fluent in programming logic than in any one particular language.
To begin to understand programming logic you need to understand how programming a computer actually works. How do we give a computer instructions? How does the computer process those instructions?
Binary
We communicate with computers using a binary number system consisting of 0 and 1, with a bit being each individual binary digit. Computers are made up of billions of transistors that can be switched on and off, manipulating the flow of electricity. A bit is represented by turning a particular switch on or off to represent a 0 or 1. Different types of information is conveyed using patterns of 1s and 0s.
Algorithms
The next step in understanding programming is understanding the algorithm, the step by step instructions that we, as programmers, feed to the computer allowing it to solve a problem (transforming input to output). It's funny that I had always heard so much about the algorithm and it was always made to seem like such an illusive thing. Probably because no one ever knows how google's seo algorithm works. But, though the practice is hard, it's really such a simple concept.
An algorithm can be written in any programming language, expressed using a flow chart, or with pseudocode.
Pseudocode
If you had to be completely fluent in one language and one language only, it should be pseudocode. Okay, that's kind of a trick answer since pseudocode isn't really a language at all. It consists of writing out the algorithm, the steps that the computer must perform, in your own written/spoken language.
The example below from CS50 covers the important elements common to all programming languages. It's best to write your pseudocode with the terms used in most languages such as if, else if, else as well as the proper indents.
- Actions / verbs -- pick up, open, look -- are referred to as functions.
- Branches that lead to different paths -- if, else if, else -- are called conditionals.
- Questions that decide where we go, true/false statements -- is earlier, is on, is later -- are expressions.
- Words that make us repeat parts of the program -- go back to -- are loops.
Pick up phone book
Open to middle of phone book
Look at page
If person is on page
Call person
Else if person is earlier in book
Open to middle of left half of book
Go back to line 3
Else if person is later in book
Open to middle of right half of book
Go back to line 3
Else
Quit
Conclusion
I never would have thought that CS50 Week 0, a lesson I assumed would be more setup and prep than anything, would teach me such an important lesson. Whenever I thought of programming before I always thought of specific languages. Now the way I think has shifted and instead of considering programming languages, I consider the language of programming.
Top comments (0)