1- Machine independent languages
The high level programming languages are machine independent, which means they don’t rely on specifications of a particular machine. Brookshear (2012, p.242) indicate that “Since the statements in a third-generation language did not refer to the attributes of any particular machine, they could be compiled as easily for one machine as for another”. Since machines can understand and execute instructions written in machine language, then a program has to be machine-specific, although the program source code language may be machine-independent, but the compiler target specific machine output.
Brookshear (p.243) “A program written in a third generation language could theoretically be used on any machine simply by applying the appropriate compiler”. The pros of compiling code into machine-specific output is to perform optimizations on the output for the target machine on which the program will run, such optimization won’t be doable if the program is compiled to run on unknown target machine. Machine-independent language may offer optimization in their abstract concepts like structures, objects, loops and conditions, those are machine independent, but the most effective optimizations are those that best exploit special features of the target platform. E.g.: Instructions which do several things at once, such as decrement register and branch if not zero. Wikipedia(2013).
2- Four programming paradigms.
Imperative paradigm: is the traditional approach and also known as procedural paradigm. the process of programming is a procedure has one or more actions or commands executed in sequence. the commands or steps are derived by an algorithm in order to produce the desired result. it describes the details of HOW the results are to be obtained, in terms of the underlying machine model.
Functional paradigm: functional programming is to do computation by calling or applying functions. each function is an abstract of single or multiple expressions which can be evaluated. Brookshear (p.245) define how functional programming is constructed by having smaller units connected in order so that output of each unit is used as an input in another unit till the desired overall output is obtained. the functional paradigm is simple functions are nested together to build to build main one.
As per (Laird ,2009, p.17), The main ideas of functional programming are high-order and pure functions, recursion, evaluation of equations, and pattern matching.
Logic paradigm: This paradigm logic based and is different from other main programming paradigms. It’s designed for Artificial intelligence to deal with problems that requires extraction of knowledge and training driven from facts and making use of rules and relations. Nørmark(2010) highlighted one of its characteristics in program execution becomes a systematic search in a set of facts, making use of a set of inference rules Prolog language is one of the languages that uses logical paradigm. (Laird ,2009), In logic programming, set of facts and rules are analyzed in each step, referred as clauses. Prolog is the widely known language of logic programming.
Object Oriented paradigm: Any top language is known by its support of object-oriented programming (OOP). it has gained great popularity in the recent decade. It has 3 main features: Encapsulation: classes are types that are self-contained modules and an instance of the class is an object. Inheritance: Classes could have relationships and organized in hierarchies, inheritance passes the structure and methods in one class down to child classes in the hierarchy. Polymorphism: common types can be presented by using a uniform interface. These features facilitates programming process when programs become larger and complex. Brookshear (p.247) in OOP a software system is represented as a collection of objects,each object is capable of performing actions or requestion actions from others objects. These objects interacts with each other to work out the domain problem.
As per (Laird ,2009), All four of the main programming paradigms are useful in their own way, but pure programmg languages of only one paradigm are known to be slightly more limiting. Object-oriented design is currently the most versatile and widely used programming paradigm.
3- Machine language vs. assembly language
Assembly Language: is the first step in the evolution of programming languages. (Rajaraman , 1998) “In an assembly language, mnemonics are used to represent operations to be performed by the computer and strings of characters to represent addresses of locations in the computer’s memory”. There’re one-to-one correspondence between assembly statement and machine code instructions. Thus, assembly language is machine dependent as it’s matched to a particular processor structure. A program written in assembly language has to be translated by an assembler to set of machine code/instructions, thus it can be executed by computer. a disassembler performs reverse function.
Machine language: called machine or native code, is the lowest level representation of program. every program is made of a series of instructions executed directly by CPU. Machine language is set of instructions executed directly by CPU. every task has one or more specific instructions. Wikipedia(2013). “Unfortunately, writing programs in a machine language is a tedious task that often leads to errors that must be located and corrected (a process known as debugging) before the job is finished.” Brookshear (p.240).
Although assembly language is low-level language, but is higher level than machine code. It’s more logical and human readable than machine code.