Sie sind auf Seite 1von 9

1.

why is it useful for a programmer to have some background in language design, even
though he or she may never actually design a programming language?

because understanding the basic makes it easier ti learn and adopt new languages. it also helps to
design and develop more better software. programmer’s need to understand how their code will
work to ensure it is fault tolerant and high performing.

2. How can knowledge of programming language characteristics benefit the whole


computing community?

it will provide insight on what functionally that certain languages provide works well, and what
doesn’t work well. this also will allow programmers design languages that contain the great
characteristics of languages.

3. What programming language has dominated scientific computing over the past 50
years?

programming language that has dominated scientific computing over the past 50 years is
Fortran. It is still used because the primary concern of scientific applications is efficiency.

4. What programming language has dominated business applications over the past 50
years?

programming language that has dominated business applications over the past 50 years is
COBOL. COBOL is an acronym for Common Business-Oriented Language. this programming
language is one of the oldest programming languages, primarily designed by Grace Hopper.
Defining its primary domain in business, finance, and administrative systems for companies and
governments.

5. What programming language has dominated artificial intelligence over the past 50
years?

Lisp (List Processing) is one of programming language with a long history and a distinctive,
fully parenthesized polish prefix notation. this is the second oldest high level programming
language in widespread and also has changed a great deal since its early days. it was originally
created as a practical mathematical notation for computer programs, influenced by the notation
of Alonzo Church’s lambda calculus. it quickly became the favored programming language for
AI (artificial intelligence) research. Lisp pioneered tree data structures, automatic storage
management, dynamic typing, and the self-hosting compiler.

6. In What language is most of UNIX written?

7. What is the disadvantage of having too many features in a language?


It tends to lead to knowing only a subset.

8. How can user-defined operator overloading harm the readability of a program?

If the operations are used in odd unintuitive ways.

9. What is one example of a lack of orthogonality as a primary design criterion?

C has 2 structured data types (arrays and structs) arrays can be returned from functions butstructs
can’t.

10. What language used orthogonality as a primary design criterion?

Language that used orthogonality as a primary design criterion is ALGOL 68. The main aims
and principles of design of ALGOL 68 :

1. Completeness and clarity of design

2. Orthogonal design

3. Security

4. Efficiency : Static mode checking, mode-independent parsing, Independent compilation, Loop


optimization, representations – in minimal & larger character sets.

11. What primitive control statement is used to build more complicated control statements
in languages that lack them?

The selection statement plus GOTO is used to build more complicated control statements such as
FOR loop.
12. What construct of a programming language provides process abstraction?

Subprograms.
13. What does it mean for a program to be reliable?

A program is said to be reliable if it performs to its specifications under all conditions.


14. Why is type checking the parameters of a subprogram important?

because it can lead to lots of hard to debug errors.


15. What is aliasing?

Aliasing is two or more distinct names that can be used to access the same memory cell.

16. What is Exception Handling?


is the process of responding to the occurrence during computation, often changing the normal
flow of program execution and provided by specialized programming language constructs or
computer hardware mechanisms. it is able to intercept run-time errors or take corrective
measures. Commonly, it is resolved by saving the current state of execution.

17. Why is readability important to writability?

Readability is important to writability because if programming language is difficult to read and


understand then it can be difficult for a programmer to create new code that might need to
interact or use other code.
18. How is the cost of compilers for a given language related to the design of that language?

Many run time checks will prohibit fast code execution. If optimization is used compiling will be
slower but execution will be faster.
19. What have been the strongest influences on programming language design over the past
50 years?

The basic architecture of computers(von Neumann).


20. What is the name of the category of programming languages whose structure is dictated
by the von Neumann computer architecture?

Imperative languages
21. What two programming language deficiencies were discovered as a result of the
research in software development in the 1970s?

Incompleteness of type checking and inadequacy of control statements


22. What are the three fundamental features of an object-oriented programming language?

Data abstraction,inheritance and dynamic (run-time) method.


23. What language was the first to support the three fundamental features of object-
oriented programming?

Smalltalk.
24. What is an example of two language design criteria that are in direct conflict with each
other?

Reliability and cost of execution


25. What are the three general methods of implementing a programming language?

Compilation,pure interpretation, hybrid implementation systems


26. Which produces faster program execution, a compiler or a pure interpreter?

Compiler.
27. What role does the symbol table play in a compiler?
the symbol table serves as a database for the compilation process in a compiler.
28. What is the utility of byte code?

29. What is a hybrid implementation system?

hybrid implementation system is a method that is not as fast as compiled languages, they are
faster than interpreted languages and compile faster than compiled languages. The source
language statements are decoded only once.
30. What are the advantages of using Borland JBuilder?

the advantages are :

1. provides the usual drag and drop, wysiwyg ui designer

2. comes with a set of neat data-aware swing components for rapid database application
development.

3. supports pluggable add in’s.

Problem Set

1. Do you believe our capacity for abstract thought is influenced by our


language skills? Support your opinion.

Answer: Yes I do believe our capacity for abstract thought is defenitely influenced by our
language skills because our abstract thought is one of important reason we can make
programs. There are a number of programming domains that have radically different
requirements, such as scientific and business, that dismiss any notion of a simple language for all
programming domains as well as the different language evaluation criteria.

2. What are some features of specific programming languages you know


whose rationales are a mystery to you?

A few came to mind:

 The ability to transforms copybooks in Cobol when you import them


 Java’s insistence that all code should be reachable when compiling a program.
 Perl’s dynamic scoping (I guess some other languages have this too)
 Erlang’s non-structured macro’s (the code that an identifier maps to does not need to be
valid Erlang, as long as it becomes so after substitution).
3. What arguments can you make for the idea of a single language for all
programming domains?

Answer: It's a brilliant idea. Imagine when we have just one single language for all programming
domains, everytime programmers make a project that involves programmers from particular
programming domains, programmers would do much better teamwork because they can fully
understand each other and the result would make the project to become much better.

4. What arguments can you make against the idea of a single language for
all programming domains?

Answer: Every programmers are supposed to master particular programming domains of their
own. Because when programmers are making a project that involves particular programming
domains, they would need teamwork. Teamwork means that programmers will try to cooperate,
using their individual skills and providing constructive feedback, despite any personal conflict
between individuals. If there were a single language for all programming domains, then it would
not necessary to have a teamwork of programmers.

5. Name and explain another criterion by which languages can be judged


(in addition to those discussed in this chapter).

Answer: There's another criterion of languages in addition to those discussed in this chapter. One
possibility is Straightforward. In some languages, a great deal of text is required for even simple
complete programs. For example, COBOL is very rambling. Programs written in COBOL tend to
be much longer than the same programs written in other languages. To be Straightforward on the
languages, it can improves program creation, takes less file space for the source programs, and
can cause programs to be more readability.

6. What common programming language statement, in your opinion, is most detrimental to


readability?

Until now I just learned one programming language, it is C, and I didn't find any detrimental to
readability.

7. Java uses a right brace to mark the end of all compound statements. What are the
arguments for and against this design?

The argument for using the right brace to close all compounds is simplicity—a right brace
always terminates a compound. The argument against it is that when you see a right brace in a
program, the location of its matching left brace is not always obvious, in part because all
multiple-statement control constructs end with a right brace.

8. Many languages distinguish between uppercase and lowercase letters in user-defined


names. What are the pros and cons of this design decision?

 The pros of this design decision is to differentiate between the variable identifiers and the
constant variable such as in C, where in practice, the uppercase is being used for constant
names and lower case being used for variable names.
 The cons of this design decision, it makes the program less readable, because the same
exact variable we spell are actually have a different meaning in programming language,
such as NUM and num.

9.explain different aspects of cost of programming language?

 Cost of training programmers in that particular language


 Cost of writing codes or development in that language (depends on writability)
 Cost of compilation and execution (both costs go in opposite directions)
 Cost of implementation system, reliability and cost of maintaining the existing code.

10. What are the arguments for writing efficient programs even though hardware is
relatively inexpensive?

The main argument is that regardless of the cost of hardware, it can never be free. There is no
need of writing a program that executes slow than necessary or takes so long to produce output.
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 different fields, good work and poor work may
be 10 or 20 percent in quality difference. However, in programming the difference is greater

11. Describe some design trade-offs between efficiency and safety in some language you
know.

The forward declaration basically makes it impossible for the calling code to reserve space for
the object at compile time, this means that states that language c ++ more efficient.
C++ is extremely unsafe because every pointer can be used to modify every piece of memory
from any point in code. C++ is extremely unusable due to cryptic syntax, incomprehensible
semantics and endless rebuild cycles.

12. In your opinion, what major features would a perfect programming language include?

Features that maximize the programming language is simple, and easy to understand, can
recognize the data type structure, run the configuration syntax, can correct errors in configuring

13. Was the first high-level programming language you learned implemented with a pure
interpreter, a hybrid implementation system, or a compiler ? (You may have to research
this.)

programming language I’d learn is C++ which is implemented with visual C++ and it is a
compiler.
14. Describe the advantages and disadvantages of some programming environment you
have used.

> C++ language advantage :


– C language code is portable and flexible for all types of computers.
– C language provides few key words.
– Process executable C language program faster
– C language has a good structure that is easy to understand.
C++ language disadvantages :
– Some operators as well as the flexibility of writing programs sometimes confusing users.
– For beginners in general have trouble using pointers.

15. How do type declaration statements for simple variables affect the readability of a
language, considering that some languages do not require them ?

The use of type declaration statements for simple scalar variables may have very little effect on
the readability of programs. If a language has no type declarations at all, it maybe an aid to
readability, because regardless of where a variable is seen in the program text, its type can be
determined without looking elsewhere. Unfortunately, most languages that allow implicitly
declared variables also include explicit declarations. In a program in such a language, the
declaration of a variable must be found before the reader can determine the type of that variable
when it is used in the program.

16. Write an evaluation of some programming language you know, using the criteria
described in this chapter.

Answer :

Java has some issues with simplicity with respect to readability. There is feature multiplicity in
Java as shown in the textbook, example count=count + 1, count ++, count +=1 and ++count.
Control statements in Java have higher readibility than BASIC and Fortran because they can use
more complex conditionals like for loops

Writability

Java has a fair bit of orthogonality in that its primitive constructs can be used in various different
ways

Reliability

Java uses a type checker at compile time which virtually eliminate most of the type errors during
run time
17. Some programming languages—for example, Pascal—have used the semicolon to
separate statements, while Java uses it to terminate state-ments. Which of these, in your
opinion, is most natural and least likely to result in syntax errors? Support your answer.

Personally i feel that pascal’s usage of the semicolon to separate statements is rather
counterintuitive but possibly it’s because I learned the usage of semicolon to terminate
statements in C before I learned pascal. In pascal one needs to look ahead and identify weather or
not the next line is a statements before putting a semicolon. For example if use had a program in
pascal that had a simple if statements.

If x = 0 then

Answer:=1;

Then in pascal if you wanted to add an else clause you would have to go back and delete the
semicolon because an else clause is not considered a new statements.

If x = 0 then

Answer:=1

Else

Answer:=2;

Some pascal compilers will catch wrongly placed semicolons and declare them as errors. It also
means that a programmer needs to be able to recognize what is and what is not a statements thus
it hurts writability. Of course, other requirements in java such us the usage of parenthesis around
the conditional or the usage of braces around the compound statements can also be confusing.
However i think it’s easier to remember not to put a semicolon after a right braces than it is to
have to watch out for not putting it after each statements. The relative consistency of java is more
intuitive than the structural of pascal.

18. Many contemporary languages allow two kinds of comments: one in which delimiters
are used on both ends (multiple-line comments), and one in which a delimiter marks only
the beginning of the comment (oneline comments). Discuss the advantages and
disadvantages of each of these with respect to our criteria.

The main disadvantage of using paired delimiters for comments is that it results in diminished
reliability. It is easy to inadvertently leave off the final delimiter, which extends the comment to
the end of the next comment, effectively removing code from the program. The advantage of
paired delimiters is that you can comment out areas of a program. The disadvantage of using
only beginning delimiters is that they must be repeated on every line of a block of comments.
This can be tedious and therefore errorprone. The advantage is that you cannot make the mistake
of forgetting the closing delimiter.