Programming





“Programming is the planning of operations to be performed by computers or other automatic machines” (http://www.worldbookonline.com/student/article?id=ar716387&st=computer+programming#tab=homepage).

In order to get a robot to perform a task, it has to be programmed to do exactly that. The robot’s computer (basically the robot’s brain) tells each joint of the robot what to do based on its programming. The programming are algorithms of binary code or languages that are then converted into something of binary code, that tell the robot exactly what to do.


Computer programming - creating a sequence of instructions to enable the computer (or in this case machine/robot) to do something. (http://www.thefreedictionary.com/computer+programming)

What is Programming?

Programming, or writing softwares, involves describing processes, or “authoring algorithms.” Basically, this is developing lists of instructions, the “source code representation software”  (http://www.bfoit.org/itp/Programming.html) that tell a computer how to interact with the user, interact with the computer hardware and process data.” (http://holowczak.com/programming-concepts-tutorial-programmers/http://www.bfoit.org/itp/Programming.html). This is how we are able to manipulate objects to do something, like composing music, designing a house, etc. The Programs tell the computer exactly what to do, however that might not be what you would want.

“A computer can only understand two distinct types of data: on and off.” (http://www.codeconquest.com/what-is-coding/how-does-coding-work/). A computer is really just a collection of on and off switches, anything it does is nothing more than a “Unique combination of some transistors [or switches] turned on and some transistors turned off.”


Programming/Computer Languages:

Binary Code is the “representation of these combinations as 1’s and 0’s, where each digit represents one transitor. Binary Code is grouped into bytes, groups of 8 digits representing 9 transistors… Modern computers contain millions or even billions of transitors, which means an unimaginably large number of combinations. But one problem arises here. To be able to write a computer program by typing out billions of 1’s and 0’s would require superhuman brainpower, even then it would probably take a lifetime or two to write.” (http://www.codeconquest.com/what-is-coding/how-does-coding-work/). While binary code is a very common type of machine language, and the most known, keep in mind that there are multiple types of machine languages.

Programming languages is when that line of code is written in the Python programming language. Basically it’s a “programming (or coding) language is a set of syntax rules that define how code should be written and formatted. thousands of different programming languages make it possible for us to create computer software, apps, and websites… Each language comes with a special program that takes care of translating what we write into binary code.” This replaces Binary code, letting us write codes that are much easier for us to write, read, and understand.

A programming language acts as a “translator between you and the computer. Rather than learning the computer's native language (known as machine language [or binary code]), you can use a programming language to instruct the computer in a way that is easier to learn and understand.” (https://msdn.microsoft.com/en-us/library/ms172579(v=vs.90).aspx).
“Most programming languages have a basic central core programming language, surrounded by an auxiliary programming environment which provides functions that access the particular environment the program is running in (e.g. screen output). This site will focus on teaching the core programming language concepts at the centre, since this does not change between environments and it is this core which is the foundation of learning pure programming concepts and gaining a deep understanding which can then be applied to any environment or platform you develop programs for” (http://www.howtoprogram.it).

A program is a “text file, written in a certain coding language. The code inside a program file is called the source code. Every coding language has its own file extension for identifying code files written in that language. For example, Python’s is ‘.py’.” (http://www.codeconquest.com/what-is-coding/how-does-coding-work/). Making a program is simple, you write the code in a plain text editor and save the file. Some languages save a separate binary file, allowing the computers to directly run the file, while others have programs that are run indirectly by a certain software.

“A computer doesn’t actually understand [the programs], and it doesn’t know how to display it on a screen. It only understands on and off. So to actually run a command like print ‘Hello, world!’, it has to translate all the code in a program into a series of off and ons that it can understand.” (http://www.codeconquest.com/what-is-coding/how-does-coding-work/). A specialized program known as a compiler takes the instructions written in the programming language and converts them to machine language. This means that as a Visual Basic programmer, you don't have to understand what the computer is doing or how it does it. You just have to understand how the Visual Basic programming language works” (https://msdn.microsoft.com/en-us/library/ms172579(v=vs.90).aspx). The original programming language that you put in must be translated into multiple languages until you end up with simple binary code.

Autonomous code can be integrated with radio control code to achieve even better robot performance for complex tasks. (http://www.vexrobotics.com/vexedr/software/)
Different Types of Programming Languages:
There are multiple languages in computer programming. This is because different languages have been designed for different purposes. For instance, some are used for web development, while others may
be used for solving numeric problems. These languages can be classified into low-level or high-level. Low-level languages are similar to binary code, they also more directly manipulates the hardware of the computer, while high-level languages do not resemble binary code much. Low level languages were the only languages used when computers were first being programed. It requires the programmer(s) to write explicit instructions. However, high-level languages are easier to program in since programmers don’t have to write everything in binary code, which is very tedious. High-level languages are compiled languages, meaning that the programmer writes more general instructions and a compiler translates these instructions into binary code. Once it is translated, the computer can understand the instructions and executes them. The main programming languages that we use today are mostly high-level languages because it’s easier to use, read, and write.

Structured programming is another type of programming language. This language deals with blocks of programming statements, or code, that are executed one by one. Control statements are what change which blocks of code are executed next.

Object oriented programming is when data are contained in objects, “and are accessed using special methods (blocks of code) specific to the type of object. There is no single ‘flow’ of the program as objects can freely interact with one another by passing messages.” (http://holowczak.com/programming-concepts-tutorial-programmers/).

Specific Programming Languages:
“HTML: Hyper Text Markup Language. The core language of the world wide web that is used to define the structure and layout of web pages by using various tags and attributes. Although a fundamental language of the web, HTML is static - content created with it does not change. HTML is used to specify the content a webpage will contain, not how the page functions.
XML: Extensible Markup Language. A language developed by the W3C which works like HTML, but unlike HTML, allows for custom tags that are defined by programmers. XML allows for the transmission of data between applications and organizations through the use of its custom tags.
Javascript: A language developed by Netscape used to provide dynamic and interactive content on webpages. With Javascript it is possible to communicate with HTML, create animations, create calculators, validate forms, and more. Javascript is often confused with Java, but they are two different languages.
VBScript: Visual Basic Scripting Edition. A language developed by Microsoft that works only in Microsoft's Internet Explorer web browser and web browsers based on the Internet Explorer engine such as FlashPeak's Slim Browser. VBScript Can be used to print dates, make calculations, interact with the user, and more. VBScript is based on Visual Basic, but it is much simpler.
PHP: Hypertext Preprocessor (it's a recursive acronym). A powerful language used for many tasks such as data encryption, database access, and form validation. PHP was originally created in 1994 By Rasmus Lerdorf.
Java: A powerful and flexible language created by Sun MicroSystems that can be used to create applets (a program that is executed from within another program) that run inside webpages as well as software applications. Things you can do with Java include interacting with the user, creating graphical programs, reading from files, and more. Java is often confused with Javascript, but they are two different languages.

Software languages

Used for creating executable programs. Can create anything from simple console programs that print some text to the screen to entire operating systems. Vary greatly in terms of power and complexity.
C: advanced programming language used for software application development. Originally developed by Dennis Ritchie at Bell Labs in the 1970's and designed to be a systems programming language but since then has proven itself to be able to be used for various software applications such as business programs, engineering programs, and even games. The UNIX operating system is written in C. [The C language is known for being compatible with many various machine languages.]
C++: Descendant of the C language. The difference between the two languages is that C++ is object-oriented. C++ was developed by Bjarne Stroustrup at Bell Labs and is a very popular language for graphical applications.
Visual Basic: A language developed by Microsoft based on the BASIC language . Visual Basic is used for creating Windows applications. The VBScript language (also developed by Microsoft) is based on Visual Basic.
Java: A powerful and flexible language created by Sun MicroSystems that can be used to create applets (a program that is executed from within another program) that run inside webpages as well as software applications. Things you can do with Java include interacting with the user, creating graphical programs, reading from files, and more. Java is often confused with Javascript, but they are two different languages. Learn Java at our Java tutorials section.

The different generations of languages

There are currently five generations of computer programming languages. In each generation, the languages syntax has become easier to understand and more human-readable.
First generation languages (abbreviated as 1GL): Represent the very early, primitive computer languages that consisted entirely of 1's and 0's - the actual language that the computer understands (machine language).
Second generation languages (2GL): Represent a step up from from the first generation languages. Allow for the use of symbolic names instead of just numbers. Second generation languages are known as assembly languages. Code written in an assembly language is converted into machine language (1GL).
Third generation languages (3GL): With the languages introduced by the third generation of computer programming, words and commands (instead of just symbols and numbers) were being used. These languages therefore, had syntax that was much easier to understand. Third generation languages are known as "high level languages" and include C, C++, Java, and Javascript, among others.
Fourth generation languages (4GL): The syntax used in 4GL is very close to human language, an improvement from the previous generation of languages. 4GL languages are typically used to access databases and include SQL and ColdFusion, among others.
Fifth generation languages (5GL): Fifth generation languages are currently being used for neural networks. A nueral network is a form of artifical intelligence that attempts to imitate how the human mind works.” (http://landofcode.com/programming-intro/computer-programming-languages.php)
Programming in Computers:
Preparing a Program: This process “begins with a complete description of the job that the computer is to perform. This description explains what data must be input, what computing must be done, and what form the output should take. Computer programmers use the description to prepare diagrams and other visual aids that represent the steps needed to complete the task. The programmers may produce a diagram called a systems flow chart that shows how all the major parts of the job fit together. Programs can be written with nothing more than a text editor, a simple program for working with plain text. But some programmers use more specialized software to write their programs.”  (http://www.worldbookonline.com/student/article?id=ar127860&sc=-1#h54#tab=homepage).
Using Objects: Some high-level languages support the use of objects. Objects includes a block of data and methods that act upon those data. “Object-oriented programming (OOP) uses objects that can work together to create a whole program, somewhat like the parts of a car.” The properties are defined by “a model of the data variables and methods for a particular kind of object,” or class. “ Each object is an instance(particular example) of its class, with actual data values instead of variables. “ Instead of needing to recreate sections of code in long paragraphs, we can use different instances of the same class. This arrangement makes changing software easier. (http://www.worldbookonline.com/student/article?id=ar127860&sc=-1#h54#tab=homepage).
Other Features: Other high-level languages include functional and logical programming. Functional programming “emphasizes functions rather than the objects upon which functions act,” whereas logical programming is “based on formal logic, a framework for relating facts.” While these two types of programming are less common, they are frequently used in “artificial intelligence applications and financial software.” Some high-level languages may “be used in more than one way. For example, the languages OCaml and Scala support both object-oriented programming and functional programming. (http://www.worldbookonline.com/student/article?id=ar127860&sc=-1#h54#tab=homepage).
Assembly Languages: Assembly languages are harder to use than high-level languages because it is specific to a particular type of computer. This forces the programmer to state each instruction with much more detail. However, each assembly language instruction corresponds directly to one machine code instruction, making it easier to translate programs into the form the computer needs to execute. (http://www.worldbookonline.com/student/article?id=ar127860&sc=-1#h54#tab=homepage).
Translating High-Level Languages: As stated before, in order for a computer to be able to execute, high-level languages must be first translated into machine language. This becomes more complicated because different types of computers use different machine language. Each computer has its “own way of interpreting binary numbers as data and instructions.” This means that “a program written for one type of machine may not directly run on another type.” Programmers “use several methods to make a high-level language work on a wide variety of computers.”
Compiling a Program: This is just translating it from one language to another. Compilers for high-level languages are more complex than assemblers, for high level languages, as stated before, “do not correspond directly with machine languages.” Compiler usually translates high-level languages into lower-level languages or directly into machine language instructions. “Compilers may also translate high-level statements into one or more intermediate-level languages, such as assembly languages, that are closer to machine languages.” Some even translate a high-level language into another more portable one. A portable language is one that is compatible with a wider variety of machine languages.

Interpreting a Program: When the statements are interpreted as the program is running, meaning the language is being translated into binary code immediately and then executed as it is running. “If program instructions “loop back” to an earlier point in the program, the earlier statements are examined, translated, and executed again.” These programs tend to be slower than programs that are just translated into machine code and then executed. (http://www.worldbookonline.com/student/article?id=ar127860&sc=-1#h54#tab=homepage).
Completing and Distributing a Program: Once the program is written, it must be debugged. The programmer then makes corrections in the written program based on the results. After, the program is translated back into machine code and tested. This process repeats until there are no errors or improper functions detected. As soon as the program has been completely debugged and compiled into machine language, the compiler is no longer needed (unless there needs to be further changes needed later). The file with the machine language can be copied and distributed to anyone who needs the program. (http://www.worldbookonline.com/student/article?id=ar127860&sc=-1#h54#tab=homepage).

Mixed Autonomous and Radio Control Code:
In programming there are three different types of code that dictates if a robot performs behaviors using sensor inputs and/or radio transmitters.

"Autonomous Code:
Autonomous code allows a robot to perform behaviors without input from the radio control transmitter. The robot follow pre-programmed routines responding only to sensor inputs.
Radio Control Code:
Radio control code allows you to configure the way in which the radio control transmitter controls the robot,allowing a human operator to provide input to the robot.
Sources:

1 comment: