So far on this blog my posts have related to the hardware I am using in order to help refresh and regain some software development skills and then take these skills forward into learning some new areas. In order to do so however I first needed to establish which existing skills if any have become redundant and which skills will take me forward.
Right from the early days of software development, programming languages have been split into two main types ( low level and high level ) languages. To anyone who has not even looked at a few lines of programming code these differences may already be very confusing so lets make these definitions very simple.
The best way I can think of to simply describe what a programming language is, is to make it very clear from the start that all programming languages do is ask the computer to perform very simple things, these being to tell the installed CPU and hardware within the system how to perform very basic operations. At the very lowest level these operations and instructions are usually to move data from one location to another (i.e. move data entered at the keyboard to a memory location and then copy this data to the screen ) . Other operations can be based on performing basic mathematics on data.
In order to perform very complex operations using a computer system the system needs to perform many millions of operations per second. Even when it looks like your PC or tablet is doing nothing it is checking if you just tapped the screen or pressed a key on the keyboard, checking if your installed applications need updating and checking if you have new emails. There are many millions of things being performed in the back ground of an operating system like Linux or Windows without you even realizing anything is being performed at all. An operating system is just a set of programs packaged together in order to perform all of these tasks.
Returning to programming languages and their defined levels, these being ( Low level and High Level ) – in a Low level language the programmer deals with coding every single instruction that has to be performed by both the computers CPU (Central processing unit (i.e. Intel I7)), in a High level Language the Programmer uses a per-written set of commands that make up the defined Language (i.e. C++ or Python) to construct a program to perform a set of designed functions (i.e. locate your GPS location and store it for a future return!). At this higher level the programmer is dealing with how and when procedures will be performed, without having to deal with the much lower level of each direct CPU of hardware instruction ( i.e. the command PRINT in python is a pre-written command that consists on many machine level instructions. all performing what looks like in a high level language a single instruction !).
Way back in the 1980’s if/when you purchased a computer for your home and first turned it on, it was very clear that it was your task to get involved with programming it in order to get it to do basic things for you. Many early computer owners did so and learned to write their own code.
If you wanted to get someone else’s programmes you could get a listing of their program and key it all in or get a copy of their code on tape and later on a disk.
Today Linux as an Operating System remains one of the best OS for as many people as possible to continue these open development skills, for one simple reason. If you get to be very good with programming applications on linux you will notice that all the source code for the operating system itself is freely available and fully documented. This is not the case with Microsoft windows where both the programming tools come at a premium cost and the knowledge of how to code in windows is only available, if your in a position to pay for it or be given it as a software developer.
My personal objectives as I said at the start of the post are to define which areas of development tools I can use to work with systems such and the respberry pi and cubieboard in order to produce software. I can use this software to learn and do some of my own electronics projects.
So lets move on here a little !!
The following lists show the programming languages that I intend to use in order to get my projects going, there are many more in the Linux and GCC free repositories but I consider these languages to both be current and well supported into the future and as such worthy of learning and working with.
Available Linux Programming Languages.
Low level
Assembly Language
( Available using the GCC compiler applications (GCC and AS))
Assembly language is written in such a way that it performs one single hardware operation per written instruction. It can however be structures and fully documented within the code.
Gforth – GCC programming language
Some consider Forth to be a higher level language in its structure but in many ways it is much closer to Assembly Language. I feel that this is so because the programmers of this language have to make uses of direct memory addresses to store data in and use these memory addresses in both mathematical functions and data movement operations ( moving data around the system) . It also make direct use of the CPU’s data stack features to store both memory addresses and binary data.
Where Forth is a little higher level than Assembler is in the fact that you code in Forth by adding words ( routines ) to the base Language, the base level language comes with predefined standard words.
I will come to this below but Forth runs in both Compiled and Interpreted execution modes.
The learning curve !
As a note here, if you use low level Languages to develop applications on any type of computer system you have a couple of options to help you produce usable and fully functional applications.
Firstly, you need to get in place all the available development information on your computer system including the (CPU instruction set, key system memory addresses for registers and I/O , any other instructions that you may need for I/O such as screen graphical functions, hard disk operations etc….).
Secondly, you can get together (Using as many web sites (i.e. the GIT development database, forums and blogs etc…) along with books) a personal repository of code that others have already developed to both use within your own code. however for your own skills just cutting and pasting is not a great idea. Try to find code that is well documented with comment and learn exactly what this code is doing. Once you understand it you will be able to make good use of shared program code and also you never know even improve on them!
Using both the above methods for low level language coding, you will learn much more about your Personal computer hardware and just how it is programmed to perform functions. This is the reward for what is actually and much harder path than instantly taking the High level language route.
High level Languages
Firstly it is worth noting that High level computer Languages have evolved over the years from early versions of languages such as COBOL. FOTRAN and BASIC that were procedural and structured in their form and construction, into Languages such as ( C++ and Python ) that take on a conceptual format that is referred to as object orientated programming. When I first started programming for a living way back in the late 1980’s I worked with and two IBM Languages on the IBM system 38 and then AS400 systems, these Languages were, CPL – Control program language – used to act as a system related script for moving and copying files etc… and RPG – report program generator – a high level language that was used for data base processing and related functions. At this stage languages such as these were procedural in their nature.
I can remember the first time I read about Object orientated languages and feeling a little puzzled as to what the need was for a move towards them.
As this blog develops I will come back to these very different methods of writing code but I will say that I still find reading procedural programs much easier and intuitive , object orientated code is very good for large scale programs, with many thousands of lines of code but most programmers don’t write code this large and I feel that reading and documenting procedural – structured programs to be much easier up to a reasonable size.
The last difference between these types of high level programming languages is relating to how the program is executed in the following ways:
Interpreted : The finished code runs as an interpreted program, processed by a lower level application called an interpreter which reads each line of code from the program file and then executing it.
Compiled : A program called a compiler reads your code file and converts it into an executable binary file which your computer can process and run directly. The compiled program file is standalone and is run directly by the operating system. All commercial software is delivered in this form.
I have selected the following three Languages for my high level language programming :
Bash : for Linux shell scripts
Bash is a Linux shell environment and as such you can write operating system level scripts using commands in bash. All code is run in interpreted mode with the Bash command interpreter reading your script file commands and executing them at a system level.
Bash scripts take the form of structured programming only.
I will use these scripts to control such things as file backups, selecting which applications need to be called for processes and controlling application configuration files.
Python : Python application programming
Python is an interpreter based language that can be used to run single commands or programs that are stored in a program file or script.
You can find a version of the Python Language for almost any computer related device produced during the last 20 years, it has however kept evolving and is very popular today. While it runs through the use of an interpreter it can be fast and very stable with full error checking.
It can be used in structural or object orientated forms.
It can be extended by loading library files that contain hardware or other functions along with any extensions that may be needed in your programs such as graphical procedures for games or design software etc…
It is extremely well supported and as such easy to learn, with many online support sites containing sample code and videos etc.
C++ : C++ Application programming
C++ is the most used and supported of the current programming Languages , MS Windows and Linux are written in C++.
Like I said earlier the Linux operating system being referred to as an OPEN systems environment shares all its source code, not only to developers and software company’s but to anyone. This is not to say that anyone can just go and change Linux.
What it does mean however is that you can obtain the source code for all of the Linux operating system and read your way through it and if you so wish you can re-write you own installed version of Linux to perform your own functions in the way you would like them to act.
As such learning and writing code in C++ is a given and a must for anyone who is into coding applications.
C++ is a complied language
C++ like Python uses Library files to extend its scope and you will soon find that you need many library’s in C++ as they are even a core part of the language structure as standard, allowing you to extend the size of your code to match your applications needs.
It can be used in structural or object orientated forms.
C++ is like Python – Extremely well supported in both online and printed media formats.
Like a say its is a given to learn this language so I will be share lots of code in C++
OK that’s it for this post , well done for getting down here !! ←
In summary these details layout everything I will be doing from an application development stand point, in this blog so I hope it been worth putting together and for you to read.