Sunday, September 28, 2014

Q&A Assignment #2 Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #2 Problem Set dari Chapter 1 Introduction dari Sebesta.

Q&A session:
6. Q: What common programming language statement, in your opinion, is most detrimental to readability?
A: Poorly written, unordered, and undocumented programming language is the most commonly problem that another person will hard to follow and read.

7. Q: Java uses a right brace to mark the end of all compound statements. What are the arguments for and against this design?
A: 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. Q: Many languages distinguish between uppercase and lowercase letters in user-defined names. What are the pros and cons of this design decision?
A: The reasons why a language would distinguish between uppercase and lowercase in its identifiers are:
(1) So that variable identifiers may look different than identifiers that are names for constants, such as the convention of using uppercase for constant names and using lowercase for variable names in C.
(2) So that catenated words as names can have their first letter distinguished, as in TotalWords. (Some think it is better to include a connector, such as underscore.) 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 SUM and Sum.

9. Q: Explain the different aspects of the cost of a programming language.
A: There are 2 aspects of the cost of a programming language. Such as, first, the cost of testing/running the program. Second, the cost of maintaining and documenting the program.

10. Q: What are the arguments for writing efficient programs even though hardware is relatively inexpensive?
A: 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.

Saturday, September 27, 2014

Difference between Imperative Language and Procedural Language

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Soal bonus tentang perbedaan Imperative Language dengan Procedural Language.


Difference:
Procedural programming is a programming paradigm, derived from structures.programming, based upon the concept of the procedure call. Procedures, also known as routines, subroutines, methods, or functions (not to be confused with mathematical functions, but similar to those used infinctional programming), simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. Procedural programming is a list or set of instructions telling a computer what to do step by step and how to perform from the first code to the second code. Procedural programming languages include C, Go, Fortran, Pascal, and BASIC
Procedural language is imperative programming in which the program is built from one or more procedures (also known assubroutines or functions). The terms are often used as synonyms, but the use of procedures has a dramatic effect on how imperative programs appear and how they are constructed. Heavily-procedural programming, in which state changes are localized to procedures or restricted to explicit arguments and returns from procedures, is known as structured programming. From the 1960s onwards, structured programming and modular programming in general have been promoted as techniques to improve the maintainability and overall quality of imperative programs. Object-oriented programming extends this approach.
Procedural programming could be considered a step towards declarative programming. A programmer can often tell, simply by looking at the names, arguments and return types of procedures (and related comments), what a particular procedure is supposed to do, without necessarily looking at the details of how it achieves its result. At the same time, a complete program is still imperative since it 'fixes' the statements to be executed and their order of execution to a large extent
Name: Vina Melinda
NIM: 1801380106

Q&A Assignment #1 Review Questions

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #1 Review Questions dari Chapter 1 Introduction dari Sebesta.

Q&A session:
6. Q : In what language is most of UNIX written?
    A : In C language because it is relatively easy to port or move to different machines.


7. Q : What is disadvantage of having too many features in a languange?
    A : Awareness of a wider variety of programming language features can reduce limitations in software development. The basic simplicity of reading a program could be lost. The simpler and more user-friendly programming languages allow for a smoother creation process, especially if there are many people working on the same code.


8.  Q : 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 thow to make precision of this operator. Therefore we don't use user defined operator. 


9. Q : What is one example of a lack of  orthogonality in the design of C?
    A : Condider the following rules and exception in C. Although C has two kinds of structured data types, arrays and records(structs), records can be returned from functions but array cannot. A member of structure can be any data type except void or a structure of the same type. An array element can be any data type except void or a function. Parameters are passed by value, unless they are arrays, in which case they are, in effect, passed by reference(because the appearance of an array name without subscript in a C program os interpreted to the address of the array's first element).


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