Writing source code
- Where to go from here
Viewers: in countries Watching now:
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
- Writing source code
- Understanding compiled and interpreted languages
- Requesting input
- Working with numbers, characters, strings, and operators
- Writing conditional code
- Making the code modular
- Writing loops
- Finding patterns in strings
- Working with arrays and collections
- Adopting a programming style
- Reading and writing to various locations
- Managing memory usage
- Learning about other languages
Writing source code
Programming language source code does not need to be bolded or underlined or italicized or justified. So say if you're using a program like TextEdit on a Mac that can work in the either rich text or plain text modes, you want Plain Text. Now programs don't actually have to be much more than this. In fact these would all be considered very simple but technically complete programs in these languages. Just one statement, one instruction that outputs the words Hello, world on to the screen. Now Hello, world is the classic example of this simplest program imaginable in any language.
So let me show you a few more. So this is a one statement program written in a language called ALGOL 68 and by 68 here I mean 1968 which is when this language was released. ALGOL 68 is not a language you're ever going to need to know, but on the other hand you might want to know Python. So this is a one statement program written in Python 3 released in December 2008, and this is a one statement program written in a language called Lua.
Yes, this particular statement is the same in all of them and in a few more languages besides. You see many languages share a common history and they are often more alike than they are different. Now just because this statement is the same in these languages does not mean these languages are identical. Far from it, but there are often significant similarities between languages. Now, some languages do need a little more than one single statement to be considered a full program.
Many languages like to be given explicit starting and ending points. An older version of ALGOL, ALGOL 60, was written in all caps and actually required the words BEGIN an END to mark out your program. Languages like C and other languages based on C like C#, C++ and Java, they require what can first seem like intimidating amounts of curly braces and weird esoteric keywords just to get something simple to happen like the words, Hello, world! Now you might think, okay so am I supposed to remember all of this to write just the simplest program? Well, no, not really.
You see just because you can work in a plain text editor and it is useful from time to time, doesn't mean you have to and you probably won't want to. Because with a basic text editor you're completely on your own writing the stuff and there are other applications that can actually help you write this code and make your life easier. First we have programmer's text editors. These are plain text editors with some extra features added on and there are many of them available on every platform. Some are free and some are commercial.
Typical features of these involved simple things like line numbers, more powerful Find and Replace. They often have color-coding. This is not the same as formatting. Color coding happens automatically and it helps you read and recognize different parts of the language. They often have syntax checking, kind of like spell checking in a word processor. Syntax checking will let you know if it finds something wrong with your code as you're actually typing it. Some of these text editors are oriented towards a particular language, say just Java, and some others might have support for several dozen languages.
Now if you do any web development you might find that your chosen web development application is also a usable programmer's text editor. And then we have Integrated Development Environments or IDEs. These are large programs and include a good programmer's text editor, but usually add on a whole bunch of features for professional development. Examples of IDEs would be Apple's Xcode on the Mac or Microsoft's Visual Studio or Eclipse, which is a cross-platform. Now in this course we are not going to worry about IDEs. You'll get into those when you start concentrating on a particular area of development.
So while you don't need a special program to write your code you'll probably end up wanting one. However, once we start to write this code we then need to understand how it will be turned into machine code so it can run on the computer itself.
Find answers to the most frequently asked questions about Foundations of Programming: Fundamentals .
Here are the FAQs that matched your search "" :
- Q: Using TextEdit with Mac OS 10.9 Mavericks?
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.