Enter your Email Address:

Delivered by FeedBurner

To get posts delivered to your Email

26 February 2017

Programming Language Pragmatics [Chapter 1, Section 1.3] Check Your Understanding

This post has my answers for "Check Your Understanding" questions in section 1.3, Chapter 1 of the book Programming Language Pragmatics by Michael L. Scott.

Chapter 1, Section 1.3 - Check Your Understanding

Question #1: What is the difference between machine language and assembly language?
Machine language is written using the instructions set of the processor directly. Each operation supported by the processor is given a code using which the operation is carried out. The code written in Machine language will be in hexadecimal. But in the case of assembly language the program is written using mnemonic (often represented as operations such as MOV, STORE, ADD, SUB etc) which later translated to machine instructions by software called assembler. The assembly language also has provisions for macro definition which expanded by assembler before producing machine code.

Question #2: In what way(s) are high level languages an improvement on assembly language? In what circumstances does it still make sense to program in assembler?
While assembly language is faster to execute, high-level languages can be easily learnt by programmers, ported to varied architecture without requiring to rewrite entire logic on many architectures and saves programmers time since high-level languages are not one-to-one mapping of machine instructions. High level languages often use functions (in the context of mathematical functions) to produce highly expressive code. However assembler will be default choice for system specific performance reasons.

Question #3: Why are there so many programming languages?
There are several programming languages because of the following reasons - evolution, special purpose, personal choice, 

Question #4: What makes a programming language successful?
The programming languages are successful because of one or several of the following reasons - expressive power, Ease of use, ease of implementation, standardization, open source, excellent compilers, economic, patroage and internia.

Question #5: Name three languages in each of the following categories: von Neumann, functional, object-oriented. Name two logic languages. Name two widely used concurrent languages
von Neumann - C, Ada, Fortran
Functional: Haskell, ML, Scheme
Object-oriented: Java, C++, Smalltalk
Logic Languages: Prolog, spreadsheets
Concurrent Languages: C++, Java 

Question #6: What distinguishes declarative languages from imperative languages?
Imperative languages solves a problem by sequence of steps with each steps produces some side effects. The imperative language focuses on how a problem should be solved rather than what to do. The declarative languages on the other hand focuses on what needs to done.

Question #7: What organizations spearheaded the development of Ada?
US Department of Defence

Question #8: What is generally considered the first high-level programming language?

Question #9: What was the first functional language?
Lisp, Scheme?

Question #10: Why aren't concurrent languages listed as category in Figure 1.1?
Concurrency support is available in many of languages such as Java, C++ and C. Several concurrency packages are available as language extensions

25 February 2017

Abstraction - Events IN, Solutions OUT

Abstraction is a great tool for mankind. The history of human evolution has seen uncountable number of evidences on the usefulness of abstraction. Abstraction is to absorb important attributes and leaving out unimportant attributes. Very state that we are in is the fruit of our ability to abstract - Ideas.

Image result for abstraction problem solving
Ideas - what are ideas. Ideas are fruits of abstraction of events happening around us or impulse of information that happens elsewhere (which again an event to us). In problem solving domain, ideas are output of abstraction (elevated thinking) and inference (desirable response from higher plane of thinking). 

While most of us think creativity is for people who are brainy. But the truth is that the creativity is fruit of hard work, systematic way of abstracting the problem and connecting those events with our experience. Like anything, it is only the practice that makes it smart work. The first step towards solving problems is to understand a problem or rather find/recognize a problem, understanding it at higher plane and giving way for ideas to emerge. 

Abstraction is what it took us where we are and it is the only thing that is going to take us where we ought to go.

PS 1: This is hangover of reading programming languages pragmatics which i think is a wonderful book. I will be reading for next several months (so surely there are going to be numerous posts on that)

PS 2: I am posting after an year. I have to admit that i ran out of ideas and since i am reading a book i think i will get a lot more ideas