Nama : Christian Gunawan
NIM : 1801384174
Review Questions : #6-10
6. In what language is most of UNIX written?
The UNIX operating system is written almost entirely in C (ISO, 1999),
which has made it relatively easy to port, or move, to different machines. Some of the characteristics of C make it a good choice for systems programming. It is low level, execution efficient, and does not burden the user with many safety restrictions.
7. What is the disadvantage of having too many features in a language?
Many features now available in programming languages were not widely known at the time. The result is that many programmers, hard to adapt to a new language and when given a choice of languages for a new project,they use the language with which they are most familiar, even if it is poorly suited for the project at hand.
8. How can user-defined operator overloading harm the readability of a program?
Operator overloading makes single operator symbol has more than one meaning. Although this is often useful, it can lead to reduced readability if users are allowed to create their own overloading and do not do it sensibly.
9. What is one example of a lack of orthogonality in the design of C?
As examples of the lack of orthogonality in C that Although C has two kinds of structured data types, arrays and records (structs), records can be returned from functions but arrays cannot.
10. What language used orthogonality as a primary design criterion?
Functional languages offer a good combination of simplicity and orthogonality.
A functional language, such as LISP, is one in which computations are made primarily by applying functions to given parameters.
Problem Set : #6-10
6. What common programming language statement, in your opinion, is most detrimental to readability?
I think rarely-stated statement or strange data types and syntax designs that makes the user and computer's readability low.
C and its descendants (Java) use braces to specify compound statements. All of these languages suffer because statement groups are always terminated in the same way, which makes it difficult to determine which group is being ended when an end or a right brace appears.
Fortran 95 and Ada make this clearer by using a distinct closing syntax for each type of statement group. For example, Ada uses end if to terminate a selection construct and end loop to terminate a loop construct.
8.Many languages distinguish between uppercase and lowercase letters in user-defined names. What are the pros and cons of this design decision?
Pros : So that variable identifiers may look different than identifiers that are names for constants, such as the convention of using upper case for constant names and using lowercase for variable names in C.
Cons : The primary reason why a language would not distinguish between uppercase and lowercase in identifiers is it makes programs less readable. because words that look very similar are actually completely different, such as set and SET
9. Explain the different aspects of the cost of a programming language.
First, there is the cost of training programmers to use the language, which is a function of the simplicity and orthogonality of the language and the experience of the programmers.
Second, there is the cost of writing programs in the language. This is a function of the writability of the language, which depends in part on its closeness in purpose to the particular application.
Third, there is the cost of compiling programs in the language. A major impediment to the early use of Ada was the prohibitively high cost of running the first-generation Ada compilers.
Fourth, the cost of executing programs written in a language is greatly influenced by that language’s design. A language that requires many run-time type checks will prohibit fast code execution, regardless of the quality of the compiler.
The fifth factor in the cost of a language is the cost of the language implementationsystem. One of the factors that explains the rapid acceptance of Java is that free compiler/interpreter systems became available for it soon after its design was released.
Sixth, there is the cost of poor reliability. If the software fails in a critical system, such as a nuclear power plant or an X-ray machine for medical use, the cost could be very high.
The final consideration is the cost of maintaining programs, which includes both corrections and modifications to add new functionality. The cost of software maintenance depends on a number of language characteristics, primarily readability.
First, there is the cost of training programmers to use the language, which is a function of the simplicity and orthogonality of the language and the experience of the programmers.
Second, there is the cost of writing programs in the language. This is a function of the writability of the language, which depends in part on its closeness in purpose to the particular application.
Third, there is the cost of compiling programs in the language. A major impediment to the early use of Ada was the prohibitively high cost of running the first-generation Ada compilers.
Fourth, the cost of executing programs written in a language is greatly influenced by that language’s design. A language that requires many run-time type checks will prohibit fast code execution, regardless of the quality of the compiler.
The fifth factor in the cost of a language is the cost of the language implementationsystem. One of the factors that explains the rapid acceptance of Java is that free compiler/interpreter systems became available for it soon after its design was released.
Sixth, there is the cost of poor reliability. If the software fails in a critical system, such as a nuclear power plant or an X-ray machine for medical use, the cost could be very high.
The final consideration is the cost of maintaining programs, which includes both corrections and modifications to add new functionality. The cost of software maintenance depends on a number of language characteristics, primarily readability.
10. What are the arguments for writing efficient programs even though hardware is relatively inexpensive?
One of the main arguments is that regardless of the cost of hardware, it is not free. Why write a program that executes slower than is necessary. Furthermore, the difference between a well-written efficient program and one that is poorly written can be a factor of two or three. In many other fields of endeavor, the difference between a good job and a poor job may be 10 or 20 percent. In programming, the difference is much greater.
One of the main arguments is that regardless of the cost of hardware, it is not free. Why write a program that executes slower than is necessary. Furthermore, the difference between a well-written efficient program and one that is poorly written can be a factor of two or three. In many other fields of endeavor, the difference between a good job and a poor job may be 10 or 20 percent. In programming, the difference is much greater.
Bonus Question:
1.What's the difference between "Imperative Language" and "Procedural Language"?
Imperative Language is any programming language that specifies explicit manipulation of the state of the computer system, not to be confused with a procedural language,which specifies an explicit sequence of steps to perform.
An example of an imperative (but non-procedural) language is a data manipulation language for a relational database management system. Thisspecifies changes to the database but does not necessarily require anyoneto specify a sequence of steps.
Both contrast with declarative languages, which specify neither explicitstate manipulation nor a sequence of steps.
Procedural language, as the name implies, relies on predefined and well-organized procedures, functions or sub-routines in a program’s architecture by specifying all the steps that the computer must take to reach a desired state or output.
Procedural language segregates a program within variables, functions, statements and conditional operators. Procedures or functions are implemented on the data and variables to perform a task.
Procedural language is one of the most common programming languages in use with notable languages such as C/C++, Java, ColdFusion and PASCAL.
Imperative Language is any programming language that specifies explicit manipulation of the state of the computer system, not to be confused with a procedural language,which specifies an explicit sequence of steps to perform.
An example of an imperative (but non-procedural) language is a data manipulation language for a relational database management system. Thisspecifies changes to the database but does not necessarily require anyoneto specify a sequence of steps.
Both contrast with declarative languages, which specify neither explicitstate manipulation nor a sequence of steps.
Procedural language, as the name implies, relies on predefined and well-organized procedures, functions or sub-routines in a program’s architecture by specifying all the steps that the computer must take to reach a desired state or output.
Procedural language segregates a program within variables, functions, statements and conditional operators. Procedures or functions are implemented on the data and variables to perform a task.
Procedural language is one of the most common programming languages in use with notable languages such as C/C++, Java, ColdFusion and PASCAL.
No comments:
Post a Comment