Monday, September 29, 2014

Bonus Question

Q : Explain the differences between imperative language and procedural language.
A : A language can be imperative without being procedural or structured, for example pure assembly language. Having step by step interpretive control flow doesn’t mean procedural, but division of functionality into function is what make language procedural

Chapter 1 : Problem Set

Q6 : What common programming language statement, in your opinion, is most detrimental to readability?
A   : So far, I've only learned language C. But I think those languages that have too many features are the most detrimental to readability.

Q7 : Java uses a right brace to mark the end of all compound statements. What are the arguments for and against the design?
A    : Pros : It’s simple. It's like ending a sentence, but instead of using a full-stop, we use right brace.
         Cons : Sometimes, the location of its matching left brace isn't obvious.

Q8 : Many languages distinguish between uppercase and lowercase letter in user-defined names. What are the pros and cons of this design decision?
A  : Pros : It allows us to differentiate variables based on whether they are uppercase or not.
        Cons : It is troublesome, because if we forget to change the letter to the proper case, it can cause some problems when we run the program.

Q9 : Explain the different aspects of cost of a programming language.
A  : The different aspects of the cost of programming languages lies in their complexities. The data structure and the data types are another different aspects.

Q10 : What are the arguments for writing efficient programs even though hardware is relatively inexpensive?
A     : Efficiency doesn't just mean saving disk space, or making things faster, it also relates to maintenance and reliability. Current programs that are written poorly because of cheap hardware are just as bad as poorly written programs of the past, they waste resources in both time and space. Inefficient programs cause page faults, memory errors, and leaks that can cause system-wide crashes. Just because the system may have more memory and speed does not make it impervious to bad programming.

Sunday, September 28, 2014

Chapter 1 : Review Question

Q6 : In what language is most of UNIX written?
A   : C languange. In fact, C was created to write the UNIX operating system.

Q7 : What is the disadvantage of having too many features in a language?
A   : Reduced readability. It also means that a programmer may not be familiar with all the features that may cause an accidental use of an unknown feature.

Q8 : How can user-defined operator overloading harm the readability of a program?
A  :Because the built in operator has the precision and compiler knows all the precision between the operators, and it works on that precision. User can also create its own operator but the compiler does not come to know how to make precision of this operator. Therefore we don't use user-defined operator.

Q9 : What is one example of a lack of orthogonality in the design of C?
A   : C has 2 structured data types, which are arrays and structs. A struct can be returned from a function while an array can’t.

Q10 : What language used orthogonality as a primary design criterion?
A     : ALGOL 68.