CSCi 372
Assignment 01
1. What are the different Language Evaluation Criteria?
A language evaluation criterion is broadly used to measure how usable a programming language is. This includes four main criteria and many characteristics alongside.
Readability: defines the ease of understandability of a programming language. Include many factors such as below. * Simplicity – strongly affects readability. A language with few basic constructs is much easier to learn. Feature multiplicity and operator overloading are potential problems of simplicity. * Orthogonality – a language with few primitive constructs can only be combined in small number of ways to create the control and data structures. Relatively close …show more content…
to simplicity, the more orthogonal a language is, the fewer exceptions required. This means better readability and easier understandability. * Data types – ability to define adequate types of data structures is important. If there was no Boolean type data structure, we might have to use 1, 0 as true or false but this affects readability. * Syntax design – how the syntax is designed is important for readability in ways such as defining identifier forms. If identifiers can define into descriptive names, it facilitates readability. Another factor is the language’s special words. Words reserved for specials purposes quickly indicates reader to what is beginning or end and control.
Writability: measures how easy to program software using the certain language. Following characteristics influences writability. * Simplicity and orthogonality – combing fewer primitive constructors into different ways simplifies writability. But too many orthoganility may cause to errors go undetected. * Support for Abstraction – using abstraction, language has the ability to hide complex operation structures details. You may abstract an operation into a method that get to used several times in a program and only use the method calling in those places. Abstraction can be in two different categories as process and data. * Expressivity – ability of having many ways of specifying a computation such as ‘i++’ rather than ‘i=i+1’. Facility to express certain code in different convenient ways can be called expressivity.
Reliability: if a program performs to tis specifications under all conditions, it called reliable. Here follows some effective characteristics affects to reliability. * Type checking – testing for type errors while compiling or during execution. Very important factor of reliability. * Exception handling – the ability of countermeasure runtime errors and continue the program is very important to reliability. * Aliasing – ability to address same memory location using many distinct names is aliasing. In some languages, aliasing used to overcome data structure deficiencies. * Readability and Writability – both of these also influence the reliability.
Cost: the cost of a program language may seem blurry but it does measure. Some characteristics are mentioned below. * Cost of training programmers to use the language. More orthogonal the language, less cost this may have. * Writing programs in the language * Compiling programs in language * Cost of execution programs written in a language * Cost of implementation system * Cost of maintain system
2.
What are the different Language categories?
Imperative Languages: usually procedure-oriented paradigm is used with imperative languages. Features include variables, assign statements and control statements. Examples for pure imperative languages are C, Perl, and Ruby. All the object-oriented paradigm based languages are evolved from imperative languages such as Java.
There is subcategory as visual languages on the imperative languages. These visual languages gives ability of generate GUIs easily by drag and drop. All .NET languages such as VB.NET and C++, C# categorized into here.
Scripting languages such as JavaScript, Perl and Ruby are considered as imperative languages too.
Functional Languages: paradigm that apply functions into computation and consider as evaluation of mathematical functions. Basically means applying functions to given parameters. Widely used in academic purposes rather than commercial software industry. Functional programming avoids side-effects, referential transparency. Very different from imperative programming languages. Examples for functional languages are LISP, Scheme, Haskell and …show more content…
Clojure. Logic Languages: mainly considered rule-based languages.
In logic languages, rules are not defined into great details as in imperative languages. Rules are specified in no particular order, so implementation must use the language to achieve desired results. Based on idea of using logical sentences to represent programs and perform computations. A very common example is Prolog for a logic language. Object-oriented Languages: mainly features as same as the imperative languages because these languages are evolved from imperative languages. The specialty rests on the object-oriented concepts in these languages. Widely used for every kind of software programming and the most commonly used languages are considered to these languages. Java, C#, C++ and Python are few examples. 3. What are the differences between Compilation, Interpretation and Hybrid implementation Systems?
Compilation: programs are translated into machine code which can directly execute on the computer. Compiler analyzes the whole code and generates the machine code which makes it very fast process. And due to this, compiled programs don’t require any second application or package to run it. The time takes to create a program from compilation is relatively faster than interpretation. As a disadvantage, compilation process is hardware specific into which machine it get compiled. Architecture of the computer affects
compilation. Pure Interpretation: the interpreter interprets the programs as like as software simulation. Interpreter runs through the code line by line determining every expression and statement made in the code rather than translating symbols into machine language like compilation. Interpreter interprets the code almost every time it executed. This takes more time to run a program than compilation. Also interpretation requires more space to interpret programs every time. Interpretation has advantage of allowing many levels of debugging of source code because it goes through code line by line. This makes code more reliable due to run-time errors are even possible to encounter while interpretation. Hybrid Implementation: translates high-level programming source code into intermediate language designed to allow easy interpretation. Many high level languages such as Java uses this implementation method by converting code into intermediate form called byte code that can be executed in any JVM which gives more portability. Using hybrid implementation, debugging process can also take action while making the program execution fast. A JIT (Just-In-Time) implementation system; which is hybrid system translates source code into intermediate language. This system used in all the .NET languages. 4. What are the different Object Oriented Concepts?
Object-Oriented Programming: Object-orientation is a design philosophy. Things in the OOP can be sustained into objects. Using OOP, programmer can gain reusability by the concepts of OOP. The following discussed the main concepts of the object-oriented programming. Class: the most basic concept. A representation of a type of object. Defines the characteristics of object includes its attributes, properties and behavior. Can be called as a blueprint for which objects are created. Objects: instances of classes. Objects are created from classes modeling the real world things. Object is run-time value which stores details and state. Encapsulation: protecting and hiding information from being directly manipulated is encapsulation. This can be called as wrapping up data and methods of into single unit. This will present the method of function but not the details of how it is being done. Using a class to create an object is a good example for this. Even using calling methods can be seen as encapsulation. Abstraction: simplifying the complexity by suppressing details can see as abstraction. It just represents the important details but not all. Hiding irrelevant details reduces complexity of large programs and increases the formality of design structure. Abstract classes are an example for this from any OO language. Interfaces can be taken as example for abstraction also. Inheritance: ability of creating a new class by extending an existing class by using its attributes and operations to use is called inheritance. Using a parent/base class, we create a child/sub class by adopting all the attributes and operation methods. This is more into specialization of OO concepts. Polymorphism: means taking more than one form or one shape. The ability of objects responds to call of method of the same name by different data type as parameters is an example for this. Method Overloading is a main example which defines polymorphism in the programming. This gives the ability of request same operation but to perform wide range of different things. 5. What is Recursion?
Recursion in programming languages is allowing a function to call itself with in the same function. This is a method to solve problems which depends on solution of smaller instances of itself. When using recursion, function calls itself causing execution of another function of with smaller piece of problem. Also, function must define a base class and should recursively move towards the base class to avoid infinite recursion.
Finding factorial function is a common example of recursion of computer science. int myFactorial( int integer)
{
if( integer == 1) return 1; else return(integer*(myFactorial(integer-1);
}
Calculating Fibonacci number is another example that can recursion take place. int fib(n)
{
if (n < 2) return n; else return fib(n-1) + fib(n-2);
}
When you compare recursion with iteration, the differences between speed of execution and amount of space used iteration is high. Speed of execution of iteration is particularly faster than recursion because recursion calls itself many times. Space used for recursion is very high and sometimes larger recursions may cause to insufficient memory. Iterations only use few memory spaces to store the variables for the functional period.
The advantage of using recursion lies on the making the programming and coding much simpler. You may avoid writing very long code by using recursion sometimes. And sometimes it will be much easier logical solution.
Reference: Abhishek. "Understanding OOPs Concepts." Techvyom. N.p., 23 Apr. 2010. Web. 09 Sept. 2012. <http://www.techvyom.com/understanding-oops-concepts.html>. "Compilation (programming)." Wikipedia. Wikimedia Foundation, 15 Aug. 2012. Web. 09 Sept. 2012. <http://en.wikipedia.org/wiki/Compilation_(programming)>. "Interpreter (computing)." Wikipedia. Wikimedia Foundation, 09 Apr. 2012. Web. 09 Sept. 2012. <http://en.wikipedia.org/wiki/Interpreter_(computing)>. Parlante, Nick. "OOP Concepts." N.p., n.d. Web. 9 Sept. 2012. <http://www.stanford.edu/class/cs193i/handouts2000/28OOPConcepts.pdf>. "Recursion (computer Science)." Wikipedia. Wikimedia Foundation, 09 June 2012. Web. 09 Sept. 2012. <http://en.wikipedia.org/wiki/Recursion_%28computer_science%29>.